Ignore:
File:
1 edited

Legend:

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

    raddbce4 rb7fd2a0  
    9393 * @param call     Structure returned by ipc_prepare_async().
    9494 */
    95 static inline void ipc_finish_async(int rc, async_call_t *call)
     95static inline void ipc_finish_async(errno_t rc, async_call_t *call)
    9696{
    9797        if (!call) {
     
    136136                return;
    137137       
    138         int rc = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phandle, imethod, arg1,
     138        errno_t rc = (errno_t) __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phandle, imethod, arg1,
    139139            arg2, arg3, (sysarg_t) call);
    140140       
     
    175175        IPC_SET_ARG5(call->msg.data, arg5);
    176176       
    177         int rc = __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,
     177        errno_t rc = (errno_t) __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,
    178178            (sysarg_t) &call->msg.data, (sysarg_t) call);
    179179       
     
    197197 *
    198198 */
    199 sysarg_t ipc_answer_fast(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     199errno_t ipc_answer_fast(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
    200200    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    201201{
    202         return __SYSCALL6(SYS_IPC_ANSWER_FAST, chandle, retval, arg1, arg2,
     202        return (errno_t) __SYSCALL6(SYS_IPC_ANSWER_FAST, chandle, (sysarg_t) retval, arg1, arg2,
    203203            arg3, arg4);
    204204}
     
    218218 *
    219219 */
    220 sysarg_t ipc_answer_slow(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
     220errno_t ipc_answer_slow(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
    221221    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
    222222{
     
    230230        IPC_SET_ARG5(data, arg5);
    231231       
    232         return __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data);
     232        return (errno_t) __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data);
    233233}
    234234
     
    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 */
     260errno_t ipc_wait_cycle(ipc_call_t *call, sysarg_t usec, unsigned int flags)
     261{
     262        errno_t rc = (errno_t) __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 */
     291errno_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec)
     292{
     293        errno_t 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 */
     311errno_t ipc_trywait_for_call(ipc_call_t *call)
     312{
     313        errno_t 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
     
    326325 * @param phandle  Handle of the phone to be hung up.
    327326 *
    328  * @return  Zero on success or a negative error code.
    329  *
    330  */
    331 int ipc_hangup(cap_handle_t phandle)
    332 {
    333         return __SYSCALL1(SYS_IPC_HANGUP, phandle);
     327 * @return  Zero on success or an error code.
     328 *
     329 */
     330errno_t ipc_hangup(cap_handle_t phandle)
     331{
     332        return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, phandle);
    334333}
    335334
     
    351350 *
    352351 */
    353 int ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,
     352errno_t ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,
    354353    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
    355354{
    356         return __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,
     355        return (errno_t) __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,
    357356            arg2, mode);
    358357}
    359358
    360 int ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,
     359errno_t ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,
    361360    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    362361    sysarg_t arg4, sysarg_t arg5, unsigned int mode)
     
    371370        IPC_SET_ARG5(data, arg5);
    372371       
    373         return __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,
     372        return (errno_t) __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,
    374373            (sysarg_t) &data, mode);
    375374}
     
    378377 *
    379378 */
    380 int ipc_connect_kbox(task_id_t id)
    381 {
    382 #ifdef __32_BITS__
    383         sysarg64_t arg = (sysarg64_t) id;
    384         return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg);
    385 #endif
    386        
    387 #ifdef __64_BITS__
    388         return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) id);
    389 #endif
     379errno_t ipc_connect_kbox(task_id_t id, cap_handle_t *phone)
     380{
     381        return (errno_t) __SYSCALL2(SYS_IPC_CONNECT_KBOX, (sysarg_t) &id, (sysarg_t) phone);
    390382}
    391383
Note: See TracChangeset for help on using the changeset viewer.