Cathey, Jim wrote:
Upon reflection, I think that O_NONBLOCK should
NEVER have an effect on read/write. Polling should
be done either old-school (for ttys) by VMIN/VTIME,
or by poll/select, or via AIO facilities, none of
which have anything to do with modes on the FD.
(OK, ICANON and VMIN/VTIME are grandfathered.)
I don't think select/poll by itself is a reliable way in general to do this,
although it might be good enough for a tty (provided that nobody else
gets in
between the select() and the read() and steals your data). The
Linux select(2) man page says this:
Under Linux, select() may report a socket file descriptor as "ready
for reading", while nevertheless a subsequent read blocks. This could
for example happen when data has arrived but upon examination has wrong
checksum and is discarded. There may be other circumstances in which a
file descriptor is spuriously reported as ready. Thus it may be safer
to use O_NONBLOCK on sockets that should not block.
--Doug
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox