[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: Alejandro Colomar
Subject: [bug #63070] posix_spawn fails to run a child process.
Date: Wed, 21 Sep 2022 05:46:55 -0400 (EDT)

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

[comment #10 comment #10:]
> In glibc-2.17 posix_spawn returns 0 whether POSIX_SPAWN_USEVFORK is set or
> When POSIX_SPAWN_USEVFORK is not set posix_spawn returns 0 and errno is 0.
> When POSIX_SPAWN_USEVFORK is set posix_spawn returns 0 and errno is

Hi Dmitry,

If the function is returning 0, there's no error, and errno shouldn't be read
however, posix_spawn(3) is a bit special on that, and it may still fail with a
return code of 0; continue reading).

I guess you maybe didn't state it here as obvious, but to me it's not by
reading the conversation: Apart from posix_spawn(3) returning 0 and setting
errno to ENOEXEC, I guess you're seeing something else, such as a child
returning 127?

If so, I think I understand the problem you're trying to explain.

Otherwise, glibc is allowed to set errno without failing, and you shouldn't be
reading errno as it's meaningless.

       Upon    successful    completion,    posix_spawn()    and
       posix_spawnp() place the PID of the child process in pid,
       and  return  0.   If  there is an error during the fork()
       step, then no child is created, the contents of *pid  are
       unspecified,  and  these functions return an error number
       as described below.

       Even when these functions return a  success  status,  the
       child  process  may  still fail for a plethora of reasons
       related to its pre-exec() initialization.   In  addition,
       the  exec(3)  may fail.  In all of these cases, the child
       process will exit with the exit value of 127.



Reply to this item at:


Message sent via Savannah

reply via email to

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