Re: RFC: poll change

Tim Hockin (thockin@sun.com)
Tue, 14 Aug 2001 16:53:43 -0700


This is a multi-part message in MIME format.
--------------19D25FEECDB0D2EA3D56BF6C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

"David S. Miller" wrote:

> The standard also says that any pollfd with (fd < 0) is ignored. Holes are
> explicitly ALLOWED.
>
> Dude, it ignores negative fds, check fs/select.c:do_pollfd()

Right - we're running in circles.

The standard says negative fd's are ignored. We get that right. What we
are left with is an overly paranoid check against max_fds. This check
should go away. You should be able to pass in up to your rlimit fds, and
let negative ones (holes or tails) be ignored.

I'm attaching a patch :).

Am I still not making the problem clear?

-- 
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
thockin@sun.com
--------------19D25FEECDB0D2EA3D56BF6C
Content-Type: text/plain; charset=us-ascii;
 name="select.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="select.diff"

Index: fs/select.c =================================================================== RCS file: /home/cvs/linux-2.4/fs/select.c,v retrieving revision 1.5 diff -u -r1.5 select.c --- fs/select.c 2001/07/09 23:10:25 1.5 +++ fs/select.c 2001/08/14 23:47:46 @@ -416,11 +416,8 @@ int nchunks, nleft; /* Do a sanity check on nfds ... */ - if (nfds > NR_OPEN) + if (nfds > current->rlim[RLIMIT_NOFILE].rlim_cur) return -EINVAL; - - if (nfds > current->files->max_fds) - nfds = current->files->max_fds; if (timeout) { /* Careful about overflow in the intermediate values */

--------------19D25FEECDB0D2EA3D56BF6C--

- 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/