Changeset 04a73cdf in mainline for libc/generic/ipc.c


Ignore:
Timestamp:
2006-05-17T14:05:01Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04552a80
Parents:
afa6e74
Message:

Sync with kernel.
Add ipc_wait_for_call_timeout() and ipc_trywait_for_call().
Modify ipc_wait_for_call() to be unconditional.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/ipc.c

    rafa6e74 r04a73cdf  
    3535#include <unistd.h>
    3636#include <futex.h>
     37#include <kernel/synch/synch.h>
    3738
    3839/** Structure used for keeping track of sent async msgs
     
    252253
    253254
    254 /** Wait for IPC call and return
     255/** Unconditionally wait for an IPC call.
    255256 *
    256257 * - dispatch ASYNC reoutines in the background
    257  * @param data Space where the message is stored
    258  * @return Callid or 0 if nothing available and started with
    259  *         IPC_WAIT_NONBLOCKING
    260  */
    261 ipc_callid_t ipc_wait_for_call(ipc_call_t *call, int flags)
     258 * @param call Space where the message is stored
     259 * @return Callid of the answer.
     260 */
     261ipc_callid_t ipc_wait_for_call(ipc_call_t *call)
    262262{
    263263        ipc_callid_t callid;
     
    266266                try_dispatch_queued_calls();
    267267
    268                 callid = __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)call, flags);
     268                callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, SYNCH_NO_TIMEOUT, SYNCH_BLOCKING);
     269                /* Handle received answers */
     270                if (callid & IPC_CALLID_ANSWERED)
     271                        handle_answer(callid, call);
     272        } while (callid & IPC_CALLID_ANSWERED);
     273
     274        return callid;
     275}
     276
     277/** Wait some time for an IPC call.
     278 *
     279 * - dispatch ASYNC reoutines in the background
     280 * @param call Space where the message is stored
     281 * @param usec Timeout in microseconds.
     282 * @return Callid of the answer.
     283 */
     284ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *call, uint32_t usec)
     285{
     286        ipc_callid_t callid;
     287
     288        do {
     289                try_dispatch_queued_calls();
     290
     291                callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, SYNCH_BLOCKING);
     292                /* Handle received answers */
     293                if (callid & IPC_CALLID_ANSWERED)
     294                        handle_answer(callid, call);
     295        } while (callid & IPC_CALLID_ANSWERED);
     296
     297        return callid;
     298}
     299
     300/** Check if there is an IPC call waiting to be picked up.
     301 *
     302 * - dispatch ASYNC reoutines in the background
     303 * @param call Space where the message is stored
     304 * @return Callid of the answer.
     305 */
     306ipc_callid_t ipc_trywait_for_call(ipc_call_t *call)
     307{
     308        ipc_callid_t callid;
     309
     310        do {
     311                try_dispatch_queued_calls();
     312
     313                callid = __SYSCALL3(SYS_IPC_WAIT, (sysarg_t)call, SYNCH_NO_TIMEOUT, SYNCH_NON_BLOCKING);
    269314                /* Handle received answers */
    270315                if (callid & IPC_CALLID_ANSWERED)
Note: See TracChangeset for help on using the changeset viewer.