[comp.os.minix] Named pipe problem

regan@jacobs.CS.ORST.EDU (Dave Regan) (07/25/90)

I haven't used named pipes under System V, but I think I am seeing a
problem with named pipes under Minix.  I am sure someone will tell me
if I am wrong here.

Assume a named pipe with one reader and two writers.  It is "obvious"
that when writing to a pipe, the data should go at the end of the pipe,
as recorded by the inode (versus the end of the pipe as recorded by
the file descriptor).  In other words, even though the two writers
have different file descriptors (as they were opened at different
times), the data should be written to the end of the pipe.

This is what the O_APPEND flag accomplishes in fs/read.c in function
"read_write".  The normal write position is taken from the file descriptor
unless the O_APPEND mode flag is on, in which case it is taken from
the inode (which is system wide).

However, there is nothing to automatically set the O_APPEND mode flag
for pipes!  I would suggest altering fs/open.c function "common_open"
like:

		   case I_NAMED_PIPE:
+			oflags |= O_APPEND;	/* Force append mode */
			r = pipe_open(rip, bits, oflags);
			break;

This may not be sufficient, as the fcntl function could still remove the
append flag accidentally and again end up with a situation which is basically
inconsistant.  This could probably be patched in the fcntl routine to not
allow the O_APPEND bit to be removed on pipes.

So, before I make these changes does anybody have any comments?

(Note:  I have not yet made the above change.  Do so at your own risk.)

		regan@jacobs.cs.orst.edu