named pipes and O_RDWR

john.urban urban at cbnewsl.att.com
Fri May 17 23:12:49 AEST 1991


In article <3374 at kraftbus.cs.tu-berlin.de> net at opal.cs.tu-berlin.de (Oliver Laumann) writes:
>Is it allowed to open(2) a named pipe (FIFO) with O_RDWR?
>
>The X/Open Portability Guide explicitly says that in this case the
>result of the call to open() is undefined.  On the other hand, P1003.1
>and the manual pages on several UNIX versions do not explicitly forbid
>this.
>
>I have noticed that under SunOS, when a process opens several FIFOs
>with O_RDWR and then writes a single byte into each of these in turn,
>the 12th call to write() blocks.  It blocks even if I set the respective
>file descriptors to non-blocking.
>

This works fine on AT&T UNIX System V/x86 Release 4.0 Version 2.1.

Sincerely,

John Ben Urban

P.S. If you the line: mknod (buf, 010666); and change the open(2) sightly,
there is no need to run the mknods by hand first.

OLD CODE >
>	sprintf (buf, "%d", i);
>	if ((f[i] = open (buf, O_RDWR, 0)) == -1) {

New CODE <
<	sprintf (buf, "%d", i);
<	mknod (buf, 010666);
<	if ((f[i] = open (buf, O_RDWR, 0644)) == -1) {



More information about the Comp.unix.questions mailing list