Re: [PATCH v2 1/4] posix_spawn.3: Document implementation using clone() since glibc 2.24

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 16/10/2018 16:37, 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 glibc 2.24.
> 
> This patch makes a distinction in the manual page between glibc 2.24 and
> older versions.
> 
> Upstream commit in glibc.git:
> 
>   9ff72da471 posix: New Linux posix_spawn{p} implementation
> 
> Signed-off-by: Olivier Gayot <olivier.gayot@xxxxxxxxxxx>

LGTM.

> ---
>  man3/posix_spawn.3 | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/man3/posix_spawn.3 b/man3/posix_spawn.3
> index 3e1e9011c..e8c0de172 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)
> @@ -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
> @@ -527,13 +536,14 @@ only the POSIX-specified functions.
>  although these objects may be implemented as structures containing fields,
>  portable programs must avoid dependence on such implementation details.)
>  .PP
> -According to POSIX, it unspecified whether fork handlers established with
> +According to POSIX, it is unspecified whether fork handlers established with
>  .BR pthread_atfork (3)
>  are called when
>  .BR posix_spawn ()
>  is invoked.
> -On glibc,
> +Since glibc 2.24, the fork handlers are not executed in any case.
>  .\" Tested on glibc 2.12
> +On older implementations,
>  fork handlers are called only if the child is created using
>  .BR fork (2).
>  .PP
> 



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux