summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2004-10-07 13:52:18 +0000
committerdavidxu <davidxu@FreeBSD.org>2004-10-07 13:52:18 +0000
commit3b8ee1c51209b3fa49c0bfb26aba3d04f6f4cd35 (patch)
tree6be7f3bebb06e63741e82f9fda99f03d3494ca64
parent94500a033672dc789c56e4522186c8fd37178ccc (diff)
downloadFreeBSD-src-3b8ee1c51209b3fa49c0bfb26aba3d04f6f4cd35.zip
FreeBSD-src-3b8ee1c51209b3fa49c0bfb26aba3d04f6f4cd35.tar.gz
Follow kernel change, restore signal mask correctly by using a command
of kse_thr_interrupt.
-rw-r--r--lib/libkse/thread/thr_execve.c38
-rw-r--r--lib/libpthread/thread/thr_execve.c38
2 files changed, 34 insertions, 42 deletions
diff --git a/lib/libkse/thread/thr_execve.c b/lib/libkse/thread/thr_execve.c
index db5b858..2904a2f 100644
--- a/lib/libkse/thread/thr_execve.c
+++ b/lib/libkse/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);
}
diff --git a/lib/libpthread/thread/thr_execve.c b/lib/libpthread/thread/thr_execve.c
index db5b858..2904a2f 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);
}
OpenPOWER on IntegriCloud