Subversion Repositories HelenOS

Rev

Rev 4420 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4420 Rev 4537
Line 41... Line 41...
41
 
41
 
42
#include <ipc/ipc.h>
42
#include <ipc/ipc.h>
43
#include <libc.h>
43
#include <libc.h>
44
#include <malloc.h>
44
#include <malloc.h>
45
#include <errno.h>
45
#include <errno.h>
46
#include <libadt/list.h>
46
#include <adt/list.h>
47
#include <stdio.h>
47
#include <stdio.h>
48
#include <unistd.h>
48
#include <unistd.h>
49
#include <futex.h>
49
#include <futex.h>
50
#include <kernel/synch/synch.h>
50
#include <kernel/synch/synch.h>
51
#include <async.h>
51
#include <async.h>
Line 230... Line 230...
230
    if (!call) { /* Nothing to do regardless if failed or not */
230
    if (!call) { /* Nothing to do regardless if failed or not */
231
        futex_up(&ipc_futex);
231
        futex_up(&ipc_futex);
232
        return;
232
        return;
233
    }
233
    }
234
 
234
 
235
    if (callid == IPC_CALLRET_FATAL) {
235
    if (callid == (ipc_callid_t) IPC_CALLRET_FATAL) {
236
        futex_up(&ipc_futex);
236
        futex_up(&ipc_futex);
237
        /* Call asynchronous handler with error code */
237
        /* Call asynchronous handler with error code */
238
        if (call->callback)
238
        if (call->callback)
239
            call->callback(call->private, ENOENT, NULL);
239
            call->callback(call->private, ENOENT, NULL);
240
        free(call);
240
        free(call);
241
        return;
241
        return;
242
    }
242
    }
243
 
243
 
244
    if (callid == IPC_CALLRET_TEMPORARY) {
244
    if (callid == (ipc_callid_t) IPC_CALLRET_TEMPORARY) {
245
        futex_up(&ipc_futex);
245
        futex_up(&ipc_futex);
246
 
246
 
247
        call->u.msg.phoneid = phoneid;
247
        call->u.msg.phoneid = phoneid;
248
       
248
       
249
        futex_down(&async_futex);
249
        futex_down(&async_futex);
Line 307... Line 307...
307
     */
307
     */
308
    futex_down(&ipc_futex);
308
    futex_down(&ipc_futex);
309
    callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
309
    callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
310
        arg2, arg3, arg4);
310
        arg2, arg3, arg4);
311
 
311
 
312
    if (callid == IPC_CALLRET_TEMPORARY) {
312
    if (callid == (ipc_callid_t) IPC_CALLRET_TEMPORARY) {
313
        if (!call) {
313
        if (!call) {
314
            call = ipc_prepare_async(private, callback);
314
            call = ipc_prepare_async(private, callback);
315
            if (!call)
315
            if (!call)
316
                return;
316
                return;
317
        }
317
        }
Line 440... Line 440...
440
    futex_down(&async_futex);
440
    futex_down(&async_futex);
441
    while (!list_empty(&queued_calls)) {
441
    while (!list_empty(&queued_calls)) {
442
        call = list_get_instance(queued_calls.next, async_call_t, list);
442
        call = list_get_instance(queued_calls.next, async_call_t, list);
443
        callid = _ipc_call_async(call->u.msg.phoneid,
443
        callid = _ipc_call_async(call->u.msg.phoneid,
444
            &call->u.msg.data);
444
            &call->u.msg.data);
445
        if (callid == IPC_CALLRET_TEMPORARY) {
445
        if (callid == (ipc_callid_t) IPC_CALLRET_TEMPORARY) {
446
            break;
446
            break;
447
        }
447
        }
448
        list_remove(&call->list);
448
        list_remove(&call->list);
449
 
449
 
450
        futex_up(&async_futex);
450
        futex_up(&async_futex);
451
        if (call->fid)
451
        if (call->fid)
452
            fibril_add_ready(call->fid);
452
            fibril_add_ready(call->fid);
453
       
453
       
454
        if (callid == IPC_CALLRET_FATAL) {
454
        if (callid == (ipc_callid_t) IPC_CALLRET_FATAL) {
455
            if (call->callback)
455
            if (call->callback)
456
                call->callback(call->private, ENOENT, NULL);
456
                call->callback(call->private, ENOENT, NULL);
457
            free(call);
457
            free(call);
458
        } else {
458
        } else {
459
            call->u.callid = callid;
459
            call->u.callid = callid;