3 ms·
posix_spawn() actually uses fork() internally, not clone(), as far as that distinction is possible to make. Both fork() and clone() are implemented with the sam
by klodolph 7y ago
posix_spawn() actually uses fork() internally, not clone(), as far as that distinction is possible to make. Both fork() and clone() are implemented with the same kernel entry point, which is called "clone".
Here is the relevant line in glibc:
https://github.com/bminor/glibc/blob/b5b7fb76e15c0db545aa11a3ce88f836e5d01a19/sysdeps/posix/spawni.c#L303 https://github.com/bminor/glibc/blob/b5b7fb76e15c0db545aa11a...
Errors are returned as the function return value.
- tyingq 7y agohttps://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/spawni.c#L36 https://github.com/bminor/glibc/blob/master/sysdeps/unix/sys... "The Linux implementation of posix_spawn{p} uses the clone syscall directly with CLONE_VM and CLONE_VFORK flags..." Though you're right about errno, line 305.