On Thu, Jan 07, 1999 at 06:42:21PM +0000, Glynn Clements wrote:
> 
> Michele Bini wrote:
> 
> > How can it be? select() returns 1 (as if fd 0 had
> > some data pending, but read() returns 0 and doesn't
> > read any byte)
> 
> When read() returns 0 it is indicating EOF.
> 
> Note that select() doesn't indicate that data is available: it
> indicates that calling read() on the descriptor won't block.

The manpage doesn't seem to say so:

        Three independent sets of descriptors are watched.   Those
        listed  in  readfds  will  be watched to see if characters
        become available for reading, those in  writefds  will  be
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        watched  to  see if it is ok to immediately write on them,
        and those in exceptfds will be watched for exceptions.  On
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        exit,  the  sets  are  modified in place to indicate which
        descriptors actually changed status.

If EOF is an exception I would expect to be noticed only if I
put fd 0 in the exceptfds set.

-Michele

Reply via email to