Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1005 → Rev 1006

/uspace/trunk/libipc/include/ipc.h
31,9 → 31,14
 
#include <kernel/ipc/ipc.h>
#include <libc.h>
#include <types.h>
 
typedef sysarg_t ipcarg_t;
typedef ipcarg_t ipc_data_t[IPC_CALL_LEN];
typedef sysarg_t ipc_data_t[IPC_CALL_LEN];
typedef struct {
unsigned long long taskid;
ipc_data_t data;
}ipc_call_t;
typedef sysarg_t ipc_callid_t;
 
typedef void (* ipc_async_callback_t)(void *private,
49,7 → 54,7
 
extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
ipcarg_t *result);
extern int ipc_wait_for_call(ipc_data_t *data, int flags);
extern int ipc_wait_for_call(ipc_call_t *data, int flags);
extern void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
ipcarg_t arg2);
 
/uspace/trunk/libipc/generic/ipc.c
82,7 → 82,8
IPC_SET_ARG2(data, arg2);
IPC_SET_ARG3(data, arg3);
 
callres = __SYSCALL2(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data);
callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data,
(sysarg_t)&data);
if (callres)
return callres;
 
121,7 → 122,6
callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2);
if (callid == IPC_CALLRET_FATAL) {
/* Call asynchronous handler with error code */
IPC_SET_RETVAL(call->u.msg.data, ENOENT);
callback(private, ENOENT, NULL);
free(call);
return;
150,14 → 150,15
void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
ipcarg_t arg2)
{
__SYSCALL4(SYS_IPC_ANSWER, callid, retval, arg1, arg2);
__SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2);
}
 
 
/** Call syscall function sys_ipc_wait_for_call */
static inline ipc_callid_t _ipc_wait_for_call(ipc_data_t *data, int flags)
static inline ipc_callid_t _ipc_wait_for_call(ipc_call_t *call, int flags)
{
return __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)data, flags);
return __SYSCALL3(SYS_IPC_WAIT, (sysarg_t)&call->data,
(sysarg_t)&call->taskid, flags);
}
 
/** Try to dispatch queed calls from async queue */
220,7 → 221,7
* @return Callid or 0 if nothing available and started with
* IPC_WAIT_NONBLOCKING
*/
int ipc_wait_for_call(ipc_data_t *data, int flags)
int ipc_wait_for_call(ipc_call_t *call, int flags)
{
ipc_callid_t callid;
 
227,10 → 228,10
do {
try_dispatch_queued_calls();
 
callid = _ipc_wait_for_call(data, flags);
callid = _ipc_wait_for_call(call, flags);
/* Handle received answers */
if (callid & IPC_CALLID_ANSWERED)
handle_answer(callid, data);
handle_answer(callid, &call->data);
} while (callid & IPC_CALLID_ANSWERED);
 
return callid;