This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Allow customizing of __FD_SETSIZE


> -----Original Message-----
> From: patofiero@gmail.com [mailto:patofiero@gmail.com] On Behalf Of
> Carlos O'Donell
> Sent: Friday, June 11, 2010 6:19 PM
> To: Keisial; Christoph Kling
> Cc: libc-help@sourceware.org
> Subject: Re: Allow customizing of __FD_SETSIZE
> 
> 
> Yes, you are right, I see fs/select.c does use nfds to compute
> everything, and the kernel uses fd_set_bits instead of fd_set to allow
> scaling of the size of the fd_set.
> 
> So in this case it seems that there is no ABI issue in the kernel,
> that as long as userspace passes the right value for nfds, that the
> kernel scales up.
> 
> I checked in glibc, and I see no serious problem using a larger
> fd_set. However the sunrpc code uses fd_set and therefore that API
> will expect a normal sized fd_set.
> 
> Unfortunately changing fd_set still changes the userspace ABI, which
> expects a fixed fd_set size.
> 
> You really have two options:
> 
> (a) Design a way to handle larger fd_set that does not break ABI
> 
> (b) Switch to using epoll.
> 
> As it stands I don't think your bugzilla entry will ever be accepted
> by upstream because of the ABI issues.
> 
> Cheers,
> Carlos.

I am modifying an existing software and I am not capable to use epoll or implement a wrapper around epoll for select(). The manuals for this software (UnrealIRCd) suggest to modify the system headers in order to allow a bigger FD_SETSIZE. This solution seems to be the only one working. I tested it with more than 8000 tcp connections on a standard debian squeeze kernel (Linux 2.6.32-3-amd64 #1 SMP Wed Feb 24 18:07:42 UTC 2010 x86_64 GNU/Linux) so I guess that no kernel patching is necessary and that the kernel scales indeed according to the nfds value.

The solution I proposed would allow a software like UnrealIRCd to set a macro before including the glibc header files. Unfortunately, I don't understand completely what it means that the userspace AB is being changed. The value has a fixed default of 1024 and only if the macro is set, there is a deviation from this default. I think that glibc should support a larger FD_SETSIZE if the kernel can handle it.

Another solution proposed by some people I met in the ##c channel on irc.freenode.net was to write my own wrapper around the sys call. But I neither know how (I am actually a law student) nor can I understand why the glibc wrapper prevents me from using kernel features that exist.

By the way, where does this default come from if the kernel scales? I looked into the POSIX manual as well and found no requirement to set it to 1024.


Regards,
Christoph

Attachment: PGP.sig
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]