Subject: Re: poll(2) oddity
To: <>
From: David Laight <>
List: tech-userlevel
Date: 07/07/2002 17:42:32
> 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.

Yes - there is no reason at all for the poll list to be dense.
It is (should be) perfectly legal to have a list of 1000 pollfds
where almost all of the fd values are -ve (and so ignored).


David Laight: