WG15 Defect Report Ref: 14519-02
Topic: Text on reading from a Pipe


This is an approved interpretation of 14519:1994.

.

Last update: 1997-05-20


                                                                14519-92 #2
	Class: Editorial defect

 _____________________________________________________________________________


	Topic:			Text on reading from a Pipe
	Relevant Sections:	ISO/IEC 14519:1994, section 6.1.2,
			     	ISO/IEC 9945-1:1990, section 6.4.1.2


Defect Report:
-----------------------

The text in ISO/IEC 14519 does not fully specify the behavior on
reading from a pipe, as specified by ISO/IEC 9945-1.

WG15 response for 9945-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 14519 revision.



 _____________________________________________________________________________