4 ms·
Posix_spawn on Linux uses the clone() system call, and passes a pointer called args. Errors come back at args.err
by tyingq 7y ago
Posix_spawn on Linux uses the clone() system call, and passes a pointer called args. Errors come back at args.err
- klodolph 7y agoposix_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.