Re: how to tell if data is available for a file descriptor

Tom Dyas (
Fri, 12 Sep 1997 23:40:54 -0400 (EDT)

On Fri, 12 Sep 1997, Jason Burrell wrote:

> Unless I'm missing something blatently obvious, NULL == 0, and thus this
> manpage is nonsensical. "It may be zero, causing select to return
> immediately. If timeout is NULL (no timeout), select can block
> indefinately." How can it return immediately *and* block indefinately?
> I'm confused. I've never actually used select(), as odd as that may seem
> to some. Well, not with indefinate or zero timeouts, anyway.

If the value of the passed pointer is 0 (a.k.a. NULL), then select() will
block indefinitely. The "zero" refered to in the man page is the value
contained within the fields of a passwd timeval strcuture. Thus, the
pointer would be non-NULL and the fields tv_sec and tv_usec would be 0.