diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2009-11-27 19:42:25 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2009-11-27 19:42:25 +0000 |
commit | c84c43b4dd4a0b4fd392f5b5171ce683234649e4 (patch) | |
tree | 03b0926a8faf866bdf224f37e8957ad44a3d760e /sys | |
parent | a950c799236bacf77b94096700b5e5489793953c (diff) |
Change threxit() to take a pointer to a pid_t to zero out from the
kernel so that librthread can detect when a thread is completely
done with its stack without need a kqueue. The dying thread moves
itself to a GC list, other threads scan the GC list on pthread_create()
and pthread_join() and free the stack and handle once the thread's
thread id is zeroed.
"get it in" deraadt@, tedu@, cheers by others
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/init_sysent.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 12 | ||||
-rw-r--r-- | sys/kern/syscalls.c | 2 | ||||
-rw-r--r-- | sys/kern/syscalls.master | 4 |
4 files changed, 13 insertions, 7 deletions
diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 57e5610efa9..c8f844ab9b6 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_sysent.c,v 1.107 2009/06/15 17:31:49 deraadt Exp $ */ +/* $OpenBSD: init_sysent.c,v 1.108 2009/11/27 19:42:24 guenther Exp $ */ /* * System call switch table. diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index b8336c38499..638610c7d25 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.86 2009/10/05 17:43:07 deraadt Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.87 2009/11/27 19:42:24 guenther Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -95,10 +95,16 @@ int sys_threxit(struct proc *p, void *v, register_t *retval) { struct sys_threxit_args /* { - syscallarg(int) rval; + syscallarg(pid_t *) notdead; } */ *uap = v; - exit1(p, W_EXITCODE(SCARG(uap, rval), 0), EXIT_THREAD); + if (SCARG(uap, notdead) != NULL) { + pid_t zero = 0; + if (copyout(&zero, SCARG(uap, notdead), sizeof(zero))) { + psignal(p, SIGSEGV); + } + } + exit1(p, 0, EXIT_THREAD); return (0); } diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 872f29c18d5..3808639d1cf 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscalls.c,v 1.108 2009/06/15 17:31:49 deraadt Exp $ */ +/* $OpenBSD: syscalls.c,v 1.109 2009/11/27 19:42:24 guenther Exp $ */ /* * System call names. diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 686f7074b43..a4d507d5f0e 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,4 +1,4 @@ -; $OpenBSD: syscalls.master,v 1.93 2009/06/03 15:42:03 jj Exp $ +; $OpenBSD: syscalls.master,v 1.94 2009/11/27 19:42:24 guenther Exp $ ; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -599,7 +599,7 @@ 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, int n); } -302 STD { void sys_threxit(int rval); } +302 STD { void sys_threxit(pid_t *notdead); } 303 STD { int sys_thrsigdivert(sigset_t sigmask); } #else 299 UNIMPL |