On 15/10/2018 17:01, Olivier Gayot wrote: > Since glibc 2.24, the use of posix_spawn (2) makes an unconditional call > to clone(CLONE_VM | CLONE_VFORK ...) rather than relying on fork (2) or > vfork (2). > > As a consequence, the statements regarding the use of the flag > POSIX_SPAWN_USEVFORK and how the function decides whether it should use > fork (2) or vfork (2) are obsolete since this glibc 2.24. > > This patch makes a distinction in the manual page between glibc 2.24 and > older versions. Thanks for following this up. Since you updating posix_spawn{p} documentation I think it is worth to mention that POSIX_SPAWN_SETSID has been accepted by POSIX [1] and it has been implemented on glibc since 2.26 (daeb1fa2e1b33). [1] http://austingroupbugs.net/view.php?id=1044 > > Upstream commit in glibc.git: > > 9ff72da471 posix: New Linux posix_spawn{p} implementation Should we make explicit that for glibc 2.24+ POSIX_SPAWN_USEVFORK is a noop? > > Signed-off-by: Olivier Gayot <olivier.gayot@xxxxxxxxxxx> > --- > man3/posix_spawn.3 | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/man3/posix_spawn.3 b/man3/posix_spawn.3 > index 3e1e9011c..9cc5a63d5 100644 > --- a/man3/posix_spawn.3 > +++ b/man3/posix_spawn.3 > @@ -155,9 +155,16 @@ and the > .BR exec () > step (executed in the child). > .SS fork() step > -The > +Since glibc 2.24, the > .BR posix_spawn () > function commences by calling > +.BR clone (2) > +with > +.BR CLONE_VM > +and > +.BR CLONE_VFORK > +flags. > +Older implementations use > .BR fork (2), > or possibly > .BR vfork (2) Although there is a note below that atfork handlers are only executed if posix_spawn{p} use fork, maybe make explicit that for GLIBC 2.24 they won't be execute in any case? > @@ -176,7 +183,7 @@ If the child fails in any of the housekeeping steps described below, > or fails to execute the desired file, > it exits with a status of 127. > .PP > -The child process is created using > +Before glibc 2.24, the child process is created using > .BR vfork (2) > instead of > .BR fork (2) > @@ -480,14 +487,16 @@ The > and > .BR posix_spawnp () > functions fail only in the case where the underlying > -.BR fork (2) > -or > +.BR fork (2), > .BR vfork (2) > +or > +.BR clone (2) > call fails; in these cases, these functions return an error number, > which will be one of the errors described for > -.BR fork (2) > +.BR fork (2), > +.BR vfork (2) > or > -.BR vfork (2). > +.BR clone (2). > .PP > In addition, these functions fail if: > .TP >