Messages in this thread | | | Date | Thu, 06 Jul 2006 20:00:43 -0700 | From | "H. Peter Anvin" <> | Subject | Re: [PATCH] Fix poll() nfds check. |
| |
Vadim Lobanov wrote: > Hi, > > This is a trivial patch to fix the nfds check in the poll system call > implementation. Namely, OPEN_MAX no longer does anything important in > the kernel, and checking that nfds is greater than max_fdset AND greater > than OPEN_MAX therefore just seems wrong. > > This brings up a slightly-tangential question: Why do the nfds checks > exist in select()/poll()? They're not strictly necessary, since bad > input will be caught later when we validate all the fds, one by one. > Furthermore, these checks optimize the handling of error cases (which > should be uncommon) while pessimizing correct usage of the syscalls > (which should be more common). >
The reason for these is presumably to keep applications which uses select() to overflow their fd_sets. Unfortunately fd_set is defined in such a way that it's a static size.
Using ulimit seems like a reasonable compromise for this.
-hpa - 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/
| |