From owner-freebsd-bugs Thu Nov 18 10:30: 4 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id A33E915484 for ; Thu, 18 Nov 1999 10:30:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA17906; Thu, 18 Nov 1999 10:30:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Date: Thu, 18 Nov 1999 10:30:01 -0800 (PST) Message-Id: <199911181830.KAA17906@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/14979: select/poll handler for fifo is broken in FreeBSD-3.X Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/14979; it has been noted by GNATS. From: Bruce Evans 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