summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-07-09 01:39:24 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-07-09 01:39:24 +0000
commit9687583ade057bcacf1441d12c1c95557fc7c7e7 (patch)
tree80c8781231782fa76c4e196e2e44be0c7b5c35d4 /lib
parent54fcf3f7fa7dd7e6d9508acfae3e606bf9a536a8 (diff)
downloadFreeBSD-src-9687583ade057bcacf1441d12c1c95557fc7c7e7.zip
FreeBSD-src-9687583ade057bcacf1441d12c1c95557fc7c7e7.tar.gz
Restore signal mask correctly after fork().
Diffstat (limited to 'lib')
-rw-r--r--lib/libkse/thread/thr_kern.c3
-rw-r--r--lib/libkse/thread/thr_sig.c7
-rw-r--r--lib/libpthread/thread/thr_kern.c3
-rw-r--r--lib/libpthread/thread/thr_sig.c7
4 files changed, 12 insertions, 8 deletions
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c
index 717a766..9a17ead 100644
--- a/lib/libkse/thread/thr_kern.c
+++ b/lib/libkse/thread/thr_kern.c
@@ -321,10 +321,11 @@ _kse_single_thread(struct pthread *curthread)
_kse_initial = NULL;
_libpthread_init(curthread);
#else
+ if (__isthreaded)
+ _thr_signal_deinit();
_ksd_readandclear_tmbx();
__isthreaded = 0;
active_threads = 0;
- _thr_signal_deinit();
#endif
}
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
index 2800cc7..6e95cdd 100644
--- a/lib/libkse/thread/thr_sig.c
+++ b/lib/libkse/thread/thr_sig.c
@@ -984,12 +984,13 @@ _thr_signal_init(void)
void
_thr_signal_deinit(void)
{
- sigset_t tmpmask, oldmask;
+ struct pthread *curthread = _get_curthread();
+ sigset_t tmpmask;
int i;
SIGFILLSET(tmpmask);
SIG_CANTMASK(tmpmask);
- __sys_sigprocmask(SIG_SETMASK, &tmpmask, &oldmask);
+ __sys_sigprocmask(SIG_SETMASK, &tmpmask, NULL);
/* Enter a loop to get the existing signal status: */
for (i = 1; i <= _SIG_MAXSIG; i++) {
/* Check for signals which cannot be trapped: */
@@ -1005,6 +1006,6 @@ _thr_signal_deinit(void)
PANIC("Cannot set signal handler info");
}
}
- __sys_sigprocmask(SIG_SETMASK, &oldmask, NULL);
+ __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
}
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index 717a766..9a17ead 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/thread/thr_kern.c
@@ -321,10 +321,11 @@ _kse_single_thread(struct pthread *curthread)
_kse_initial = NULL;
_libpthread_init(curthread);
#else
+ if (__isthreaded)
+ _thr_signal_deinit();
_ksd_readandclear_tmbx();
__isthreaded = 0;
active_threads = 0;
- _thr_signal_deinit();
#endif
}
diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c
index 2800cc7..6e95cdd 100644
--- a/lib/libpthread/thread/thr_sig.c
+++ b/lib/libpthread/thread/thr_sig.c
@@ -984,12 +984,13 @@ _thr_signal_init(void)
void
_thr_signal_deinit(void)
{
- sigset_t tmpmask, oldmask;
+ struct pthread *curthread = _get_curthread();
+ sigset_t tmpmask;
int i;
SIGFILLSET(tmpmask);
SIG_CANTMASK(tmpmask);
- __sys_sigprocmask(SIG_SETMASK, &tmpmask, &oldmask);
+ __sys_sigprocmask(SIG_SETMASK, &tmpmask, NULL);
/* Enter a loop to get the existing signal status: */
for (i = 1; i <= _SIG_MAXSIG; i++) {
/* Check for signals which cannot be trapped: */
@@ -1005,6 +1006,6 @@ _thr_signal_deinit(void)
PANIC("Cannot set signal handler info");
}
}
- __sys_sigprocmask(SIG_SETMASK, &oldmask, NULL);
+ __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
}
OpenPOWER on IntegriCloud