diff options
author | David Xu <davidxu@FreeBSD.org> | 2004-10-07 13:52:18 +0000 |
---|---|---|
committer | David Xu <davidxu@FreeBSD.org> | 2004-10-07 13:52:18 +0000 |
commit | e897f5132791cde795bc3abdecc48b496c95f626 (patch) | |
tree | 6be7f3bebb06e63741e82f9fda99f03d3494ca64 /lib/libpthread | |
parent | 84e0b075f6877ea4b0103912632bae4daa85bac5 (diff) | |
download | src-test2-e897f5132791cde795bc3abdecc48b496c95f626.tar.gz src-test2-e897f5132791cde795bc3abdecc48b496c95f626.zip |
Notes
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/thread/thr_execve.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/lib/libpthread/thread/thr_execve.c b/lib/libpthread/thread/thr_execve.c index db5b8587e123..2904a2f95105 100644 --- a/lib/libpthread/thread/thr_execve.c +++ b/lib/libpthread/thread/thr_execve.c @@ -39,30 +39,26 @@ __weak_reference(_execve, execve); int _execve(const char *name, char *const *argv, char *const *envp) { - sigset_t omask; + struct kse_execve_args args; struct pthread *curthread; - kse_critical_t crit; - int saved_errno; int ret; - /* - * When exec'ing, set the kernel signal mask to the thread's - * signal mask to satisfy POSIX requirements. We have to enter - * a critical region so that the kernel thread doesn't get - * changed out from under us after setting the signal mask. - */ - curthread = _get_curthread(); - crit = _kse_critical_enter(); - __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, &omask); - ret = __sys_execve(name, argv, envp); + if (!_kse_isthreaded()) + ret = __sys_execve(name, argv, envp); + else { + /* + * When exec'ing, set the kernel signal mask to the thread's + * signal mask to satisfy POSIX requirements. + */ + curthread = _get_curthread(); + args.sigmask = curthread->sigmask; + args.sigpend = curthread->sigpend; + args.path = (char *)name; + args.argv = (char **)argv; + args.envp = (char **)envp; + args.reserved = NULL; + ret = kse_thr_interrupt(NULL, KSE_INTR_EXECVE, (long)&args); + } - /* - * If something went wrong, set the signal mask back but don't - * destroy errno. - */ - saved_errno = errno; - __sys_sigprocmask(SIG_SETMASK, &omask, NULL); - errno = saved_errno; - _kse_critical_leave(crit); return (ret); } |