git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Q] what to do when waitpid() returns ECHILD under signal(SIGCHLD, SIG_IGN)?

From
Linus Torvalds <torvalds@osdl.org>
Date
Jun 19, 2006, 23:57 UTC
Message-ID
<Pine.LNX.4.64.0606191654590.5498@g5.osdl.org>
In-Reply-To
<7vwtbc7ll6.fsf@assigned-by-dhcp.cox.net>
On Mon, 19 Jun 2006, Junio C Hamano wrote:
Show 5 quoted lines
>
> Somebody I met last week in Japan reported that the socks client
> he uses to cross the firewall to connect to git:// port from his
> company environment seems to do signal(SIGCHLD, SIG_IGN) before
> spawning git.
Ok, that sounds pretty broken of it.
> We could work this around by having signal(SIGCHLD, SIG_DFL)
> upfront in git.c::main(), but I am wondering what the standard
> practice for programs that use waitpid() call.

We need the status return, so failing on getting ECHILD is absolutely the right thing to do, because it implies that we don't know what the status could have been.

So we need to reset SIGCHLD back to SIG_DFL (or catch it explicitly).

Whether we want to do that in the main() routine or when we actually do the fork() or whatever is a different issue.

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 7 in “[Q] what to do when waitpid() returns ECHILD under signal(SIGCHLD, SIG_IGN)?”
  1. Junio C HamanoJun 19, 2006
  2. Linus TorvaldsJun 19, 2006
  3. Junio C HamanoJun 20, 2006
  4. Linus TorvaldsJun 20, 2006
  5. Restore SIGCHLD to SIG_DFL where we care about waitpid().Junio C Hamano, Jun 20, 2006
  6. Petr BaudisJun 20, 2006
  7. Edgar ToernigJun 20, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.