Files
semi-libc/src/process/vfork.c
T
Rich Felker ced75472d7 remove __vfork alias
this was added so that posix_spawn and possibly other functionality
could be implemented in terms of vfork, but that turned out to be
unsafe. any such usage needs __clone with proper handling of stack
lifetime.
2018-09-12 14:34:37 -04:00

15 lines
248 B
C

#define _GNU_SOURCE
#include <unistd.h>
#include <signal.h>
#include "syscall.h"
pid_t vfork(void)
{
/* vfork syscall cannot be made from C code */
#ifdef SYS_fork
return syscall(SYS_fork);
#else
return syscall(SYS_clone, SIGCHLD, 0);
#endif
}