bug-make
[Top][All Lists]
Advanced

[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
https://man7.org/linux/man-pages/man3/posix_spawn.3.html
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
          POSIX_SPAWN_SETSIGMASK, POSIX_SPAWN_SETSIGDEF,
          POSIX_SPAWN_SETSCHEDPARAM, POSIX_SPAWN_SETSCHEDULER,
          POSIX_SPAWN_SETPGROUP, or POSIX_SPAWN_RESETIDS.
----

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:

  <https://savannah.gnu.org/bugs/?63070>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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