From owner-freebsd-bugs Tue Oct 16 2:40: 5 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 595E337B40B for ; Tue, 16 Oct 2001 02:40:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9G9e2084369; Tue, 16 Oct 2001 02:40:02 -0700 (PDT) (envelope-from gnats) Date: Tue, 16 Oct 2001 02:40:02 -0700 (PDT) Message-Id: <200110160940.f9G9e2084369@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/19871 select on named pipes always returns 'available for reading' Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/19871; it has been noted by GNATS. From: Bruce Evans To: Thomas Quinot Cc: , , Subject: Re: kern/19871 select on named pipes always returns 'available for reading' Date: Tue, 16 Oct 2001 19:30:17 +1000 (EST) On Tue, 16 Oct 2001, Thomas Quinot wrote: > I was bitten by this one last night... > > While the interpretation of the POSIX definition for select(2) that > concludes the current FreeBSD behaviour is legal, it may be worth noting > that Solaris, Irix, AIX, Linux all disagree with us. (On the other hand, > DEC Unix agrees). Did any of them document this behaviour? > Moreover, the current behaviour means that there is no way of waiting > for writers to appear on a FIFO with a select. The only possible way > to do that is to have a dedicated thread blocked in !O_NONBLOCK read. True. I think it should be possible to select() or poll() on an exceptional condition. > I would therefore respectfully suggest that we review our implementation > against the standard (I'll try to grab the copy in the next office later > today :) ) and see if we can change our current behaviour. I just checked POSIX-1.200x-draft 7. It specifies select() but specify any special behaviour for select() on pipes or sockets other than it shall work. It just says that select() returns if one of the read descriptors is "ready to read". It doesn't seem to define "ready to read", of course %-(. So my argment for the current behaviour is unchanged. The draft specifies some special behaviour for poll() on sockets but not on pipes. It says that poll() returns if "data can be read" from one of the read descriptors. It also says that "A file descriptor for a socket that is listening for connections shall indicate that it is ready for reading, once connections are available". This corresponds to the blocking waiting for writers behaviour that you want. But it also seems to imply returning when a writer appears, whether or not there is anything to read. This seems wrong. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message