Changeset 5bcf1f9 in mainline
- Timestamp:
- 2011-01-29T22:52:25Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd483ce
- Parents:
- fc5f7a8
- Location:
- kernel/generic
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/event_types.h
rfc5f7a8 r5bcf1f9 41 41 /** Returning from kernel console to userspace */ 42 42 EVENT_KCONSOLE, 43 /** A t hread has faulted and will be terminated */43 /** A task/thread has faulted and will be terminated */ 44 44 EVENT_FAULT, 45 45 EVENT_END -
kernel/generic/include/proc/task.h
rfc5f7a8 r5bcf1f9 131 131 extern task_t *task_find_by_id(task_id_t); 132 132 extern int task_kill(task_id_t); 133 extern void task_kill_self(bool) __attribute__((noreturn)); 133 134 extern void task_get_accounting(task_t *, uint64_t *, uint64_t *); 134 135 extern void task_print_list(bool); … … 155 156 extern sysarg_t sys_task_set_name(const char *, size_t); 156 157 extern sysarg_t sys_task_kill(task_id_t *); 158 extern sysarg_t sys_task_exit(sysarg_t); 157 159 158 160 #endif -
kernel/generic/include/syscall/syscall.h
rfc5f7a8 r5bcf1f9 48 48 SYS_TASK_SET_NAME, 49 49 SYS_TASK_KILL, 50 SYS_TASK_EXIT, 50 51 SYS_PROGRAM_SPAWN_LOADER, 51 52 -
kernel/generic/src/interrupt/interrupt.c
rfc5f7a8 r5bcf1f9 45 45 #include <console/console.h> 46 46 #include <console/cmd.h> 47 #include <ipc/event.h>48 47 #include <synch/mutex.h> 49 48 #include <time/delay.h> … … 188 187 printf("\n"); 189 188 190 /* 191 * Userspace can subscribe for FAULT events to take action 192 * whenever a thread faults. (E.g. take a dump, run a debugger). 193 * The notification is always available, but unless Udebug is enabled, 194 * that's all you get. 195 */ 196 if (event_is_subscribed(EVENT_FAULT)) { 197 /* Notify the subscriber that a fault occurred. */ 198 event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid), 199 UPPER32(TASK->taskid), (sysarg_t) THREAD); 200 201 #ifdef CONFIG_UDEBUG 202 /* Wait for a debugging session. */ 203 udebug_thread_fault(); 204 #endif 205 } 206 207 task_kill(TASK->taskid); 208 thread_exit(); 189 task_kill_self(true); 209 190 } 210 191 -
kernel/generic/src/proc/task.c
rfc5f7a8 r5bcf1f9 384 384 { 385 385 task_id_t taskid; 386 int rc; 387 388 rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid)); 386 int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid)); 389 387 if (rc != 0) 390 388 return (sysarg_t) rc; 391 389 392 390 return (sysarg_t) task_kill(taskid); 393 391 } … … 520 518 } 521 519 520 /** Kill the currently running task. 521 * 522 * @param notify Send out fault notifications. 523 * 524 * @return Zero on success or an error code from errno.h. 525 * 526 */ 527 void task_kill_self(bool notify) 528 { 529 /* 530 * User space can subscribe for FAULT events to take action 531 * whenever a task faults (to take a dump, run a debugger, etc.). 532 * The notification is always available, but unless udebug is enabled, 533 * that's all you get. 534 */ 535 if (notify) { 536 if (event_is_subscribed(EVENT_FAULT)) { 537 /* Notify the subscriber that a fault occurred. */ 538 event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid), 539 UPPER32(TASK->taskid), (sysarg_t) THREAD); 540 541 #ifdef CONFIG_UDEBUG 542 /* Wait for a debugging session. */ 543 udebug_thread_fault(); 544 #endif 545 } 546 } 547 548 irq_spinlock_lock(&tasks_lock, true); 549 task_kill_internal(TASK); 550 irq_spinlock_unlock(&tasks_lock, true); 551 552 thread_exit(); 553 } 554 555 /** Process syscall to terminate the current task. 556 * 557 * @param notify Send out fault notifications. 558 * 559 */ 560 sysarg_t sys_task_exit(sysarg_t notify) 561 { 562 task_kill_self(notify); 563 564 /* Unreachable */ 565 return EOK; 566 } 567 522 568 static bool task_print_walker(avltree_node_t *node, void *arg) 523 569 { -
kernel/generic/src/syscall/syscall.c
rfc5f7a8 r5bcf1f9 86 86 } else { 87 87 printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id); 88 task_kill(TASK->taskid); 89 thread_exit(); 88 task_kill_self(true); 90 89 } 91 90 … … 131 130 (syshandler_t) sys_task_set_name, 132 131 (syshandler_t) sys_task_kill, 132 (syshandler_t) sys_task_exit, 133 133 (syshandler_t) sys_program_spawn_loader, 134 134
Note:
See TracChangeset
for help on using the changeset viewer.