Changeset c9fff17 in mainline
- Timestamp:
- 2010-04-13T18:34:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d3b3395
- Parents:
- 75ebb5b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/sysipc.c
r75ebb5b6 rc9fff17 58 58 #define DATA_XFER_LIMIT (64 * 1024) 59 59 60 #define GET_CHECK_PHONE(phone, phoneid, err) \ 61 { \ 62 if ((unative_t) (phoneid) >= IPC_MAX_PHONES) { \ 63 err \ 64 } \ 65 phone = &TASK->phones[(phoneid)]; \ 60 /** Get phone from the current task by ID. 61 * 62 * @param phoneid Phone ID. 63 * @param phone Place to store pointer to phone. 64 * @return EOK on success, EINVAL if ID is invalid. 65 */ 66 static int phone_get(unative_t phoneid, phone_t **phone) 67 { 68 if (phoneid >= IPC_MAX_PHONES) 69 return EINVAL; 70 71 *phone = &TASK->phones[phoneid]; 72 return EOK; 66 73 } 67 74 … … 374 381 case IPC_M_CONNECTION_CLONE: { 375 382 phone_t *cloned_phone; 376 GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data), 377 return ENOENT;); 383 384 if (phone_get(IPC_GET_ARG1(call->data), &cloned_phone) != EOK) 385 return ENOENT; 378 386 phones_lock(cloned_phone, phone); 387 379 388 if ((cloned_phone->state != IPC_PHONE_CONNECTED) || 380 389 phone->state != IPC_PHONE_CONNECTED) { … … 534 543 int res; 535 544 int rc; 536 537 GET_CHECK_PHONE(phone, phoneid, return ENOENT;); 545 546 if (phone_get(phoneid, &phone) != EOK) 547 return ENOENT; 538 548 539 549 call = ipc_call_alloc(0); … … 591 601 int rc; 592 602 593 GET_CHECK_PHONE(phone, phoneid, return ENOENT;); 603 if (phone_get(phoneid, &phone) != EOK) 604 return ENOENT; 594 605 595 606 call = ipc_call_alloc(0); … … 666 677 return IPC_CALLRET_TEMPORARY; 667 678 668 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;); 679 if (phone_get(phoneid, &phone) != EOK) 680 return IPC_CALLRET_FATAL; 669 681 670 682 call = ipc_call_alloc(0); … … 705 717 return IPC_CALLRET_TEMPORARY; 706 718 707 GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;); 719 if (phone_get(phoneid, &phone) != EOK) 720 return IPC_CALLRET_FATAL; 708 721 709 722 call = ipc_call_alloc(0); … … 755 768 call->flags |= IPC_CALL_FORWARDED; 756 769 757 GET_CHECK_PHONE(phone, phoneid,{770 if (phone_get(phoneid, &phone) != EOK) { 758 771 IPC_SET_RETVAL(call->data, EFORWARD); 759 772 ipc_answer(&TASK->answerbox, call); 760 773 return ENOENT; 761 } );774 } 762 775 763 776 if (!method_is_forwardable(IPC_GET_METHOD(call->data))) { … … 960 973 phone_t *phone; 961 974 962 GET_CHECK_PHONE(phone, phoneid, return ENOENT;); 975 if (phone_get(phoneid, &phone) != EOK) 976 return ENOENT; 963 977 964 978 if (ipc_phone_hangup(phone))
Note:
See TracChangeset
for help on using the changeset viewer.