public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nachms+sourceware at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/18433] posix_spawn does not return correctly upon failure to execute Date: Sat, 12 Sep 2015 19:03:00 -0000 [thread overview] Message-ID: <bug-18433-131-oN9i3pzuFp@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-18433-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=18433 --- Comment #3 from Nach M. S. <nachms+sourceware at gmail dot com> --- Note the return value (emphasis included): Upon successful completion, posix_spawn() and posix_spawnp() shall return the process ID of the child process to the parent process, in the variable pointed to by a non-NULL pid argument, and shall return zero as the function return value. Otherwise, no child process shall be created, the value stored into the variable pointed to by a non-NULL pid is unspecified, ***and an error number shall be returned as the function return value to indicate the error***. If the pid argument is a null pointer, the process ID of the child is not returned to the caller. You are correct that the standard allows to exit with 127, however it discourages that behavior and says only if the library is unable to detect all issues is it okay to do so. I can't speak for other platforms, but it is perfectly possible to implement this function in a library on Linux in a feature-complete fashion. FreeBSD, NetBSD, and musl-libc (Linux) at the library level are all capable of detecting the errors and properly returning them without any special kernel supports. I've also implemented this function on Linux correctly and feature-complete with proper error handling, and it's not really a big deal to do so. Using any simple form of IPC, the error can be returned from the child to the parent. The BSDs use vfork() with a variable that the child modifies and the parent looks at. musl-libc uses a pipe. Personally, I recommend the latter approach. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2015-09-12 19:03 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-05-19 20:34 [Bug libc/18433] New: " nachms+sourceware at gmail dot com 2015-06-05 9:41 ` [Bug libc/18433] " fweimer at redhat dot com 2015-09-10 14:25 ` rahimi.nv at gmail dot com 2015-09-10 18:20 ` pb at pbcl dot net 2015-09-12 19:03 ` nachms+sourceware at gmail dot com [this message] 2015-09-12 20:56 ` rahimi.nv at gmail dot com 2015-09-12 21:00 ` rahimi.nv at gmail dot com 2015-09-12 21:07 ` rahimi.nv at gmail dot com 2015-09-13 12:15 ` rahimi.nv at gmail dot com 2021-07-26 19:03 ` vtjnash at gmail dot com 2021-07-26 19:33 ` adhemerval.zanella at linaro dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-18433-131-oN9i3pzuFp@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).