summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2005-12-30 04:02:19 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2005-12-30 04:02:19 +0000
commit2dbff420c69adc1a0932d17a4d59bbdebed815e2 (patch)
tree5cfc48b09150252c21a47c42282012cad0fadd3d /sys
parent6760385694583745631dc8fcab519dd764360e6f (diff)
change thrwakeup to take an argument which specifies how many threads
to wakeup.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/init_sysent.c4
-rw-r--r--sys/kern/kern_synch.c10
-rw-r--r--sys/kern/syscalls.c2
-rw-r--r--sys/kern/syscalls.master4
-rw-r--r--sys/sys/syscall.h4
-rw-r--r--sys/sys/syscallargs.h3
6 files changed, 16 insertions, 11 deletions
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c
index a8673298893..4caee0d1cb3 100644
--- a/sys/kern/init_sysent.c
+++ b/sys/kern/init_sysent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_sysent.c,v 1.91 2005/12/13 06:04:14 tedu Exp $ */
+/* $OpenBSD: init_sysent.c,v 1.92 2005/12/30 04:02:17 tedu Exp $ */
/*
* System call switch table.
@@ -800,7 +800,7 @@ struct sysent sysent[] = {
sys_getthrid }, /* 299 = getthrid */
{ 3, s(struct sys_thrsleep_args),
sys_thrsleep }, /* 300 = thrsleep */
- { 1, s(struct sys_thrwakeup_args),
+ { 2, s(struct sys_thrwakeup_args),
sys_thrwakeup }, /* 301 = thrwakeup */
{ 1, s(struct sys_threxit_args),
sys_threxit }, /* 302 = threxit */
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 8a51b0c1aec..f9a70ca3dcb 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.72 2005/12/22 06:55:03 tedu Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.73 2005/12/30 04:02:17 tedu Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -409,19 +409,23 @@ sys_thrwakeup(struct proc *p, void *v, register_t *retval)
{
struct sys_thrwakeup_args *uap = v;
long ident = (long)SCARG(uap, ident);
+ int n = SCARG(uap, n);
struct proc *q;
int found = 0;
/* have to check the parent, it's not in the thread list */
if (p->p_thrparent->p_thrslpid == ident) {
wakeup(&p->p_thrparent->p_thrslpid);
- found = 1;
+ p->p_thrparent->p_thrslpid = 0;
+ if (++found == n)
+ return (0);
}
LIST_FOREACH(q, &p->p_thrparent->p_thrchildren, p_thrsib) {
if (q->p_thrslpid == ident) {
wakeup(&q->p_thrslpid);
q->p_thrslpid = 0;
- found = 1;
+ if (++found == n)
+ return (0);
}
}
if (!found)
diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c
index 219d9763cdf..eabf463a68d 100644
--- a/sys/kern/syscalls.c
+++ b/sys/kern/syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscalls.c,v 1.92 2005/12/13 06:04:14 tedu Exp $ */
+/* $OpenBSD: syscalls.c,v 1.93 2005/12/30 04:02:17 tedu Exp $ */
/*
* System call names.
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 76ca9b08187..5e231f2975c 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.80 2005/12/13 06:02:03 tedu Exp $
+; $OpenBSD: syscalls.master,v 1.81 2005/12/30 04:02:17 tedu Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -598,7 +598,7 @@
#ifdef RTHREADS
299 STD { pid_t sys_getthrid(void); }
300 STD { int sys_thrsleep(void *ident, int timeout, void *lock); }
-301 STD { int sys_thrwakeup(void *ident); }
+301 STD { int sys_thrwakeup(void *ident, int n); }
302 STD { int sys_threxit(int rval); }
303 STD { int sys_thrsigdivert(sigset_t sigmask); }
#else
diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h
index 5935baaf227..45840b06084 100644
--- a/sys/sys/syscall.h
+++ b/sys/sys/syscall.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.h,v 1.90 2005/12/13 06:04:15 tedu Exp $ */
+/* $OpenBSD: syscall.h,v 1.91 2005/12/30 04:02:18 tedu Exp $ */
/*
* System call numbers.
@@ -679,7 +679,7 @@
/* syscall: "thrsleep" ret: "int" args: "void *" "int" "void *" */
#define SYS_thrsleep 300
-/* syscall: "thrwakeup" ret: "int" args: "void *" */
+/* syscall: "thrwakeup" ret: "int" args: "void *" "int" */
#define SYS_thrwakeup 301
/* syscall: "threxit" ret: "int" args: "int" */
diff --git a/sys/sys/syscallargs.h b/sys/sys/syscallargs.h
index 8fe5239a93f..1dce74fd491 100644
--- a/sys/sys/syscallargs.h
+++ b/sys/sys/syscallargs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscallargs.h,v 1.92 2005/12/13 06:04:15 tedu Exp $ */
+/* $OpenBSD: syscallargs.h,v 1.93 2005/12/30 04:02:18 tedu Exp $ */
/*
* System call argument lists.
@@ -1225,6 +1225,7 @@ struct sys_thrsleep_args {
struct sys_thrwakeup_args {
syscallarg(void *) ident;
+ syscallarg(int) n;
};
struct sys_threxit_args {