aio vs non-blocking-io

Maxim Dounin mdounin at
Mon Dec 12 10:09:17 UTC 2011


On Sun, Dec 11, 2011 at 06:58:57PM -0500, double wrote:

> Is there a chance to use non-blocking-io with nginx?
> AIO is quite broken on Linux, but "O_NONBLOCK" is not.

Does O_NONBLOCK works on Linux for regular files?  If yes, where 
is sematics defined?

POSIX says behaviour of O_NONBLOCK on regular files is 
unspecified, and it's indeed impossible to use O_NONBLOCK on 
regular files with POSIX interfaces: there is no way to schedule 
read operation and there is no way to find out if I/O possible 
(select()/poll() always return regular files as ready for 
reading/writing as per POSIX).

Maxim Dounin

More information about the nginx mailing list