diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-09-14 15:32:51 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-09-14 15:32:51 -0400 |
commit | d62f4e98881702f07501b965e5beebd7516deca2 (patch) | |
tree | 21d1079dc4b61757f740bfd2c1a2d0d522331b30 /src/process | |
parent | e2f6a3257e256ac26a755fb58290ceb1b839fa20 (diff) | |
download | musl-d62f4e98881702f07501b965e5beebd7516deca2.tar.gz musl-d62f4e98881702f07501b965e5beebd7516deca2.tar.xz musl-d62f4e98881702f07501b965e5beebd7516deca2.zip |
use vfork if possible in posix_spawn
vfork is implemented as the fork syscall (with no atfork handlers run) on archs where it is not available, so this change does not introduce any change in behavior or regression for such archs.
Diffstat (limited to 'src/process')
-rw-r--r-- | src/process/posix_spawn.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c index 1120be08..604756e9 100644 --- a/src/process/posix_spawn.c +++ b/src/process/posix_spawn.c @@ -8,6 +8,8 @@ extern char **environ; +pid_t __vfork(void); + int __posix_spawnx(pid_t *restrict res, const char *restrict path, int (*exec)(const char *, char *const *), const posix_spawn_file_actions_t *fa, @@ -22,7 +24,7 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path, if (!attr) attr = &dummy_attr; sigprocmask(SIG_BLOCK, (void *)(uint64_t []){-1}, &oldmask); - pid = __syscall(SYS_fork); + pid = __vfork(); if (pid) { sigprocmask(SIG_SETMASK, &oldmask, 0); |