diff options
| author | 2009-11-27 19:42:24 +0000 | |
|---|---|---|
| committer | 2009-11-27 19:42:24 +0000 | |
| commit | c5891344754a98257cef33dd5de91410b984000a (patch) | |
| tree | c6bd45abbc39e3d112fbc487778b0dbd4988d1a8 /sys/kern/kern_exit.c | |
| parent | Bump the libc major for the post-h2k9 string of ABI changes and additions (diff) | |
| download | wireguard-openbsd-c5891344754a98257cef33dd5de91410b984000a.tar.xz wireguard-openbsd-c5891344754a98257cef33dd5de91410b984000a.zip | |
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/kern/kern_exit.c')
| -rw-r--r-- | sys/kern/kern_exit.c | 12 |
1 files changed, 9 insertions, 3 deletions
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); } |
