Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2000 10:17:53 -0500
From:      "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com>
To:        "'Bruce Evans'" <bde@zeta.org.au>
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:  <E598F159668DD311B9C700902799EAF4473379@njb140po01.ems.att.com>

next in thread | raw e-mail | index | archive | help
Bruce,

[...]

> > 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?
> 
> I think it is a bug.  Perhaps applications depend on it.
> 
> Untested fix:

[ 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? 

I have small problem with blocking read in pthreads under 3.X. Since
blocking read implemented as non-blocking inside pthread (libc_r to be
honest), returning 0 instead of EAGAIN from read confuses libc_r. It 
expects EAGAIN. 

BTW such "blocking" read inside thread gives almost 100% CPU utilization :(

thanks,

emax


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?E598F159668DD311B9C700902799EAF4473379>