diff options
author | Daniel Eischen <deischen@FreeBSD.org> | 2001-04-18 12:40:30 +0000 |
---|---|---|
committer | Daniel Eischen <deischen@FreeBSD.org> | 2001-04-18 12:40:30 +0000 |
commit | 1cf08f39294f771ba867bd2f51aaa9bbeb3d00a9 (patch) | |
tree | 377891cb23082700aeb1b75d74483016b9e72ad6 /lib/libc_r | |
parent | d8d4bc9ab4aa98717d0ee0ed475365fe46b4fa50 (diff) | |
download | src-1cf08f39294f771ba867bd2f51aaa9bbeb3d00a9.tar.gz src-1cf08f39294f771ba867bd2f51aaa9bbeb3d00a9.zip |
Reinstall the alternate signal stack after a fork.
PR: 25110
Tested by: knu
Notes
Notes:
svn path=/head/; revision=75657
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/uthread/uthread_fork.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_fork.c b/lib/libc_r/uthread/uthread_fork.c index 4437d886a80e..a2aabbe149ba 100644 --- a/lib/libc_r/uthread/uthread_fork.c +++ b/lib/libc_r/uthread/uthread_fork.c @@ -32,6 +32,7 @@ * $FreeBSD$ */ #include <errno.h> +#include <signal.h> #include <string.h> #include <stdlib.h> #include <unistd.h> @@ -112,7 +113,16 @@ _fork(void) else if (_pq_init(&_readyq) != 0) { /* Abort this application: */ PANIC("Cannot initialize priority ready queue."); - } else { + } else if ((_thread_sigstack.ss_sp == NULL) && + ((_thread_sigstack.ss_sp = malloc(SIGSTKSZ)) == NULL)) + PANIC("Unable to allocate alternate signal stack"); + else { + /* Install the alternate signal stack: */ + _thread_sigstack.ss_size = SIGSTKSZ; + _thread_sigstack.ss_flags = 0; + if (__sys_sigaltstack(&_thread_sigstack, NULL) != 0) + PANIC("Unable to install alternate signal stack"); + /* * Enter a loop to remove all threads other than * the running thread from the thread list: |