diff options
Diffstat (limited to 'libc/sysdeps')
-rw-r--r-- | libc/sysdeps/linux/common/vfork.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/vfork.c b/libc/sysdeps/linux/common/vfork.c index a70ed4a63..a85156d38 100644 --- a/libc/sysdeps/linux/common/vfork.c +++ b/libc/sysdeps/linux/common/vfork.c @@ -10,7 +10,24 @@ # include <unistd.h> extern __typeof(vfork) __vfork attribute_hidden; -# ifdef __NR_vfork +# if defined __NR_clone && !defined __NR_vfork +# include <signal.h> +# include <sys/types.h> + +pid_t __vfork(void) +{ + pid_t pid = INLINE_SYSCALL(clone, 4, SIGCHLD, + NULL, NULL, NULL); + + if (pid < 0) + return -1 + + return pid; +} +weak_alias(__vfork, vfork) +libc_hidden_weak(vfork) + +# elif defined __NR_vfork # define __NR___vfork __NR_vfork _syscall0(pid_t, __vfork) # else |