1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-21 02:48:46 +00:00

Only init _thread_sigact once, needn't init it again after a fork().

Obtained from: deischen
This commit is contained in:
David Xu 2003-06-04 12:40:21 +00:00
parent cd0a0c267b
commit a05fa0abea
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115828
2 changed files with 62 additions and 62 deletions

View File

@ -449,6 +449,35 @@ init_private(void)
_thr_page_size = getpagesize();
_thr_guard_default = _thr_page_size;
/* Enter a loop to get the existing signal status: */
for (i = 1; i < NSIG; i++) {
/* Check for signals which cannot be trapped: */
if (i == SIGKILL || i == SIGSTOP) {
}
/* Get the signal handler details: */
else if (__sys_sigaction(i, NULL,
&_thread_sigact[i - 1]) != 0) {
/*
* Abort this process if signal
* initialisation fails:
*/
PANIC("Cannot read signal handler info");
}
}
/*
* Install the signal handler for SIGINFO. It isn't
* really needed, but it is nice to have for debugging
* purposes.
*/
if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
/*
* Abort this process if signal initialisation fails:
*/
PANIC("Cannot initialize signal handler");
}
_thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
init_once = 1; /* Don't do this again. */
} else {
/*
@ -462,43 +491,14 @@ init_private(void)
_lock_destroy(&_keytable_lock);
}
/* Initialize everything else. */
TAILQ_INIT(&_thread_list);
TAILQ_INIT(&_thread_gc_list);
/* Enter a loop to get the existing signal status: */
for (i = 1; i < NSIG; i++) {
/* Check for signals which cannot be trapped: */
if (i == SIGKILL || i == SIGSTOP) {
}
/* Get the signal handler details: */
else if (__sys_sigaction(i, NULL,
&_thread_sigact[i - 1]) != 0) {
/*
* Abort this process if signal
* initialisation fails:
*/
PANIC("Cannot read signal handler info");
}
/* Initialize the SIG_DFL dummy handler count. */
_thread_dfl_count[i] = 0;
}
/*
* Install the signal handler for SIGINFO. It isn't
* really needed, but it is nice to have for debugging
* purposes.
*/
if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
/*
* Abort this process if signal initialisation fails:
*/
PANIC("Cannot initialize signal handler");
}
_thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
/* Initialize the SIG_DFL dummy handler count. */
bzero(_thread_dfl_count, sizeof(_thread_dfl_count));
/*
* Initialize the lock for temporary installation of signal

View File

@ -449,6 +449,35 @@ init_private(void)
_thr_page_size = getpagesize();
_thr_guard_default = _thr_page_size;
/* Enter a loop to get the existing signal status: */
for (i = 1; i < NSIG; i++) {
/* Check for signals which cannot be trapped: */
if (i == SIGKILL || i == SIGSTOP) {
}
/* Get the signal handler details: */
else if (__sys_sigaction(i, NULL,
&_thread_sigact[i - 1]) != 0) {
/*
* Abort this process if signal
* initialisation fails:
*/
PANIC("Cannot read signal handler info");
}
}
/*
* Install the signal handler for SIGINFO. It isn't
* really needed, but it is nice to have for debugging
* purposes.
*/
if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
/*
* Abort this process if signal initialisation fails:
*/
PANIC("Cannot initialize signal handler");
}
_thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
init_once = 1; /* Don't do this again. */
} else {
/*
@ -462,43 +491,14 @@ init_private(void)
_lock_destroy(&_keytable_lock);
}
/* Initialize everything else. */
TAILQ_INIT(&_thread_list);
TAILQ_INIT(&_thread_gc_list);
/* Enter a loop to get the existing signal status: */
for (i = 1; i < NSIG; i++) {
/* Check for signals which cannot be trapped: */
if (i == SIGKILL || i == SIGSTOP) {
}
/* Get the signal handler details: */
else if (__sys_sigaction(i, NULL,
&_thread_sigact[i - 1]) != 0) {
/*
* Abort this process if signal
* initialisation fails:
*/
PANIC("Cannot read signal handler info");
}
/* Initialize the SIG_DFL dummy handler count. */
_thread_dfl_count[i] = 0;
}
/*
* Install the signal handler for SIGINFO. It isn't
* really needed, but it is nice to have for debugging
* purposes.
*/
if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
/*
* Abort this process if signal initialisation fails:
*/
PANIC("Cannot initialize signal handler");
}
_thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
/* Initialize the SIG_DFL dummy handler count. */
bzero(_thread_dfl_count, sizeof(_thread_dfl_count));
/*
* Initialize the lock for temporary installation of signal