summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread/uthread_execve.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r/uthread/uthread_execve.c')
-rw-r--r--lib/libc_r/uthread/uthread_execve.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/libc_r/uthread/uthread_execve.c b/lib/libc_r/uthread/uthread_execve.c
index ed1906c..090b2b5 100644
--- a/lib/libc_r/uthread/uthread_execve.c
+++ b/lib/libc_r/uthread/uthread_execve.c
@@ -34,13 +34,15 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
-#ifdef _THREAD_SAFE
#include <pthread.h>
#include "pthread_private.h"
+#pragma weak execve=_execve
+
int
_execve(const char *name, char *const * argv, char *const * envp)
{
+ struct pthread *curthread = _get_curthread();
int flags;
int i;
int ret;
@@ -56,8 +58,8 @@ _execve(const char *name, char *const * argv, char *const * envp)
setitimer(_ITIMER_SCHED_TIMER, &itimer, NULL);
/* Close the pthread kernel pipe: */
- _thread_sys_close(_thread_kern_pipe[0]);
- _thread_sys_close(_thread_kern_pipe[1]);
+ __sys_close(_thread_kern_pipe[0]);
+ __sys_close(_thread_kern_pipe[1]);
/*
* Enter a loop to set all file descriptors to blocking
@@ -68,9 +70,9 @@ _execve(const char *name, char *const * argv, char *const * envp)
if (_thread_fd_table[i] != NULL &&
!(_thread_fd_table[i]->flags & O_NONBLOCK)) {
/* Get the current flags: */
- flags = _thread_sys_fcntl(i, F_GETFL, NULL);
+ flags = __sys_fcntl(i, F_GETFL, NULL);
/* Clear the nonblocking file descriptor flag: */
- _thread_sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK);
+ __sys_fcntl(i, F_SETFL, flags & ~O_NONBLOCK);
}
}
@@ -94,19 +96,16 @@ _execve(const char *name, char *const * argv, char *const * envp)
act.sa_flags = _thread_sigact[i - 1].sa_flags;
/* Change the signal action for the process: */
- _thread_sys_sigaction(i, &act, &oact);
+ __sys_sigaction(i, &act, &oact);
}
}
/* Set the signal mask: */
- _thread_sys_sigprocmask(SIG_SETMASK, &_thread_run->sigmask, NULL);
+ __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
/* Execute the process: */
- ret = _thread_sys_execve(name, argv, envp);
+ ret = __sys_execve(name, argv, envp);
/* Return the completion status: */
return (ret);
}
-
-__strong_reference(_execve, execve);
-#endif
OpenPOWER on IntegriCloud