Subject: Re: poll(2) oddity
To: None <>
From: Jaromir Dolecek <>
List: tech-userlevel
Date: 07/07/2002 21:21:37
This makes me curious - when do you legally need to pass more poll()
entries than descriptors?[*] You are not checking any fd twice, are you?


 [*] select() has nfds 'highest_fd'+1, so the check for number
     of descriptors definitely applies for select() case at least.

Bill Sommerfeld wrote:
> > ah yes, this explains it, thanks.
> > i have holes in the set of file descriptors i pass to poll(),
> > so while i have more than 20 elements in the set, the highest
> > fd i have is only 11.
> While the check in question is clearly buggy, simply removing the
> check isn't the right answer -- there needs to be some limit on the
> number of poll array elements because the kernel allocates a chunk of
> kernel memory to cover them; if the size is unlimited, the user can
> ask the kernel to allocate essentially arbitrary amounts of kernel
> memory.
> But how do we determine what's a reasonable limit?
> 					- Bill

Jaromir Dolecek <>
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-