Subject: Re: select() question
To: Nathan J. Williams <nathanw@MIT.EDU>
From: Erik Huizing <huizing@cpsc.ucalgary.ca>
List: netbsd-users
Date: 08/14/2001 14:02:59
I've already dealt with the 256 limit. Its just a matter of redefining
FD_SETSIZE before including any files.
/*
* Select uses bit masks of file descriptors in longs. These macros
* manipulate such bit fields (the filesystem macros use chars).
* FD_SETSIZE may be defined by the user, but the default here should
* be enough for most uses.
*/
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
#endif
That aside, are there any limitations on poll I should be aware of?
There's no mention of any in the man page or include header.
The first rule of Fight Club is: You Do Not Talk About Fight Club.
// Erik Huizing huizing@cpsc.ucalgary.ca
// www.cpsc.ucalgary.ca/~huizing
On 14 Aug 2001, Nathan J. Williams wrote:
>
> Erik Huizing <huizing@cpsc.ucalgary.ca> writes:
>
> > Quick question about select:
> > is it better to use select on a large (possibly >5,000) number of
> > sockets,
>
> ... you can't do that. The select() interface only allows you to deal
> with the first FD_SETSIZE (256) descriptors. You could do it with
> poll(), though.
>
> > or to split the job up amount, say, 10 or 20 threads, where each
> > thread has a more manageable list.
>
> This might be better (less copyin overhead), if you can find a thread
> package that works well with select [working on it, I promise!].
>
> The kqueue interface would be better than any of those options, but
> it's not quite integrated yet.
>
> - Nathan
>