From 9b1e997b4c3f3fe3b844aa1d7d10c04ec3673c36 Mon Sep 17 00:00:00 2001 From: deischen Date: Wed, 18 Apr 2001 12:40:30 +0000 Subject: Reinstall the alternate signal stack after a fork. PR: 25110 Tested by: knu --- lib/libkse/thread/thr_fork.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/libkse/thread/thr_fork.c') diff --git a/lib/libkse/thread/thr_fork.c b/lib/libkse/thread/thr_fork.c index 4437d88..a2aabbe 100644 --- a/lib/libkse/thread/thr_fork.c +++ b/lib/libkse/thread/thr_fork.c @@ -32,6 +32,7 @@ * $FreeBSD$ */ #include +#include #include #include #include @@ -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: -- cgit v1.1