Changeset 6deb2cd in mainline for uspace/lib/c/generic/ipc.c


Ignore:
Timestamp:
2017-12-08T21:17:27Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
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)
Message:

Return capability handle in SYS_IPC_WAIT via call data structure, separately from error codes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/ipc.c

    r125c09c r6deb2cd  
    254254 * @param usec   Timeout in microseconds
    255255 * @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 */
     260int 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);
    264263       
    265264        /* 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)) {
    267267                handle_answer(call);
    268        
    269         return chandle;
     268        }
     269       
     270        return rc;
    270271}
    271272
     
    285286 * @param usec  Timeout in microseconds
    286287 *
    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 */
     291int ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec)
     292{
     293        int rc;
    294294       
    295295        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;
    300300}
    301301
     
    306306 * @param call  Incoming call storage.
    307307 *
    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 */
     311int ipc_trywait_for_call(ipc_call_t *call)
     312{
     313        int rc;
    315314       
    316315        do {
    317                 chandle = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
     316                rc = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
    318317                    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;
    322321}
    323322
Note: See TracChangeset for help on using the changeset viewer.