Date: Sun, 17 Jun 2001 12:30:08 +0300 From: Valentin Nechayev <netch@iv.nn.kiev.ua> To: Sascha Schumann <sascha@schumann.cx> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: poll(2)'s arbitrary limit Message-ID: <20010617123008.A585@iv.nn.kiev.ua> In-Reply-To: <Pine.LNX.4.33.0106170013280.3244-100000@rossini.schumann.cx>; from sascha@schumann.cx on Sun, Jun 17, 2001 at 12:30:47AM %2B0200 References: <Pine.LNX.4.33.0106170013280.3244-100000@rossini.schumann.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
Sun, Jun 17, 2001 at 00:30:47, sascha (Sascha Schumann) wrote about "poll(2)'s arbitrary limit": > one of my applications uses the SGI State Threads Library > (I/O multiplexing scheduler). At its heart is a function > which concatenates the pollfd arrays of all threads and calls > poll(2). As sockets are shared between threads, the size of > the final pollfd array can easily be greater than > RLIMIT_NOFILE. > > Unfortunately, it is impossible to poll more than > RLIMIT_NOFILE descriptors with one system call. This is > caused by a check in sys/sys_generic.c which was introduced sys/kern/sys_generic.c > three months ago: > > /* > * This is kinda bogus. We have fd limits, but that is not > * really related to the size of the pollfd array. Make sure > * we let the process use at least FD_SETSIZE entries and at > * least enough for the current limits. We want to be reasonably > * safe, but not overly restrictive. > */ If there are no equal file descriptors in different pollfd arrays, current maxfiles limit should not be reached. (But I agree this code is rather strangs: checking for p_rlimit[RLIMIT_NOFILE].rlim_max is some reasonable, but not for p_rlimit[RLIMIT_NOFILE].rlim_cur.) If some descriptors are equal, SGI's code is broken IMHO: when two different pollfd structures has identical fd, result may be indetermined. > if (nfds > p->p_rlimit[RLIMIT_NOFILE].rlim_cur && nfds > FD_SETSIZE) > return (EINVAL); > > What is the chance of getting this changed? Or, at least > documented? > > [EINVAL] The specified time limit is negative. I suppose this SGI state threads library can be simply recompiled to use select() instead of poll(), this can be simple workaround. Also you can contribute code working with kevent(2), this will be more efficient ;) P.S. Why libc_r uses poll(), but not kevent()? /netch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010617123008.A585>