PRB: Pipe I/O Does Not Support EOF Detection

ID Number: Q72525

6.00 6.00a

OS/2

docerr

Summary:

Beginning with Microsoft C version 6.0, the run-time libraries for

OS/2 contain functions for pipe I/O to pass information between

programs. As stated in the documentation, opening a pipe with the

_pipe() function returns read and write handles that can be passed to

a child process. The parent and child may then pass data back and

forth using the standard read() and write() functions.

What the documentation fails to mention is that the parent and child

must agree upon the termination sequence for accessing the pipe. There

is no end-of-file (EOF) detection code present in the read() and

write() functions specific to pipe I/O, so sending an EOF will not

stop a process from reading the pipe.

It is especially important that this is taken into consideration

because the child (or parent) process will block on the read() if no

data is available to read. If you do not provide the means for

determining when I/O is complete and the pipe should be terminated,

you could end up in a deadlock situation.

Additional reference words: 6.00 6.0a 6.00a