Nonblocking I/O and POLL_BUG

Per Hedeland per at erix.ericsson.se
Mon Oct 25 22:08:48 UTC 1999


Dan Merillat wrote:
>Actually, I may be wrong but it's possible to be interrupted by a signal
>even on a "fast" read, no?

Interesting question:-) - I would definitely say "no", but the Solaris
2.6 read(2) man page makes no such promise, and combining it with
sigaction(2) it would seem that not only can they be interrupted, but
you can't even get them to restart with SA_RESTART, as that only applies
to "slow" reads...:-) I do think this is an omission in the read(2)
page, though.

But anyway that should give EINTR or a "short" read, depending on how
far it had progressed, so I don't think that's directly relevant. Disk
write(2)s have certainly been known to give EAGAIN on some versions of
Solaris under some circumstances, though. (I don't know what those
circumstances are, but I've seen it happen.)

>  I've coded my select/poll loops in such a way as
>to treat -EAGAIN as a non-error, but lately I've put a spin counter in.

Probably wise - as I wrote you should never get it on the first read
(on the right descriptor:-) after select/poll, though in some cases it
may make sense to keep reading until you get it.

--Per Hedeland
per at erix.ericsson.se


More information about the inn-workers mailing list