posix_spawn(): errno in older glibc versions

Felipe Gasper felipe@felipegasper.com
Mon Mar 4 01:46:00 GMT 2019


> On Mar 3, 2019, at 6:01 PM, Felipe Gasper <felipe@felipegasper.com> wrote:
> 
> How, then, does the new posix_spawn() pass the child’s errno back to the parent? Does it violate the above--assumedly with some assurance that what it’s doing is, in fact, safe?

Quick follow-up to the above:

The clone()d process (which is a CLONE_VFORK) also, per strace, does a whole mess of signal-setting prior to the execve(). This also appears to violate vfork()’s documentation.

Also, at least on the Ubuntu box, posix_spawn()’s man page appears to be incorrect:

-----
       The  posix_spawn()  and  posix_spawnp() functions fail only in the case
       where the underlying fork(2) or vfork(2) call fails;  in  these  cases,
       these functions return an error number, which will be one of the errors
       described for fork(2) or vfork(2).
-----

>From what I see, the clone() clearly succeeds, but it’s the exec’s success/failure that posix_spawn() reports. This is much more useful behavior, IMO--does that just need to make its way into the man page?

Thank you!

-FG



More information about the Libc-help mailing list