Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Oct 2001 06:39:05 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Bill Fenner <fenner@research.att.com>
Cc:        <rwatson@FreeBSD.ORG>, <bright@mu.org>, <arch@FreeBSD.ORG>
Subject:   Re: Behavior of select() on pipes
Message-ID:  <20011027061249.K89650-100000@delplex.bde.org>
In-Reply-To: <200110252343.QAA28072@windsor.research.att.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 25 Oct 2001, Bill Fenner wrote:

> IEEE Std 1003.1-200x says, about select:
>
> 	A descriptor shall be considered ready for reading when a call
> 	to an input function with O_NONBLOCK clear would not block,
> 	whether or not the function would transfer data successfully.

Good.  I couldn't find this section when I checked this recently
after further followup to the PR.  I still can't find a section
that gives as much detail for poll().  A poll on POLLIN succeeds when
"Data other than high priority data can be read without blocking".

> and about read:
>
> 	When attempting to read from an empty pipe or FIFO:
>
> 		* If no process has the pipe open for writing, read( )
> 		  shall return 0 to indicate end-of-file.
>
> This combination says to me that select() should consider a FIFO with
                                            shall :-)
> no writers to be readable.  This makes sense when it's been open and
> the writer closes it, as you need to read the EOF, but doesn't make
> as much sense when it hasn't been opened for write yet.
>
> Perhaps we can carefully interpret "an empty .. FIFO" to exclude the
> time before the first writer opens it.  Maybe during that time it's not
> empty, it's untenanted.

Ugh.  It makes sense for the state not to depend on previous activity.
It reduces the effect of races.

Bruce


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




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