Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!uunet!mcsun!ukc!pyrltd!root44!gwc From: gwc@root.co.uk (Geoff Clare) Newsgroups: comp.unix.programmer Subject: Re: Using select on FIFO's Message-ID: <2729@root44.co.uk> Date: 4 Jun 91 12:50:10 GMT Article-I.D.: root44.2729 References: <1991May30.165554.4079@chinet.chi.il.us> Distribution: comp Organization: UniSoft Ltd., London, England Lines: 24 les@chinet.chi.il.us (Leslie Mikesell) writes: > I've always just opened the FIFO with O_RDWR >on the reader side which (a) doesn't block during the open, and (b) Although this works on most if not all current UNIX systems, it's not required by POSIX, so applications using this method may not work on some future systems. For maximum portability to current and future systems, I recommend using the following method to open both sides of a FIFO to do blocking I/O: fd_rd = open("FIFO", O_RDONLY|O_NONBLOCK); fd_wr = open("FIFO", O_WRONLY); flags = fcntl(fd_rd, F_GETFL); fcntl(fd_rd, F_SETFL, flags & ~O_NONBLOCK); with something like the following tucked away in a header: #ifndef _POSIX_SOURCE #define O_NONBLOCK O_NDELAY #endif -- Geoff Clare (Dumb American mailers: ...!uunet!root.co.uk!gwc) UniSoft Limited, London, England. Tel: +44 71 729 3773 Fax: +44 71 729 3273