Changes in uspace/lib/c/generic/ipc.c [addbce4:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/ipc.c
raddbce4 rb7fd2a0 93 93 * @param call Structure returned by ipc_prepare_async(). 94 94 */ 95 static inline void ipc_finish_async( int rc, async_call_t *call)95 static inline void ipc_finish_async(errno_t rc, async_call_t *call) 96 96 { 97 97 if (!call) { … … 136 136 return; 137 137 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, 139 139 arg2, arg3, (sysarg_t) call); 140 140 … … 175 175 IPC_SET_ARG5(call->msg.data, arg5); 176 176 177 int rc =__SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle,177 errno_t rc = (errno_t) __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW, phandle, 178 178 (sysarg_t) &call->msg.data, (sysarg_t) call); 179 179 … … 197 197 * 198 198 */ 199 sysarg_t ipc_answer_fast(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,199 errno_t ipc_answer_fast(cap_handle_t chandle, errno_t retval, sysarg_t arg1, 200 200 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4) 201 201 { 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, 203 203 arg3, arg4); 204 204 } … … 218 218 * 219 219 */ 220 sysarg_t ipc_answer_slow(cap_handle_t chandle, sysarg_t retval, sysarg_t arg1,220 errno_t ipc_answer_slow(cap_handle_t chandle, errno_t retval, sysarg_t arg1, 221 221 sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5) 222 222 { … … 230 230 IPC_SET_ARG5(data, arg5); 231 231 232 return __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data);232 return (errno_t) __SYSCALL2(SYS_IPC_ANSWER_SLOW, chandle, (sysarg_t) &data); 233 233 } 234 234 … … 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 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); 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 errno_t ipc_wait_for_call_timeout(ipc_call_t *call, sysarg_t usec) 292 { 293 errno_t 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 errno_t ipc_trywait_for_call(ipc_call_t *call) 312 { 313 errno_t 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 … … 326 325 * @param phandle Handle of the phone to be hung up. 327 326 * 328 * @return Zero on success or a negativeerror 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 */ 330 errno_t ipc_hangup(cap_handle_t phandle) 331 { 332 return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, phandle); 334 333 } 335 334 … … 351 350 * 352 351 */ 353 int ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle,352 errno_t ipc_forward_fast(cap_handle_t chandle, cap_handle_t phandle, 354 353 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode) 355 354 { 356 return __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1,355 return (errno_t) __SYSCALL6(SYS_IPC_FORWARD_FAST, chandle, phandle, imethod, arg1, 357 356 arg2, mode); 358 357 } 359 358 360 int ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle,359 errno_t ipc_forward_slow(cap_handle_t chandle, cap_handle_t phandle, 361 360 sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, 362 361 sysarg_t arg4, sysarg_t arg5, unsigned int mode) … … 371 370 IPC_SET_ARG5(data, arg5); 372 371 373 return __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle,372 return (errno_t) __SYSCALL4(SYS_IPC_FORWARD_SLOW, chandle, phandle, 374 373 (sysarg_t) &data, mode); 375 374 } … … 378 377 * 379 378 */ 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 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); 390 382 } 391 383
Note:
See TracChangeset
for help on using the changeset viewer.