tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: system(3) semantics when SIGCHLD is SIG_IGN'd



> What should system(3) do when the signal action for SIGCHLD is
> SIG_IGN, or has SA_NOCLDWAIT set?

Exec GNU emacs running the Towers of Hanoi? :-)

Figuring out whether you (=NetBSD) want it to "work" is, it seems to
me, the first priority.  I'm not sure where I fall on that question.
On the one hand, having system(3) work in more programs is arguably a
win.  On the other, having nonportable code rendered obviously broken
is _also_ arguably a win.

>     If the calling process has SA_NOCLDWAIT set or has SIGCHLD set to
>     SIG_IGN, [...]

Check my understanding: this applies to wait(2), but not alternatives
like waitpid(2) or wait4(2), right?

Then, if you want system(3) to "work", maybe it would be better to
have it use something like one of those to wait for exactly and only
the child it cares about, and, if that does the wrong thing when
SIGCHLD is ignored or SA_NOCLDWAIT is set (I haven't checked), either
change it or provide a flag bit in the options argument to change it?

> So, should we do anything about this in system(3)?

> Cons:
> [...]
> - Changing signal actions has the side effect of clearing the signal
>   queue, and I don't see a way around that.

But is changing the signal action the only way to make system(3)
"work"?  I'm not convinced it is.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index