From owner-freebsd-current Wed Jan 26 21:35:34 2000 Delivered-To: freebsd-current@freebsd.org Received: from gidora.zeta.org.au (gidora.zeta.org.au [203.26.10.25]) by hub.freebsd.org (Postfix) with SMTP id DB87315418 for ; Wed, 26 Jan 2000 21:35:23 -0800 (PST) (envelope-from bde@zeta.org.au) Received: (qmail 19595 invoked from network); 27 Jan 2000 05:35:20 -0000 Received: from bde.zeta.org.au (203.2.228.102) by gidora.zeta.org.au with SMTP; 27 Jan 2000 05:35:20 -0000 Date: Thu, 27 Jan 2000 16:35:16 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: "Yevmenkin, Maksim N, CSCIO" Cc: "'freebsd-current@freebsd.org'" , "'freebsd-hackers@freebsd.org'" Subject: RE: BPF bug or not? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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-current" in the body of the message