Can you poll a pipe?

William G. Bunton wgb at balkan.TNT.COM
Wed Oct 31 00:38:25 AEST 1990


In article <1990Oct28.035350.26736 at ico.isc.com> dougm at ico.ISC.COM (Doug McCallum) writes:
>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.

And I've been told in no uncertain terms that it doesn't work on
tty's.  In fact, I've been told that because it's not supported on
tty's, that is a valid reason for it to hang the entire vt/console
subsystem.

If you compile the short program included at the end of this post, and
run it from a tty on 2.2, you will find no VT accepting input until
you kill the program.

>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.

I'd like to suggest it wasn't done completely for tty's either, and
maybe someone ought to check up on it.

Doug, I'm certainly not flaming you, I appreciate you and Dick
posting.  But I am a but pissed off over the response I got from
support at isc for a bug report, and was waiting for a chance to respond.
Thanks :-)

Here's the program:

-------------- cut here ------------------
#include <stdio.h>
#include <stropts.h>
#include <poll.h>

main()
{
    struct pollfd pfd;

    pfd.fd = 0;
    pfd.events = POLLIN;

    poll(&pfd, 1, -1);
}
----------- cut here --------------

Bill

	
-- 
William G. Bunton              | An engineer is a man who can do for five bob
wgb at balkan.tnt.com             | what any bloody fool can do for a quid.
Tools & Techniques, Austin, TX |                        -- origin unknown



More information about the Comp.unix.internals mailing list