[net.unix-wizards] EOF with pipes.

jpayne%bbn-vax@sri-unix.UUCP (03/08/84)

From:  Jonathan Payne <jpayne@bbn-vax>

It sure would be neat if EOF's could be sent down pipes.  I've heard a
rumor that you can do that in 4.2.  Is that true?  Something like
	write(fd, nul, 0);
or something like that anyway.  Is it actually hard to implement in
any version of UNIX?  Doesn't seem so.  Wouldn't be very compatible
with the rest of the world ...

dedwards%usc-isi@sri-unix.UUCP (03/09/84)

From:  Howard S. Weiss <dedwards@usc-isi>

It was done years ago on V6 at RAND - in fact here is a manual page:



EOFP(II)                  8-March-1977                   EOFP(II)



NAME
     eofp - write an end-of-file on a pipe

SYNOPSIS
     eofp(fd);

DESCRIPTION
     The pipe I/O routines have been  modified  to  allow  single
     end-of-files  to be transmitted. It works as follows: a call
     to eofp guarantees that, after the real data  is  read,  the
     next read on the pipe will return with 0 characters. Further
     writes may be done after writing an EOF, but  they  will  be
     suspended until the EOF actually gets read.

SEE ALSO
     pipe (II)

BUGS
     Writing  0  characters  on  a  pipe  now  has  very  special
     meaning--one's  code should be checked to see that it disal-
     lows all writes of 0 characters unless really desired.




-------

boyd@basser.SUN (Boyd Roberts) (03/18/84)

    > It sure would be neat if EOF's could be sent down pipes.

I'm sure that what you need here is not EOF's down pipes
but a *protocol*.  After all, EOF means that the other end
of the pipe has been closed, and not some other magical event.

    > Is it actually hard to implement in any version of UNIX?

I'm also sure that it wouldn't be very hard to break pipes too.
At least it'd be a step forward in the apparent quest to break
everything, that up till now worked in the stated way.

    > Wouldn't be very compatible with the rest of the world ...

Exactly, it wouldn't be very compatible.  But I see that it's
already been done at RAND with that ridiculous eofp() junk.

I just dread the thought of "eofp() meets _filbuf()".

obrien%rand-unix@sri-unix.UUCP (03/20/84)

From:  Michael_OBrien <obrien@rand-unix>

	"eofp()" solved a serious problem we had with pipes, which we were
forced to use because of PDP-11 address space restrictions.  It actually
worked quite well.

	However, I should point out that it existed only in our highly
hacked V6 kernel (I spent most of my first couple of years here unhacking
that kernel and throwing stuff away).  We no longer support, use, or
recommend "eofp()" and it doesn't occur in any of our kernels any more.