Subject: Re: Why does read() block on I/O error?
To: Michael Core <>
From: Jaromir Dolecek <>
List: current-users
Date: 07/09/2002 09:16:39
O_NONBLOCK has only effect on IPC descriptors, like sockets and
pipes. It doesn't have any effects for file descriptors.


Michael Core wrote:
> Hi,
> I have some badly burned cd-roms. When I want to read a file from it and
> set the fd to O_NONBLOCK read() does still block for a few seconds.
> Shouldn't read() return something like EAGAIN instead? Of course, read()
> reports the I/O error but I would prefer if it returned _immediately_
> with EAGAIN or EIO. Otherwise you cannot trust O_NONBLOCK at all.
> Perhaps I just don't understand O_NONBLOCK.
> Michael

Jaromir Dolecek <>
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-