Changeset 214c5a0 in mainline
- Timestamp:
- 2006-06-05T10:36:43Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e090e1bc
- Parents:
- c778c1a
- Location:
- generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/ipc/ipc.h
rc778c1a r214c5a0 225 225 extern void task_print_list(void); 226 226 extern int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox); 227 extern void ipc_cleanup(task_t *task);227 void ipc_cleanup(void); 228 228 extern int ipc_phone_hangup(phone_t *phone, int aggressive); 229 229 extern void ipc_backsend_err(phone_t *phone, call_t *call, __native err); -
generic/src/console/cmd.c
rc778c1a r214c5a0 309 309 static cmd_info_t ipc_task_info = { 310 310 .name = "ipc_task", 311 .description = " Show memory zone structure.",311 .description = "ipc_task <taskid> Show IPC information of given task", 312 312 .func = cmd_ipc_task, 313 313 .argc = 1, -
generic/src/ipc/ipc.c
rc778c1a r214c5a0 370 370 } 371 371 372 /** Cleans up all IPC communication of the given task 373 * 374 * 375 */ 376 void ipc_cleanup(task_t *task) 372 /** Cleans up all IPC communication of the current task 373 * 374 * Note: ipc_hangup sets returning answerbox to TASK->answerbox, you 375 * have to change it as well if you want to cleanup other current then current. 376 */ 377 void ipc_cleanup(void) 377 378 { 378 379 int i; 379 380 call_t *call; 380 381 phone_t *phone; 381 382 382 383 /* Disconnect all our phones ('ipc_phone_hangup') */ 383 384 for (i=0;i < IPC_MAX_PHONES; i++) 384 ipc_phone_hangup(& task->phones[i], 1);385 ipc_phone_hangup(&TASK->phones[i], 1); 385 386 386 387 /* Disconnect all connected irqs */ 387 ipc_irq_cleanup(& task->answerbox);388 ipc_irq_cleanup(&TASK->answerbox); 388 389 389 390 /* Disconnect all phones connected to our answerbox */ 390 391 restart_phones: 391 spinlock_lock(& task->answerbox.lock);392 while (!list_empty(& task->answerbox.connected_phones)) {393 phone = list_get_instance( task->answerbox.connected_phones.next,392 spinlock_lock(&TASK->answerbox.lock); 393 while (!list_empty(&TASK->answerbox.connected_phones)) { 394 phone = list_get_instance(TASK->answerbox.connected_phones.next, 394 395 phone_t, link); 395 396 if (! spinlock_trylock(&phone->lock)) { 396 spinlock_unlock(& task->answerbox.lock);397 spinlock_unlock(&TASK->answerbox.lock); 397 398 goto restart_phones; 398 399 } … … 407 408 408 409 /* Answer all messages in 'calls' and 'dispatched_calls' queues */ 409 spinlock_lock(&task->answerbox.lock); 410 ipc_cleanup_call_list(&task->answerbox.dispatched_calls); 411 ipc_cleanup_call_list(&task->answerbox.calls); 412 spinlock_unlock(&task->answerbox.lock); 410 ipc_cleanup_call_list(&TASK->answerbox.dispatched_calls); 411 ipc_cleanup_call_list(&TASK->answerbox.calls); 412 spinlock_unlock(&TASK->answerbox.lock); 413 413 414 414 /* Wait for all async answers to arrive */ … … 418 418 * it, when we are in cleanup */ 419 419 for (i=0;i < IPC_MAX_PHONES; i++) { 420 if (task->phones[i].state == IPC_PHONE_HUNGUP && \ 421 atomic_get(&task->phones[i].active_calls) == 0) 422 task->phones[i].state = IPC_PHONE_FREE; 423 if (task->phones[i].state != IPC_PHONE_FREE) 420 if (TASK->phones[i].state == IPC_PHONE_HUNGUP && \ 421 atomic_get(&TASK->phones[i].active_calls) == 0) 422 TASK->phones[i].state = IPC_PHONE_FREE; 423 424 if (TASK->phones[i].state == IPC_PHONE_CONNECTED) 425 ipc_phone_hangup(&TASK->phones[i], 1); 426 427 if (TASK->phones[i].state != IPC_PHONE_FREE) 424 428 break; 425 429 } … … 428 432 break; 429 433 430 call = ipc_wait_for_call(& task->answerbox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);434 call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE); 431 435 ASSERT((call->flags & IPC_CALL_ANSWERED) || (call->flags & IPC_CALL_NOTIF)); 432 436 ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC)); 433 437 434 atomic_dec(& task->active_calls);438 atomic_dec(&TASK->active_calls); 435 439 ipc_call_free(call); 436 440 }
Note:
See TracChangeset
for help on using the changeset viewer.