[PATCH] ash: clear NONBLOCK flag from stdin when in foreground

Rich Felker dalias at aerifal.cx
Fri Aug 19 14:53:06 UTC 2011


On Fri, Aug 19, 2011 at 11:36:43AM +0200, Bernd Petrovitsch wrote:
> On Fre, 2011-08-19 at 06:55 +0200, Denys Vlasenko wrote:
> > On Thursday 18 August 2011 07:34, Laurent Bercot wrote:
> > > > It doesn't; it can't.  Hence my ranting.  A 100% safe
> > > > 100% orthogonal, useful easy-to-use AIO mechanism should
> > > > have been designed
> > > 
> > >  Would the hypothetical nonblock_read() and nonblock_write() system
> > > calls suggested at http://cr.yp.to/unix/nonblock.html be a good
> > > enough design, or do you think something more is needed ?
> > 
> > Yes. But this requires new syscalls. And we might need more flags
> > (such as "don't generate SIGPIPE"), so the new syscalls should be
> 
> Hmm, am I the only one where one of the first lines in almost all
> daemons ignores SIG_PIPE?

Yes and no. I don't ignore it explicitly but rather:

sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, 0);
sigemptyset(&set);
sigaddset(&set, SIGTERM); /* and any others I want to handle */
sigprocmask(SIG_UNBLOCK, &set, 0);

This is a lot more robust.

Rich


More information about the busybox mailing list