Reinstall the alternate signal stack after a fork.

PR:		25110
Tested by:	knu
This commit is contained in:
deischen 2001-04-18 12:40:30 +00:00
parent b3c0e7b0c5
commit 9147539de5
3 changed files with 33 additions and 3 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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: