/* * A process has terminated or is being detached. Print the resulting status. */ static void discard_proc(struct trace_proc * proc, int status) { const char *signame; /* * The exit() calls are of type no-return, meaning they are expected * not to return. However, calls of this type may in fact return an * error, in which case the error must be printed. Thus, such calls * are not actually finished until the end of the call-leave phase. * For exit() calls, a successful call will never get to the call-leave * phase. The result is that such calls will end up being shown as * suspended, which is unintuitive. To counter this, we pretend that a * clean process exit is in fact preceded by a call-leave event, thus * allowing the call to be printed without suspension. An example: * * 3| exit(0) <..> * 2| setsid() = 2 * [A] 3| exit(0) * 3| Process exited normally with code 0 * * The [A] line is the result of the following code. */ if (WIFEXITED(status) && (proc->trace_flags & TF_INCALL)) call_leave(proc, TRUE /*skip*/); put_newline(); if (WIFEXITED(status)) { put_fmt(proc, "Process exited normally with code %d", WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { if ((signame = get_signal_name(WTERMSIG(status))) != NULL) put_fmt(proc, "Process terminated from signal %s", signame); else put_fmt(proc, "Process terminated from signal %d", WTERMSIG(status)); } else if (WIFSTOPPED(status)) put_text(proc, "Process detached"); else put_fmt(proc, "Bogus wait result (%04x)", status); put_newline(); proc_del(proc); }
static void clear_list(void) { /*struct list_head *h; struct process *p; h = plist.next; while(h != &plist) { h = h->next; p = list_entry(h, struct process, plist_l); proc_del(p); }*/ struct process *p, *q; for(p = begin; p; p = q){ q = p->next; proc_del(p); } }
static void delete_tree_lines(struct wdgt *w) { struct process *u, *p; p = begin; while(p){ if (!is_marked(p)){ p = p->next; continue; } //delete_line(&proc_win, p->line); scr_ldeleted(w, p->line); u = p; while(u) { u->line--; u = u->next; } u = p->next; proc_del(p); p = u; } }
static __exit void test_exit(void) { printk(KERN_DEBUG "Bye, test!\n"); proc_del(); thread_exit(); }