summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1995-12-30 08:35:39 +0000
committerderaadt <deraadt@openbsd.org>1995-12-30 08:35:39 +0000
commit20d2d94c463408c2b9a8dd798198a1f1d41d50c1 (patch)
tree7687e6201f40ceba035baf9fa51abfe429ce6b2b /sys/kern/kern_exit.c
parentfrom netbsd: use memcpy/memset for FD_COPY/FD_ZERO in userland (diff)
downloadwireguard-openbsd-20d2d94c463408c2b9a8dd798198a1f1d41d50c1.tar.xz
wireguard-openbsd-20d2d94c463408c2b9a8dd798198a1f1d41d50c1.zip
from netbsd:
Remove the process from zombproc and its parent's child list before freeing its resources.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 27a12beee9a..c696ac37c62 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exit.c,v 1.34 1995/12/09 04:09:32 mycroft Exp $ */
+/* $NetBSD: kern_exit.c,v 1.35 1995/12/24 11:23:33 mycroft Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -332,15 +332,17 @@ loop:
FREE(p->p_ru, M_ZOMBIE);
/*
- * Decrement the count of procs running with this uid.
+ * Finally finished with old proc entry.
+ * Unlink it from its process group and free it.
*/
- (void)chgproccnt(p->p_cred->p_ruid, -1);
+ leavepgrp(p);
+ LIST_REMOVE(p, p_list); /* off zombproc */
+ LIST_REMOVE(p, p_sibling);
/*
- * Release reference to text vnode
+ * Decrement the count of procs running with this uid.
*/
- if (p->p_textvp)
- vrele(p->p_textvp);
+ (void)chgproccnt(p->p_cred->p_ruid, -1);
/*
* Free up credentials.
@@ -351,12 +353,10 @@ loop:
}
/*
- * Finally finished with old proc entry.
- * Unlink it from its process group and free it.
+ * Release reference to text vnode
*/
- leavepgrp(p);
- LIST_REMOVE(p, p_list); /* off zombproc */
- LIST_REMOVE(p, p_sibling);
+ if (p->p_textvp)
+ vrele(p->p_textvp);
/*
* Give machine-dependent layer a chance