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

Bernd Petrovitsch bernd at petrovitsch.priv.at
Tue Aug 23 11:56:04 UTC 2011


On Sam, 2011-08-20 at 23:26 +0200, Denys Vlasenko wrote:
[...]
> Guys, can you semd emails to lkml and advocate for recv/send to be enabled
> for non-sockets?
> 
> I mean: every once in a while someone again gets bitten by
> fcntl(O_NONBLOCK), bitches about it, tries to work around it
> in userspace (as the thread starter did), and eventually gives up,
> leaving API unfixed. This repeats ad nauseum, because the problem
> is not critical enough and generally can be lived with.
> 
> We need to make more noises on the *kernel ml* about it
> if we want to ever have non-racy nonblocking read and write.
> 
> My last attempt was here:
> 
> https://lkml.org/lkml/2007/8/14/135
> 
> https://lkml.org/lkml/2007/8/19/43
> 
> I guess a better kernel patch would really help a lot, mine was
> a very dirty hack...

FullACK;-)

It gets now somewhat off-topic, but:

Ignoring all possible efforts and work, isn't the (best?) solution to
a) add a recv() and send() function pointer to struct file_ops similar
   to read() and write() with an additional flags parameter.
b) used recv()/send() in the core if available. Otherwise use the
   read()/write() ones (like now).
c) move all read() and write() implementations to the recv() and send()
   killing all uses uses of filp->f_flags in the drivers.
d) teach checkpatch at al. that.
e) Remove the read() and write() function pointer.

Not that I ever touched the VFS or other parts from Al-Viro country ...

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at



More information about the busybox mailing list