Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jan 2000 16:35:16 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com>
Cc:        "'freebsd-current@freebsd.org'" <freebsd-current@FreeBSD.ORG>, "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG>
Subject:   RE: BPF bug or not?
Message-ID:  <Pine.BSF.4.21.0001271616020.4709-100000@alphplex.bde.org>
In-Reply-To: <E598F159668DD311B9C700902799EAF4473379@njb140po01.ems.att.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0001271616020.4709-100000>