diff options
| author | Daniel Eischen <deischen@FreeBSD.org> | 2004-12-18 18:07:37 +0000 |
|---|---|---|
| committer | Daniel Eischen <deischen@FreeBSD.org> | 2004-12-18 18:07:37 +0000 |
| commit | 843d4004b367db61428fa1cbf611cdbd2791d672 (patch) | |
| tree | 3341fdd3fcdb8d611509d7622be5b25f271de80a /lib/libpthread/thread/thr_fork.c | |
| parent | 885dabe5f70ceac846c6d0623c64914d5c401f10 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_fork.c')
| -rw-r--r-- | lib/libpthread/thread/thr_fork.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/libpthread/thread/thr_fork.c b/lib/libpthread/thread/thr_fork.c index 401aae9e1883..fdbfd86855f4 100644 --- a/lib/libpthread/thread/thr_fork.c +++ b/lib/libpthread/thread/thr_fork.c @@ -43,12 +43,6 @@ #include "libc_private.h" #include "thr_private.h" -/* - * For a while, allow libpthread to work with a libc that doesn't - * export the malloc lock. - */ -#pragma weak __malloc_lock - __weak_reference(_fork, fork); pid_t @@ -60,11 +54,21 @@ _fork(void) pid_t ret; int errsave; - if (!_kse_isthreaded()) - return (__sys_fork()); - curthread = _get_curthread(); + if (!_kse_isthreaded()) { + SIGFILLSET(sigset); + __sys_sigprocmask(SIG_SETMASK, &sigset, &oldset); + ret = __sys_fork(); + if (ret == 0) + /* Child */ + __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, + NULL); + else + __sys_sigprocmask(SIG_SETMASK, &oldset, NULL); + return (ret); + } + /* * Masks all signals until we reach a safe point in * _kse_single_thread, and the signal masks will be @@ -86,7 +90,7 @@ _fork(void) } /* Fork a new process: */ - if ((_kse_isthreaded() != 0) && (__malloc_lock != NULL)) { + if (_kse_isthreaded() != 0) { _spinlock(__malloc_lock); } if ((ret = __sys_fork()) == 0) { |
