Re: O_NONBLOCK, read(), select(), NFS, Ext2, etc.
Alexander V. Lukyanov (lav@yars.free.net)
Fri, 12 Jan 2001 19:34:38 +0300
- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: J . A . Magallon: "Re: Linux 2.4.0-ac8"
- Previous message: Eric W. Biederman: "Re: Subtle MM bug"
- In reply to: Alan Cox: "Re: O_NONBLOCK, read(), select(), NFS, Ext2, etc."
- Next in thread: Michael Rothwell: "Re: O_NONBLOCK, read(), select(), NFS, Ext2, etc."
On Fri, Jan 12, 2001 at 09:40:55AM +0000, Alan Cox wrote:
> > be true; but perhaps I am doing something wrong. If I open() a file (on
> > 2.2.18) from a floppy or NFS mount (to test in a slow environment) with
> > O_NONBLOCK|O_RDONLY, read() will still block. If I try to select() on
> > the file descriptor, select() always returns 0.
>
> The definition of immediate is not 'instant'. Otherwise no I/O system would
> ever return anything but -EWOULDBLOCK. Its that it won't wait when there is
> no data pending. On a floppy there is always data pending
I have a long standing idea on modifying poll/read/write behavior on
regular files opened in O_NONBLOCK mode. How about the following scheme:
* poll returns POLLIN/POLLOUT on regular files only if the data are
in buffer cache/there is room for write().
* read returns EAGAIN if the data are not in buffer cache.
* write returns EAGAIN if there is no room (yet) to store the data.
All the operation should signal to IO subsystem that the data are
needed in cache/the room has to be freed.
--
Alexander.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
- Next message: J . A . Magallon: "Re: Linux 2.4.0-ac8"
- Previous message: Eric W. Biederman: "Re: Subtle MM bug"
- In reply to: Alan Cox: "Re: O_NONBLOCK, read(), select(), NFS, Ext2, etc."
- Next in thread: Michael Rothwell: "Re: O_NONBLOCK, read(), select(), NFS, Ext2, etc."