summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2008-10-30 17:09:13 +0000
committerderaadt <deraadt@openbsd.org>2008-10-30 17:09:13 +0000
commitb6af5ebeb9c3778536b7c678a9a17f8debd8b384 (patch)
tree7e5874669a42e5f78420b81cebe690608de61e6f
parentArpresolve could loose few packets during resolving an ethernet (diff)
downloadwireguard-openbsd-b6af5ebeb9c3778536b7c678a9a17f8debd8b384.tar.xz
wireguard-openbsd-b6af5ebeb9c3778536b7c678a9a17f8debd8b384.zip
Use msleep() in the reaper to make it not lose events. Based on discussion
PR 5609, and revisited with dlg. Tested on all platforms. ok miod
-rw-r--r--sys/kern/kern_exit.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index ee45596f495..d3396e2e8dc 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.76 2008/10/14 18:27:29 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.77 2008/10/30 17:09:13 deraadt Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -388,17 +388,13 @@ reaper(void)
for (;;) {
mtx_enter(&deadproc_mutex);
- p = LIST_FIRST(&deadproc);
- if (p == NULL) {
- /* No work for us; go to sleep until someone exits. */
- mtx_leave(&deadproc_mutex);
- (void) tsleep(&deadproc, PVM, "reaper", 0);
- continue;
- }
+ while ((p = LIST_FIRST(&deadproc)) == NULL)
+ msleep(&deadproc, &deadproc_mutex, PVM, "reaper", 0);
/* Remove us from the deadproc list. */
LIST_REMOVE(p, p_hash);
mtx_leave(&deadproc_mutex);
+
KERNEL_PROC_LOCK(curproc);
/*