Changeset 6deb2cd in mainline
- Timestamp:
- 2017-12-08T21:17:27Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9233e9d
- Parents:
- 125c09c
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-07 16:46:52)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:17:27)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r125c09c r6deb2cd 110 110 /** User-defined label */ 111 111 sysarg_t label; 112 /** Capability handle */ 113 cap_handle_t cap_handle; 112 114 } ipc_data_t; 113 115 -
kernel/generic/src/ipc/sysipc.c
r125c09c r6deb2cd 744 744 * for explanation. 745 745 * 746 * @return Capability handle of the received request.747 * @return CAP_NIL for answers, notifications and when there is no call.748 746 * @return Negative error code on error. 749 747 */ … … 767 765 768 766 if (!call) { 769 STRUCT_TO_USPACE(calldata, &(ipc_data_t){}); 770 return CAP_NIL; 767 ipc_data_t data = {0}; 768 data.cap_handle = CAP_NIL; 769 STRUCT_TO_USPACE(calldata, &data); 770 return EOK; 771 771 } 772 772 … … 776 776 777 777 call->data.flags = IPC_CALL_NOTIF; 778 call->data.cap_handle = CAP_NIL; 778 779 779 780 STRUCT_TO_USPACE(calldata, &call->data); 780 781 kobject_put(call->kobject); 781 782 782 return CAP_NIL;783 return EOK; 783 784 } 784 785 … … 792 793 793 794 call->data.flags = IPC_CALL_ANSWERED; 795 call->data.cap_handle = CAP_NIL; 794 796 795 797 STRUCT_TO_USPACE(calldata, &call->data); 796 798 kobject_put(call->kobject); 797 799 798 return CAP_NIL;800 return EOK; 799 801 } 800 802 … … 809 811 } 810 812 813 call->data.cap_handle = handle; 814 811 815 /* 812 816 * Include phone hash of the caller in the request, copy the whole … … 819 823 kobject_add_ref(call->kobject); 820 824 cap_publish(TASK, handle, call->kobject); 821 return handle;825 return EOK; 822 826 823 827 error: -
uspace/lib/c/generic/async.c
r125c09c r6deb2cd 1483 1483 1484 1484 ipc_call_t call; 1485 cap_handle_t chandle= ipc_wait_cycle(&call, timeout, flags);1485 int rc = ipc_wait_cycle(&call, timeout, flags); 1486 1486 1487 1487 atomic_dec(&threads_in_ipc_wait); 1488 1488 1489 assert( chandle >= 0);1490 1491 if (c handle == CAP_NIL) {1489 assert(rc == EOK); 1490 1491 if (call.cap_handle == CAP_NIL) { 1492 1492 if (call.flags == 0) { 1493 1493 /* This neither a notification nor an answer. */ … … 1500 1500 continue; 1501 1501 1502 handle_call(c handle, &call);1502 handle_call(call.cap_handle, &call); 1503 1503 } 1504 1504 -
uspace/lib/c/generic/ipc.c
r125c09c r6deb2cd 254 254 * @param usec Timeout in microseconds 255 255 * @param flags Flags passed to SYS_IPC_WAIT (blocking, nonblocking). 256 * 257 * @return Call handle. 258 * @return Negative error code. 259 */ 260 cap_handle_t ipc_wait_cycle(ipc_call_t *call, sysarg_t usec, unsigned int flags) 261 { 262 cap_handle_t chandle = 263 __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, flags); 256 * @param[out] out_handle Call handle. 257 * 258 * @return Error code. 259 */ 260 int ipc_wait_cycle(ipc_call_t *call, sysarg_t usec, unsigned int flags) 261 { 262 int rc = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, flags); 264 263 265 264 /* Handle received answers */ 266 if ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED)) 265 if ((rc == EOK) && (call->cap_handle == CAP_NIL) && 266 (call->flags & IPC_CALL_ANSWERED)) { 267 267 handle_answer(call); 268 269 return chandle; 268 } 269 270 return rc; 270 271 } 271 272 … … 285 286 * @param usec Timeout in microseconds 286 287 * 287 * @return Call handle. 288 * @return Negative error code. 289 * 290 */ 291 cap_handle_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec) 292 { 293 cap_handle_t chandle; 288 * @return Error code. 289 * 290 */ 291 int ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec) 292 { 293 int rc; 294 294 295 295 do { 296 chandle= ipc_wait_cycle(call, usec, SYNCH_FLAGS_NONE);297 } while (( chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));298 299 return chandle;296 rc = ipc_wait_cycle(call, usec, SYNCH_FLAGS_NONE); 297 } while ((rc == EOK) && (call->cap_handle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED)); 298 299 return rc; 300 300 } 301 301 … … 306 306 * @param call Incoming call storage. 307 307 * 308 * @return Call handle. 309 * @return Negative error code. 310 * 311 */ 312 cap_handle_t ipc_trywait_for_call(ipc_call_t *call) 313 { 314 cap_handle_t chandle; 308 * @return Error code. 309 * 310 */ 311 int ipc_trywait_for_call(ipc_call_t *call) 312 { 313 int rc; 315 314 316 315 do { 317 chandle= ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,316 rc = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT, 318 317 SYNCH_FLAGS_NON_BLOCKING); 319 } while (( chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));320 321 return chandle;318 } while ((rc == EOK) && (call->cap_handle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED)); 319 320 return rc; 322 321 } 323 322 -
uspace/lib/c/include/ipc/common.h
r125c09c r6deb2cd 52 52 unsigned flags; 53 53 struct async_call *label; 54 cap_handle_t cap_handle; 54 55 } ipc_call_t; 55 56 -
uspace/lib/c/include/ipc/ipc.h
r125c09c r6deb2cd 48 48 typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *); 49 49 50 extern cap_handle_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);50 extern int ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int); 51 51 extern void ipc_poke(void); 52 52 … … 54 54 ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT); 55 55 56 extern cap_handle_t ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t);57 extern cap_handle_t ipc_trywait_for_call(ipc_call_t *);56 extern int ipc_wait_for_call_timeout(ipc_call_t *, sysarg_t); 57 extern int ipc_trywait_for_call(ipc_call_t *); 58 58 59 59 /*
Note:
See TracChangeset
for help on using the changeset viewer.