Re: BUG: select(2) doesn't wait with O_RDONLY pipe

Richard B. Johnson (root@chaos.analogic.com)
Mon, 4 Oct 1999 08:27:06 -0400 (EDT)


On Sun, 3 Oct 1999, Dave Broudy wrote:

> Hello,
>
> I think there may be a bug when using select() to wait on a fd that was
> open()'d with O_RDONLY and O_NONBLOCK. select waits on the pipe the first
> time, but once data is writen to the pipe (echo stuff > pipe) and
> subsequently read(), select() never waits again, and read() returns 0
> until the program is killed. If I open() the pipe with O_RDWR, everything
> works fine.
>

I think you have a bug in your test program. You have a loop, but have
only set up the fdset variable once (before you enter the loop). You
need to do this every time. The same thing is true for any time out.

Cheers,
Dick Johnson
**** FILE SYSTEM WAS MODIFIED ****
Penguin : Linux version 2.3.13 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/