Re: select() stress

Richard B. Johnson (root@chaos.analogic.com)
Mon, 17 Mar 2003 11:15:37 -0500 (EST)


On Mon, 17 Mar 2003, Sparks, Jamie wrote:

>
> Hello,
>
> I'm running some code ported from an sgi running Irix 6.5 on a
> redhat 7.1 box: 2.4.7-10, i686. Control hangs on a select()
> statement forever. The select is never completed, so I can't
> check errno.
>
[SNIPPED...]

> /* ****************************** */
> if (select(getdtablesize(), &socklist, NULL, NULL, NULL) < 0)
> {
> if (errno != EINTR) perror("WeapTerrain");
> continue;
> }

select() takes a file-descriptor as its first argument, not the
return-value of some function that returns the number of file-
descriptors. You cannot assume that this number is the same
as the currently open socket. Just use the socket-value. That's
the file-descriptor.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

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