aboutsummaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-05-30 21:48:41 +0200
committerMattias Andrée <maandree@kth.se>2020-05-30 21:48:41 +0200
commit261293d374570ee90def87fc5f503cbccb0c6a6c (patch)
tree826f7e209723051e76b11096d44c97c5e9a0dbc8 /process.c
parentAdd support for tracing fork children (diff)
downloadsctrace-261293d374570ee90def87fc5f503cbccb0c6a6c.tar.gz
sctrace-261293d374570ee90def87fc5f503cbccb0c6a6c.tar.bz2
sctrace-261293d374570ee90def87fc5f503cbccb0c6a6c.tar.xz
m + add support for tracing vfork children
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'process.c')
-rw-r--r--process.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/process.c b/process.c
index ea0dfd1..c5a09be 100644
--- a/process.c
+++ b/process.c
@@ -26,7 +26,7 @@ find_process(pid_t pid)
struct process *
-add_process(pid_t pid, int trace_options)
+add_process(pid_t pid, unsigned long int trace_options)
{
struct process *proc;
int saved_errno;
@@ -45,8 +45,8 @@ add_process(pid_t pid, int trace_options)
errno = saved_errno;
eprintf("ptrace PTRACE_SETOPTIONS %ju 0 ...:", (uintmax_t)pid);
}
- if (ptrace(PTRACE_SYSCALL, proc->pid, NULL, 0))
- eprintf("ptrace PTRACE_SYSCALL %ju NULL 0:", (uintmax_t)pid);
+ if (ptrace(PTRACE_SYSCALL, pid, NULL, 0))
+ eprintf("ptrace PTRACE_SYSCALL %ju NULL 0:", (uintmax_t)pid);
proc->next = &tail;
proc->prev = tail.prev;
proc->prev->next = proc;
@@ -60,5 +60,9 @@ remove_process(struct process *proc)
{
proc->prev->next = proc->next;
proc->next->prev = proc->prev;
+ if (proc->vfork_waiting_on)
+ proc->vfork_waiting_on->continue_on_exit = NULL;
+ if (proc->continue_on_exit)
+ proc->continue_on_exit->vfork_waiting_on = NULL;
free(proc);
}