Subversion Repositories HelenOS

Rev

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

Rev 2131 Rev 2307
Line 372... Line 372...
372
void ipc_cleanup(void)
372
void ipc_cleanup(void)
373
{
373
{
374
    int i;
374
    int i;
375
    call_t *call;
375
    call_t *call;
376
    phone_t *phone;
376
    phone_t *phone;
-
 
377
    DEADLOCK_PROBE_INIT(p_phonelck);
377
 
378
 
378
    /* Disconnect all our phones ('ipc_phone_hangup') */
379
    /* Disconnect all our phones ('ipc_phone_hangup') */
379
    for (i=0;i < IPC_MAX_PHONES; i++)
380
    for (i=0;i < IPC_MAX_PHONES; i++)
380
        ipc_phone_hangup(&TASK->phones[i]);
381
        ipc_phone_hangup(&TASK->phones[i]);
381
 
382
 
Line 385... Line 386...
385
    /* Disconnect all phones connected to our answerbox */
386
    /* Disconnect all phones connected to our answerbox */
386
restart_phones:
387
restart_phones:
387
    spinlock_lock(&TASK->answerbox.lock);
388
    spinlock_lock(&TASK->answerbox.lock);
388
    while (!list_empty(&TASK->answerbox.connected_phones)) {
389
    while (!list_empty(&TASK->answerbox.connected_phones)) {
389
        phone = list_get_instance(TASK->answerbox.connected_phones.next,
390
        phone = list_get_instance(TASK->answerbox.connected_phones.next,
390
                      phone_t, link);
391
            phone_t, link);
391
        if (! spinlock_trylock(&phone->lock)) {
392
        if (! spinlock_trylock(&phone->lock)) {
392
            spinlock_unlock(&TASK->answerbox.lock);
393
            spinlock_unlock(&TASK->answerbox.lock);
-
 
394
            DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD);
393
            goto restart_phones;
395
            goto restart_phones;
394
        }
396
        }
395
       
397
       
396
        /* Disconnect phone */
398
        /* Disconnect phone */
397
        ASSERT(phone->state == IPC_PHONE_CONNECTED);
399
        ASSERT(phone->state == IPC_PHONE_CONNECTED);
Line 498... Line 500...
498
    /* Print answerbox - calls */
500
    /* Print answerbox - calls */
499
    spinlock_lock(&task->answerbox.lock);
501
    spinlock_lock(&task->answerbox.lock);
500
    printf("ABOX - CALLS:\n");
502
    printf("ABOX - CALLS:\n");
501
    for (tmp=task->answerbox.calls.next; tmp != &task->answerbox.calls;tmp = tmp->next) {
503
    for (tmp=task->answerbox.calls.next; tmp != &task->answerbox.calls;tmp = tmp->next) {
502
        call = list_get_instance(tmp, call_t, link);
504
        call = list_get_instance(tmp, call_t, link);
503
        printf("Callid: %p Srctask:%lld M:%d A1:%d A2:%d A3:%d Flags:%x\n",call,
505
        printf("Callid: %p Srctask:%llu M:%d A1:%d A2:%d A3:%d Flags:%x\n",call,
504
               call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
506
               call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
505
               IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags);
507
               IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags);
506
    }
508
    }
507
    /* Print answerbox - calls */
509
    /* Print answerbox - calls */
508
    printf("ABOX - DISPATCHED CALLS:\n");
510
    printf("ABOX - DISPATCHED CALLS:\n");
509
    for (tmp=task->answerbox.dispatched_calls.next;
511
    for (tmp=task->answerbox.dispatched_calls.next;
510
         tmp != &task->answerbox.dispatched_calls;
512
         tmp != &task->answerbox.dispatched_calls;
511
         tmp = tmp->next) {
513
         tmp = tmp->next) {
512
        call = list_get_instance(tmp, call_t, link);
514
        call = list_get_instance(tmp, call_t, link);
513
        printf("Callid: %p Srctask:%lld M:%d A1:%d A2:%d A3:%d Flags:%x\n",call,
515
        printf("Callid: %p Srctask:%llu M:%d A1:%d A2:%d A3:%d Flags:%x\n",call,
514
               call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
516
               call->sender->taskid, IPC_GET_METHOD(call->data), IPC_GET_ARG1(call->data),
515
               IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags);
517
               IPC_GET_ARG2(call->data), IPC_GET_ARG3(call->data), call->flags);
516
    }
518
    }
517
    /* Print answerbox - calls */
519
    /* Print answerbox - calls */
518
    printf("ABOX - ANSWERS:\n");
520
    printf("ABOX - ANSWERS:\n");