Ignore:
File:
1 edited

Legend:

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

    re9fe33b r466e95f7  
    255255}
    256256
    257 /** Simulate sending back a message.
    258  *
    259  * Most errors are better handled by forming a normal backward
    260  * message and sending it as a normal answer.
    261  *
    262  * @param phone Phone structure the call should appear to come from.
    263  * @param call  Call structure to be answered.
    264  * @param err   Return value to be used for the answer.
    265  *
    266  */
    267 void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
     257static void _ipc_call_actions_internal(phone_t *phone, call_t *call)
    268258{
    269259        task_t *caller = phone->caller;
     
    279269
    280270        call->data.phone = phone;
    281 
     271        call->data.task_id = caller->taskid;
     272}
     273
     274/** Simulate sending back a message.
     275 *
     276 * Most errors are better handled by forming a normal backward
     277 * message and sending it as a normal answer.
     278 *
     279 * @param phone Phone structure the call should appear to come from.
     280 * @param call  Call structure to be answered.
     281 * @param err   Return value to be used for the answer.
     282 *
     283 */
     284void ipc_backsend_err(phone_t *phone, call_t *call, sysarg_t err)
     285{
     286        _ipc_call_actions_internal(phone, call);
    282287        IPC_SET_RETVAL(call->data, err);
    283288        _ipc_answer_free_call(call, false);
     
    300305        irq_spinlock_unlock(&caller->lock, true);
    301306       
    302         if (!(call->flags & IPC_CALL_FORWARDED)) {
    303                 atomic_inc(&phone->active_calls);
    304                 call->caller_phone = phone;
    305                 call->sender = caller;
    306 
    307                 call->active = true;
    308                 spinlock_lock(&caller->active_calls_lock);
    309                 list_append(&call->ta_link, &caller->active_calls);
    310                 spinlock_unlock(&caller->active_calls_lock);
    311 
    312                 call->data.phone = phone;
    313                 call->data.task_id = caller->taskid;
    314         }
     307        if (!(call->flags & IPC_CALL_FORWARDED))
     308                _ipc_call_actions_internal(phone, call);
    315309       
    316310        irq_spinlock_lock(&box->lock, true);
     
    518512
    519513                irq_spinlock_unlock(&box->lock, true);
     514
     515                if (lst == &box->calls)
     516                        SYSIPC_OP(request_process, call, box);
    520517
    521518                ipc_data_t old = call->data;
     
    643640        atomic_dec(&call->caller_phone->active_calls);
    644641
    645         sysipc_ops_t *ops = sysipc_ops_get(call->request_method);
    646         if (ops->request_forget)
    647                 ops->request_forget(call);
     642        SYSIPC_OP(request_forget, call);
    648643
    649644        ipc_call_release(call);
     
    713708            SYNCH_FLAGS_NONE);
    714709        ASSERT(call->flags & (IPC_CALL_ANSWERED | IPC_CALL_NOTIF));
     710
     711        SYSIPC_OP(answer_process, call);
     712
    715713        ipc_call_free(call);
    716714        goto restart;
     
    754752       
    755753        /* Answer all messages in 'calls' and 'dispatched_calls' queues */
     754        ipc_cleanup_call_list(&TASK->answerbox, &TASK->answerbox.calls);
    756755        ipc_cleanup_call_list(&TASK->answerbox,
    757756            &TASK->answerbox.dispatched_calls);
    758         ipc_cleanup_call_list(&TASK->answerbox, &TASK->answerbox.calls);
    759757
    760758        ipc_forget_all_active_calls();
Note: See TracChangeset for help on using the changeset viewer.