diff options
author | Juan Cespedes <cespedes@debian.org> | 1998-03-13 00:29:21 +0100 |
---|---|---|
committer | Juan Cespedes <cespedes@debian.org> | 1998-03-13 00:29:21 +0100 |
commit | 1fe93d5b55ad2b8d4009a63e343db19cc1f21bb0 (patch) | |
tree | afacea7e61b0d55928c7508bf2473a5d09220ec6 /process_event.c | |
parent | 2c4a8cbb737f8752e100f8905bd23c4029c83f83 (diff) | |
download | ltrace-1fe93d5b55ad2b8d4009a63e343db19cc1f21bb0.tar.gz |
Version 0.2.4
* Option `-p' now works (but programs fail when ltrace is interrupted)
Diffstat (limited to 'process_event.c')
-rw-r--r-- | process_event.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/process_event.c b/process_event.c index 0689a74..170c37d 100644 --- a/process_event.c +++ b/process_event.c @@ -1,6 +1,7 @@ #define _GNU_SOURCE #include <stdio.h> #include <string.h> +#include <stdlib.h> #include "ltrace.h" #include "output.h" @@ -95,16 +96,40 @@ static void process_signal(struct event * event) continue_after_signal(event->proc->pid, event->e_un.signum); } +static void remove_proc(struct process * proc); + static void process_exit(struct event * event) { output_line(event->proc, "+++ exited (status %d) +++", event->e_un.ret_val); + remove_proc(event->proc); } static void process_exit_signal(struct event * event) { output_line(event->proc, "+++ killed by %s +++", shortsignal(event->e_un.signum)); + remove_proc(event->proc); +} + +static void remove_proc(struct process * proc) +{ + struct process *tmp, *tmp2; + + if (list_of_processes == proc) { + tmp = list_of_processes; + list_of_processes = list_of_processes->next; + free(tmp); + return; + } + tmp = list_of_processes; + while(tmp->next) { + if (tmp->next==proc) { + tmp2 = tmp->next; + tmp->next = tmp->next->next; + free(tmp2); + } + } } static void process_syscall(struct event * event) |