Date: Thu, 18 Nov 1999 10:30:01 -0800 (PST) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/14979: select/poll handler for fifo is broken in FreeBSD-3.X Message-ID: <199911181830.KAA17906@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/14979; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: seva@mtelecom.ru Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: kern/14979: select/poll handler for fifo is broken in FreeBSD-3.X Date: Fri, 19 Nov 1999 05:26:42 +1100 (EST) > >Description: > > when fifo (maden by mkfifo(1)) has select(2)ed or poll(2)ed > select(2) and poll(2) returns without timeout even > fifo has no bytes to read. > > In FreeBSD 2.X and NetBSD 1.4.1 there is timeout as expected. I think the timeout is unexpected. read() on a fifo with no writers was broken in FreeBSD-2.x. I fixed this, and the select() and poll() behaviour changed automatically to match the read() behaviour. Some details: POSIX.1 requires read() on a fifo with no writers to return 0 without blocking. FreeBSD-2.x did extra work to break this in some cases. IIRC, the only broken case was for fifos that never had a writer. POSIX doesn't distinguish this case. Sockets have flags to control the behaviour precisely, but these are not available for fifos. select() and poll() return immediately because there is an interesting state to read, namely EOF. At least some versions of Linux and Sunos have special handling for select() on fifos. I think they break select() to do what you want. 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?199911181830.KAA17906>