Can you poll a pipe?

Doug McCallum dougm at ico.isc.com
Sun Oct 28 14:53:50 AEST 1990


In article <345 at uucs1.UUCP> gaf at uucs1.UUCP () writes:
...
>That's funny - I've been told by ISC in no uncertain terms that poll()
>doesn't work on a FIFO, since it isn't a streams device.  This info came
>back from a bug report I gave them complaining that select() appeared not
>to be working properly on FIFOs.  select() calls poll(), and as you say
>poll() only works on streams devices.

Poll is supposed to work on pipes, ttys and potentially other devices.
hat does not mean it worked under other releases.  To be more accurate 
about this, poll is supposed to work on pipes and tty devices under 2.2
and definitely did in the 1.0.6 release. Poll works on tty devices but
did not work on pipes (or FIFOs) under 2.0.1 or 2.0.2.

>
>It is not standard, and it is not an ISC improvement.  Getting X events
>from a FIFO doesn't work for me very well.  What happens is they sit there,
>all queued up, until some other X event happens (enter, leave, etc).
>It seems select() (aka poll()) doesn't reject events from FIFOs, but if 
>data on a FIFO is the only event happening, select() won't return.  When
>some other event happens, the FIFO data gets read then.  It's a pity.

I just checked and you are correct in the behavior.  Apparently when the poll
support was added back in it was not done completely.

The support for poll on anything other than STREAMS is non-standard and
applications that make use of any extensions (on ISC or SCO or anything else)
are not going to be portable.



More information about the Comp.unix.sysv386 mailing list