summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-02-27 09:07:55 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-02-27 09:07:55 +0000
commitfbdfcb018aca37c86406d63e6cc9a57c64fe2bfd (patch)
treeeaaf3379cf687076e9ede3783c3ce993a2c67cb6
parent68ce2342f8432890c5474826d1c6f61d79bcf3da (diff)
Add wakeup_n and wakeup_one. wakeup_n will wakeup up to n sleeping processes
-rw-r--r--sys/kern/kern_synch.c11
-rw-r--r--sys/sys/proc.h6
-rw-r--r--sys/ufs/ffs/ffs_softdep.c11
3 files changed, 13 insertions, 15 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index b6307d390bf..7e166e7cdf1 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.30 2001/02/19 16:33:20 art Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.31 2001/02/27 09:07:53 csapuntz Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -566,8 +566,9 @@ unsleep(p)
* Make all processes sleeping on the specified identifier runnable.
*/
void
-wakeup(ident)
+wakeup_n(ident, n)
void *ident;
+ int n;
{
struct slpque *qp;
struct proc *p, **q;
@@ -582,6 +583,7 @@ restart:
panic("wakeup");
#endif
if (p->p_wchan == ident) {
+ --n;
p->p_wchan = 0;
*q = p->p_forw;
if (qp->sq_tailp == &p->p_forw)
@@ -607,7 +609,10 @@ restart:
}
/* END INLINE EXPANSION */
- goto restart;
+ if (n != 0)
+ goto restart;
+ else
+ break;
}
} else
q = &p->p_forw;
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index cf7ad3ae628..c300de86161 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.34 2000/11/16 20:02:20 provos Exp $ */
+/* $OpenBSD: proc.h,v 1.35 2001/02/27 09:07:54 csapuntz Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -371,7 +371,9 @@ void swapin __P((struct proc *));
#endif
int tsleep __P((void *chan, int pri, char *wmesg, int timo));
void unsleep __P((struct proc *));
-void wakeup __P((void *chan));
+void wakeup_n __P((void *chan, int));
+#define wakeup(c) wakeup_n((c), -1)
+#define wakeup_one(c) wakeup_n((c), 1)
void reaper __P((void));
void exit1 __P((struct proc *, int));
void exit2 __P((struct proc *));
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index afa7d29cb79..8a08ce5b8f2 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.16 2001/02/26 17:54:07 csapuntz Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.17 2001/02/27 09:07:54 csapuntz Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
*
@@ -478,15 +478,6 @@ struct ctldebug debug30 = { "direct_blk_ptrs", &stat_direct_blk_ptrs };
struct ctldebug debug31 = { "dir_entry", &stat_dir_entry };
#endif /* DEBUG */
-void wakeup_one __P((void *));
-
-void
-wakeup_one(c)
- void *c;
-{
- wakeup(c);
-}
-
/*
* Add an item to the end of the work queue.
* This routine requires that the lock be held.