Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uwm.edu!linac!att!att!cbnewsl!urban From: urban@cbnewsl.att.com (john.urban) Newsgroups: comp.unix.questions Subject: Re: named pipes and O_RDWR Message-ID: <1991May17.131249.28228@cbnewsl.att.com> Date: 17 May 91 13:12:49 GMT References: <3374@kraftbus.cs.tu-berlin.de> Organization: AT&T Bell Laboratories Lines: 31 In article <3374@kraftbus.cs.tu-berlin.de> net@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) {