Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 raddbce4  
    9393 * @param call     Structure returned by ipc_prepare_async().
    9494 */
    95 static inline void ipc_finish_async(errno_t rc, async_call_t *call)
     95static inline void ipc_finish_async(int rc, async_call_t *call)
    9696{
    9797        if (!call) {
     
    136136                return;
    137137       
    138         errno_t rc = (errno_t) __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phandle, imethod, arg1,
     138        int rc = __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         errno_t rc = (errno_t) __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,
     177        int rc = __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,
    178178            (sysarg_t) &call->msg.data, (sysarg_t) call);
    179179       
     
    197197 *
    198198 */
    199 errno_t ipc_answer_fast(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
     199sysarg_t ipc_answer_fast(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,
    200200    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
    201201{
    202         return (errno_t) __SYSCALL6(SYS_IPC_ANSWER_FAST, chandle, (sysarg_t) retval, arg1, arg2,
     202        return __SYSCALL6(SYS_IPC_ANSWER_FAST, chandle, retval, arg1, arg2,
    203203            arg3, arg4);
    204204}
     
    218218 *
    219219 */
    220 errno_t ipc_answer_slow(cap_handle_t chandle, errno_t retval, sysarg_t arg1,
     220sysarg_t ipc_answer_slow(cap_handle_t chandle, sysarg_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 (errno_t) __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data);
     232        return __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  * @param[out] out_handle  Call handle.
    257  *
    258  * @return  Error code.
    259  */
    260 errno_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);
     256 *
     257 * @return  Call handle.
     258 * @return  Negative error code.
     259 */
     260cap_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);
    263264       
    264265        /* Handle received answers */
    265         if ((rc == EOK) && (call->cap_handle == CAP_NIL) &&
    266             (call->flags & IPC_CALL_ANSWERED)) {
     266        if ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED))
    267267                handle_answer(call);
    268         }
    269        
    270         return rc;
     268       
     269        return chandle;
    271270}
    272271
     
    286285 * @param usec  Timeout in microseconds
    287286 *
    288  * @return  Error code.
    289  *
    290  */
    291 errno_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec)
    292 {
    293         errno_t rc;
     287 * @return  Call handle.
     288 * @return  Negative error code.
     289 *
     290 */
     291cap_handle_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec)
     292{
     293        cap_handle_t chandle;
    294294       
    295295        do {
    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;
     296                chandle = ipc_wait_cycle(call, usec, SYNCH_FLAGS_NONE);
     297        } while ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
     298       
     299        return chandle;
    300300}
    301301
     
    306306 * @param call  Incoming call storage.
    307307 *
    308  * @return  Error code.
    309  *
    310  */
    311 errno_t ipc_trywait_for_call(ipc_call_t *call)
    312 {
    313         errno_t rc;
     308 * @return  Call handle.
     309 * @return  Negative error code.
     310 *
     311 */
     312cap_handle_t ipc_trywait_for_call(ipc_call_t *call)
     313{
     314        cap_handle_t chandle;
    314315       
    315316        do {
    316                 rc = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
     317                chandle = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
    317318                    SYNCH_FLAGS_NON_BLOCKING);
    318         } while ((rc == EOK) && (call->cap_handle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
    319        
    320         return rc;
     319        } while ((chandle == CAP_NIL) && (call->flags & IPC_CALL_ANSWERED));
     320       
     321        return chandle;
    321322}
    322323
     
    325326 * @param phandle  Handle of the phone to be hung up.
    326327 *
    327  * @return  Zero on success or an error code.
    328  *
    329  */
    330 errno_t ipc_hangup(cap_handle_t phandle)
    331 {
    332         return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, phandle);
     328 * @return  Zero on success or a negative error code.
     329 *
     330 */
     331int ipc_hangup(cap_handle_t phandle)
     332{
     333        return __SYSCALL1(SYS_IPC_HANGUP, phandle);
    333334}
    334335
     
    350351 *
    351352 */
    352 errno_t ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,
     353int ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,
    353354    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
    354355{
    355         return (errno_t) __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,
     356        return __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,
    356357            arg2, mode);
    357358}
    358359
    359 errno_t ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,
     360int ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,
    360361    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    361362    sysarg_t arg4, sysarg_t arg5, unsigned int mode)
     
    370371        IPC_SET_ARG5(data, arg5);
    371372       
    372         return (errno_t) __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,
     373        return __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,
    373374            (sysarg_t) &data, mode);
    374375}
     
    377378 *
    378379 */
    379 errno_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);
     380int 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
    382390}
    383391
Note: See TracChangeset for help on using the changeset viewer.