Date: Tue, 16 Oct 2001 02:40:02 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/19871 select on named pipes always returns 'available for reading' Message-ID: <200110160940.f9G9e2084369@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: Thomas Quinot <thomas@cuivre.fr.eu.org> Cc: <freebsd-gnats-submit@freebsd.org>, <jhb@freebsd.org>, <sheldonh@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110160940.f9G9e2084369>