diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2002-05-18 00:16:01 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2002-05-18 00:16:01 +0000 |
commit | c12bcfb0228a5dda70c310cb3d35a0e01e627f96 (patch) | |
tree | 9576b82eb4e993e4da3d60596f44285708823704 /sys | |
parent | 7dd97d7f0c7cd1cf2a9808b2826f2dc8cb7ca334 (diff) |
when detaching form a process don't forget to remove posted messages.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/systrace.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c index 0a1a7d0d024..bc8fdc6af05 100644 --- a/sys/dev/systrace.c +++ b/sys/dev/systrace.c @@ -405,7 +405,6 @@ systracef_close(fp, p) systrace_detach(strp); psignal(q, SIGKILL); - } /* Clean up fork and exit messages */ @@ -1038,22 +1037,23 @@ systrace_detach(struct str_process *strp) DPRINTF(("%s: Trying to detach from %d\n", __FUNCTION__, strp->pid)); - if ((proc = systrace_find(strp)) == NULL) { + if ((proc = systrace_find(strp)) != NULL) { + CLR(proc->p_flag, P_SYSTRACE); + proc->p_systrace = NULL; + } else error = ESRCH; - goto out; - } if (ISSET(strp->flags, STR_PROC_WAITANSWER)) { CLR(strp->flags, STR_PROC_WAITANSWER); wakeup(strp); } - CLR(proc->p_flag, P_SYSTRACE); - proc->p_systrace = NULL; - - out: fst = strp->parent; systrace_wakeup(fst); + + if (ISSET(strp->flags, STR_PROC_ONQUEUE)) + TAILQ_REMOVE(&fst->messages, strp, msg_next); + TAILQ_REMOVE(&fst->processes, strp, next); if (strp->policy) systrace_closepolicy(fst, strp->policy); @@ -1229,7 +1229,11 @@ systrace_msg_child(struct fsystrace *fst, struct str_process *strp, pid_t npid) struct str_msg_child *msg_child; nstrp = pool_get(&systr_proc_pl, PR_WAITOK); + memset(nstrp, 0, sizeof(struct str_process)); + DPRINTF(("%s: %p: pid %d -> pid %d\n", __FUNCTION__, + nstrp, strp->pid, npid)); + msg = &nstrp->msg; msg_child = &msg->msg_data.msg_child; |