Subject: Re: Implementation question
To: None <tech-kern@netbsd.org>
From: Hans Petter Selasky <hselasky@c2i.net>
List: tech-kern
Date: 04/11/2006 16:48:40
On Tuesday 11 April 2006 15:10, Cherry G. Mathew wrote:
> On 4/11/06, Steven M. Bellovin <smb@cs.columbia.edu> wrote:
> > In all Unix drivers I've ever looked at, read calls block in the driver
> > if there's no data available.  The interrupt routine would wake the
> > sleeping process, which would then copy the data to userspace and return.
>
> Doesn't the driver have the option of returning EAGAIN, especially if
> the process doesn't want to sleep on a read ?
>

There is an ioctl that is called FIONBIO, that can set non-blocking mode. Then 
the kernel driver returns EWOULDBLOCK on read/write if it wants to sleep.

--HPS