Re: poll(2) only can handle 256 fds?



On Fri, 2005-03-11 at 02:12, Markus Lausser wrote:
On Tue, 2005-03-08 at 21:56, Markus Lausser wrote:
Hello,

i get the message
  *** GLib *** : poll(2) failed due to: Invalid argument.
thousand times when running my application.
It seems that it happens if i have accepted 100 < x < 200
tcp connection from which i listen for input.

What can i do? I am using glib 2.6.0 on a linux system.

I've did some investigation, and it appears that glib runs into
an endless loop when it tries to poll more than 256 fds at once.

I've written a short test program which reproduces this behaviour
on my system. Can anyone verify this?

The Program:
------------
[...]
-------------

It seems that my kernel does not like to poll() more fds than
the max fd var is set to:

linux/fs/select.c :
long sys_poll():
       [...]
       /* Do a sanity check on nfds ... */
       if (nfds > current->files->max_fds)
               return -EINVAL;

My application handles tcp connections and permanently has a
source attached for every descriptor to read input. Whenever
it wants to write something an additional source is attached
for that descriptor and removed again when all data was sent.
Now, is it possible to merge those two sources for the same
file descriptor? Can i 'extend' the source condition temporarily
from READ to READ|WRITE? Or must i remove the reader source and
replace it with a read/write source?


Markus.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]