On Wed, 26 Jan 2000, Yevmenkin, Maksim N, CSCIO wrote:
> > > I've just found that read from /dev/bpfX never return
> > EAGAIN/EWOULDBLOCK.
> > > It means that when you do a non blocking read and there is
> > no data you will
> > > always get 0.
> [ untested fix removed :) ]
>
> Yes, it works. But it returns EAGAIN for both O_RDONLY|O_NONBLOCK and
> O_RDWR|O_NONBLOCK open modes. In the same time pipe returns 0 for
> O_RDONLY|O_NONBLOCK mode and EAGAIN for O_RDWR|O_NONBLOCK.
>
> It there any specs for "read" system call?
Well, POSIX is very complete for read() on regular files and pipes (both
ordinary pipes and fifos. read() on a pipe with no data and writers
returns 0 because that case is considered to be EOF. O_RDWR for fifos
gives undefined behaviour. I don't know of any legitimate use for it.
It has the illegitimate use of talking to oneself using only one channel
:-). This gives the EAGAIN behaviour for O_RDWR|O_NONBLOCK.
Bruce
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message