Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2000 04:30:04 -0700 (PDT)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   RE: gnu/19871: select bug on named pipes
Message-ID:  <200007171130.EAA79255@freefall.freebsd.org>

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

The following reply was made to PR kern/19871; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: John Baldwin <jhb@FreeBSD.ORG>
Cc: sheldonh@FreeBSD.ORG
Subject: RE: gnu/19871: select bug on named pipes
Date: Sat, 15 Jul 2000 21:40:08 +1000 (EST)

 On Fri, 14 Jul 2000, John Baldwin wrote:
 
 >  On 14-Jul-00 Sheldon Hearn wrote:
 >  > Since you've had your fingers in the select code recently, could you    
 >  > perhaps check out PR gnu/19871?  (The gnu is inaccurate; the originator 
 >  > meant for it to be kern). :-)
 >  
 >  Umm, well, I'm not _that_ familiar with the code, but I could look at
 >  it I guess.
 
 I fixed read() to on an empty fifo with no writers to conform with
 POSIX.  POSIX requires it to return successfully without blocking.
 In 4.4BSD it has some brokenness related to giving behaviour like the
 author of the PR wants.  select() on read descriptors open on fifos
 just returns when a !O_NONBLOCK read() on one of them would return
 successfully without blocking.  This is always the case for reads on
 a fifo with no writers.  Linux's select() handles fifos specially so
 that select() doesn't just follow read().
 
 SUSv2 specifies select() but doesn't seem to specify anything special
 for pipes.  Therefore, the FreeBSD behaviour is a feature :-).  ISTR
 a previous FR (maybe not in gnats) about this.
 
 FreeBSD has some related bugs in poll().  It only implements POLLHUP for
 ttys and nameless pipes.  Under Linux, POLLHUP is set for polls on a
 fifo with no writers if there was a writer in the (immediately?) previous
 generation, and read-select() checks POLLHUP.  This is necessary to
 give the correct behaviour for read-select() on a fifo whose last writer
 recently went away (select() must not block in this case).
 
 This should be fixed by someone who understands sockets a bit better than
 me.  Named pipes are implemented as sockets, and some of the bugs may be
 for sockets generally.  I think POLLHUP should be set when a socket is
 disconnected...
 
 Bruce
 
 
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007171130.EAA79255>