[Top][All Lists]

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

[bug #63070] posix_spawn fails to run a child process.

From: Dmitry Goncharov
Subject: [bug #63070] posix_spawn fails to run a child process.
Date: Sun, 18 Sep 2022 15:20:52 -0400 (EDT)

Follow-up Comment #5, bug #63070 (project make):

posix_spawn calls either vfork of spawn.
On glibc-2.17 i observed that when posix_spawn calls vfork the return code is
zero, but errno is set to ENOEXEC.
When posix_spawn calls spawn, both return code and errno are zero.

This man page
describes when vfork is called.
This is a quote

       Before glibc 2.24, the child process is created using vfork(2)
       instead of fork(2) when either of the following is true:

       *  the spawn-flags element of the attributes object pointed to by
          attrp contains the GNU-specific flag POSIX_SPAWN_USEVFORK; or

       *  file_actions is NULL and the spawn-flags element of the
          attributes object pointed to by attrp does not contain

Make specifies POSIX_SPAWN_USEVFORK, when avaiable, and this allows the patch
to help.
The patch cannot not help some version of glibc which lacks
POSIX_SPAWN_USEVFORK and returns 0 and keeps errno intact.
So, i updated the patch to check for ___GLIBC___ at configure time and disable
posix_spawn, unless POSIX_SPAWN_USEVFORK is available. This check should not
affect modern versions of glibc, they have POSIX_SPAWN_USEVFORK.
Tested on glibc-2.17, glibc-2.32 and sun os.


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]