Changeset c70ce74 in mainline


Ignore:
Timestamp:
2009-11-19T21:15:35Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
33adc6ce
Parents:
4ca28512
Message:

Allocate the answerbox for synchronous calls dynamically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ipc.c

    r4ca28512 rc70ce74  
    6262
    6363static slab_cache_t *ipc_call_slab;
     64static slab_cache_t *ipc_answerbox_slab;
    6465
    6566/** Initialize a call structure.
     
    167168int ipc_call_sync(phone_t *phone, call_t *request)
    168169{
    169         answerbox_t sync_box;
    170 
    171         ipc_answerbox_init(&sync_box, TASK);
     170        answerbox_t *sync_box;
     171
     172        sync_box = slab_alloc(ipc_answerbox_slab, 0);
     173        ipc_answerbox_init(sync_box, TASK);
    172174
    173175        /* We will receive data in a special box. */
    174         request->callerbox = &sync_box;
     176        request->callerbox = sync_box;
    175177
    176178        ipc_call(phone, request);
    177         if (!ipc_wait_for_call(&sync_box, SYNCH_NO_TIMEOUT,
    178             SYNCH_FLAGS_INTERRUPTIBLE))
     179        if (!ipc_wait_for_call(sync_box, SYNCH_NO_TIMEOUT,
     180            SYNCH_FLAGS_INTERRUPTIBLE)) {
     181                /* The asnwerbox will be freed by someone else. */
    179182                return EINTR;
     183        }
     184        slab_free(ipc_answerbox_slab, sync_box);
    180185        return EOK;
    181186}
     
    580585        ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL,
    581586            NULL, 0);
     587        ipc_answerbox_slab = slab_cache_create("ipc_answerbox",
     588            sizeof(answerbox_t), 0, NULL, NULL, 0);
    582589}
    583590
Note: See TracChangeset for help on using the changeset viewer.