PASC Interpretation Ref: pasc-1003.5-02
Topic: Text on reading from a Pipe


This is an unapproved interpretation of PASC P1003.5-1992.

Use of the information contained in this unapproved document is at your own risk.

Last update: 04 September,1996


                                                                1003.5-92 #2
	Class: Editorial defect

This will be forwarded to the IEEE for incorporation into a future 
errata sheet for the document, as well as an IEEE interpretations
publication, and will be also made available on-line on the IEEE 
SPAsystem.
 _____________________________________________________________________________


	Interpretation Number:	XXXX
	Topic:			Text on reading from a Pipe
	Relevant Sections:	IEEE Std 1003.5-1992, section 6.1.2,
			     	IEEE Std 1003.1-1990, section 6.4.1.2


Interpretation Request:
-----------------------

The text in IEEE Std 1003.5 does not fully specify the behavior on
reading from a pipe, as specified by IEEE Std 1003.1.

IEEE Interpretation for 1003.1-1990 (9945-1:1990):
--------------------------------------------------


The behavior specified by POSIX.1 for reading from a pipe (POSIX.1
section 6.4.1.2, lines 141-148) also apply to POSIX.5.  

In particular, the following text from POSIX.1 applies:

  When attempting to read from an empty pipe (or FIFO):

  (1)  If no process has the pipe open for writing, read() shall return
  zero to indicate end-of-file

  (2)  If some process has the pipe open for writing and O_NONBLOCK is
  set, read() shall return -1 and set errno to [EAGAIN].

  (3)  If some process has the pipe open for writing and O_NONBLOCK is
  clear, read() shall block until some data is written or the pipe is
  closed by all processes that had the pipe open for writing.

The following text indicates the exact semantics of the Ada binding to
the POSIX.1 semantics:

  When attempting to read from an empty pipe (or FIFO):

  (1)  If no process has the pipe open for writing, Read shall raise
  IO_Exceptions.End_Error to indicate end of file.

  (2)  If some process has the pipe open for writing and O_NONBLOCK is
  set, Read shall raise POSIX_Error with the error code
  Interrupted_Operation. 

  (3)  If some process has the pipe open for writing and O_NONBLOCK is
  clear, Read shall block until some data is written or the pipe is
  closed by all processes that had the pipe open for writing.


Rationale for Interpretation:
-----------------------------

The intent for POSIX.5 is to match the POSIX.1 semantics.  The text on
reading from a pipe was omitted from POSIX.5.  As written, POSIX.5
does not contradict this text, and this behavior is generally implied
by other wording in the section, and the general mapping of POSIX.1
semantics in Ada. 


Editorial note for future revision of standard (not part of the interpretation)
-------------------------------------------------------------------------------

The text will be updated as part of the P1003.5a revision.



 _____________________________________________________________________________