Path: utzoo!utgpu!water!watmath!uunet!lll-winken!lll-tis!pacbell!att-ih!chinet!les From: les@chinet.UUCP (Leslie Mikesell) Newsgroups: unix-pc.general Subject: Re: named pipes Message-ID: <4793@chinet.UUCP> Date: 14 Apr 88 19:57:06 GMT References: <339@bacchus> Reply-To: les@chinet.UUCP (Leslie Mikesell) Distribution: na Organization: Chinet - Public Access Unix Lines: 29 In article <339@bacchus> darren@bacchus (Darren Friedlein) writes: > >OK - Is there anyone out there that can explain to me how named pipes work >(specifically on the UNIXpc)? I understand the concept, but I don't know >how to implement them. I believe /dev/lp is one, but I'm not sure. Does >each one require a device driver? Does the fact that I use the pty package >make things any easier? No, /dev/lp is not a named pipe... ls -l will show the first character of the listing as a 'p' for anything that is a named pipe (also known as a FIFO). /dev/lp is a 'c'haracter device. Create a named pipe with: mknod filename p Then open/read/write redirected I/O and most of the other things that work with files and unnamed pipes can be used with the following differences: A read will block if there is no data available (controlled by O_NDELAY) and a process has the file open for writing. If the FIFO has been opened for writing and no process currently has it open for writing, a read will return EOF when there is no data. A write will block until a process opens the FIFO for reading (again controlled by O_NDELAY). If you want to read the FIFO with a shell script without worrying about EOF every time a process closes it, just make the same program also open the FIFO for writing (even if you don't want to write to it). This will make all reads block until something writes to the FIFO. Les Mikesell ...ihnp4!chinet!les