RE: BPF bug or not?

2000-01-26 Thread Bruce Evans

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



BPF bug or not?

2000-01-24 Thread Yevmenkin, Maksim N, CSCIO

All,

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.

Does it suppose work this way?

A non blocking read from pipe return EAGAIN/EWOULDBLOCK if there is no data
and
pipe was opened as O_RDWR, and 0 when pipe was opened as O_RDONLY.

Thanks,
emax


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message