Subject: Re: poll(2) oddity
To: None <>
From: Christophe Kalt <>
List: tech-userlevel
Date: 07/07/2002 14:00:51
On Jul 07, Ben Harris wrote:
| >afaict, only the first 20 pfd's get scanned by poll().
| Hmm.  I think this is caused by this code in sys_poll():
|         if (SCARG(uap, nfds) > p->p_fd->fd_nfiles) {
|                 /* forgiving; slightly wrong */
|                 SCARG(uap, nfds) = p->p_fd->fd_nfiles;
|         }
| fd_nflies is the amount of space in the process's open files table, which is
| 20 by default, so if your process has <= 20 open fds, it can't pass more
| than 20 to poll().  I make no claim that this behaviour is sensible.

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.

Sent a PR, #17507.