Changeset 37c57f2 in mainline for generic/src/ipc/sysipc.c
- Timestamp:
- 2006-03-16T20:56:22Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ff14c520
- Parents:
- 6a22fcb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/ipc/sysipc.c
r6a22fcb r37c57f2 36 36 #include <ipc/ipc.h> 37 37 #include <ipc/sysipc.h> 38 39 38 40 #include <print.h> 41 #include <arch.h> 42 #include <proc/thread.h> 39 43 40 44 /* TODO: multi-threaded connect-to-me can cause race condition … … 138 142 { 139 143 if (IPC_GET_METHOD(call->data) == IPC_M_CONNECTTOME) 144 return 1; 145 if (IPC_GET_METHOD(call->data) == IPC_M_CONNECTMETO) 140 146 return 1; 141 147 return 0; … … 156 162 phone_connect(phoneid,&answer->sender->answerbox); 157 163 } 164 } else if (IPC_GET_METHOD(*olddata) == IPC_M_CONNECTMETO) { 165 /* If the users accepted call, connect */ 166 if (!IPC_GET_RETVAL(answer->data)) { 167 printf("Connecting Phone %P\n",IPC_GET_ARG3(*olddata)); 168 ipc_phone_connect((phone_t *)IPC_GET_ARG3(*olddata), 169 &TASK->answerbox); 170 } 158 171 } 159 172 } … … 319 332 * 320 333 * The arg1 and arg2 are changed in the forwarded message 334 * 335 * Warning: If implementing non-fast version, make sure that 336 * arg3 is not rewritten for certain system IPC 321 337 */ 322 338 __native sys_ipc_forward_fast(__native callid, __native phoneid, … … 437 453 &phone->callee->task->taskid, 438 454 sizeof(TASK->taskid)); 455 439 456 return IPC_GET_RETVAL(call.data); 440 457 } … … 449 466 call_t call; 450 467 phone_t *phone; 468 int newphid; 451 469 452 470 phone = get_phone(phoneid); 453 471 if (!phone) 454 472 return ENOENT; 473 474 newphid = phone_alloc(); 475 if (newphid < 0) 476 return ELIMIT; 455 477 456 478 ipc_call_init(&call); … … 458 480 IPC_SET_ARG1(call.data, arg1); 459 481 IPC_SET_ARG2(call.data, arg2); 482 IPC_SET_ARG3(call.data, (__native)&TASK->phones[newphid]); 460 483 461 484 ipc_call_sync(phone, &call); 462 if (!IPC_GET_RETVAL(call.data)) { 463 /* Everybody accepted, we should be connected by now */ 464 } 465 466 return 0; 485 486 if (IPC_GET_RETVAL(call.data)) { /* Connection failed */ 487 phone_dealloc(newphid); 488 return IPC_GET_RETVAL(call.data); 489 } 490 491 return newphid; 467 492 } 468 493 … … 486 511 restart: 487 512 call = ipc_wait_for_call(&TASK->answerbox, flags); 488 printf("Received call %P from sender: %P\n", call, call->sender);489 513 490 514 if (call->flags & IPC_CALL_ANSWERED) {
Note:
See TracChangeset
for help on using the changeset viewer.