summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-06-04 12:40:21 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-06-04 12:40:21 +0000
commit4bb0c351d9fd29ede6adb91a6e7146ef0e33a32a (patch)
tree1751f699da796fbe48ab1fea469360a74658b521 /lib/libpthread
parent35d309a6175dee4a2a165b1b51a8666704ed438c (diff)
downloadFreeBSD-src-4bb0c351d9fd29ede6adb91a6e7146ef0e33a32a.zip
FreeBSD-src-4bb0c351d9fd29ede6adb91a6e7146ef0e33a32a.tar.gz
Only init _thread_sigact once, needn't init it again after a fork().
Obtained from: deischen
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_init.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c
index ceee041..227bdf3 100644
--- a/lib/libpthread/thread/thr_init.c
+++ b/lib/libpthread/thread/thr_init.c
@@ -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
OpenPOWER on IntegriCloud