System Administration
Showing results for 
Search instead for 
Did you mean: 

Increasing file descriptors (FD_SETSIZE)

Hirantha Wijayawardena
Occasional Contributor

Increasing file descriptors (FD_SETSIZE)

Dear Experts,

I'm having a big issue when trying to increase the FD_SETSIZE default value 1024 to 4096.

I have installed kernel-headers from yum. and I change the value in /usr/include/linux/posix_types.h and add value to the /usr/include/linux/types.h

#define __FD_SETSIZE 1024


#define __FD_SETSIZE 4096

Then download the glibc-2.6-3.src.rpm and compiled with #rpmbuild --rebuild and it has successfully generated all glibc-<>.rpms.

I have tried to remove the existing glibc pkgs to installed compiled rpm files. This is the stupid installation work I ever done - after removing glibc with --nodeps. I have no way to run almost any commands in the box; even never boot-up.

So I re-installed the OS with --force from my compiled rpms and it got installed (assuming over-write existing binary files).

Now I need to compile and install gcc too; from src.rpm. This is throwing an error and I'm frustrated

otypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wmissing-format-attribute -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include ../../gcc/errors.c -o errors.o
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
stage1/xgcc -Bstage1/ -B/usr/i386-redhat-linux/bin/ -c -O2 -g -march=i386 -mcpu=i686 -fprofile-generate -gnatpg -gnata -I- -I. -Iada -I../../gcc/ada ../../gcc/ada/ -o ada/ada.o
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
gnat1: error: unrecognized command line option "-mcpu=i686"
make[2]: *** [ada/ada.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/usr/src/redhat/BUILD/gcc-4.1.2-20070503/obj-i386-redhat-linux/gcc'
make[1]: *** [stageprofile_build] Error 2
make[1]: Leaving directory `/usr/src/redhat/BUILD/gcc-4.1.2-20070503/obj-i386-redhat-linux/gcc'
make: *** [profiledbootstrap] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.27994 (%build)

What I forced to recompile glibc and gcc is, get the new value from the posix_tyes.h file and types.h file, and build those rpms.
This requirement is requested by my developers - They need more than 1024 connections (msockets). The moment max. clients that connect to the server is around 1006 but they wanted me to push the Linux box to more than 4096 connections..

My environment is Fedora 7. if this is work I will move to rhel5.

Please let me know and is there a way that we could increase the file descriptors (FD_SETSIZE) on Linux. On windows and sun-solaris - this is working more than 4096 connections.

your advice is really really appreciated..

Thanks in advance

-+> Hirantha
Honored Contributor

Re: Increasing file descriptors (FD_SETSIZE)

Your developers might want to use poll() instead of select(). Both perform a similar task, but some sources say poll() might be more efficient. In addition, the arguments of poll() won't suffer from the FD_SETSIZE limit, which seems to be the main problem.

A quick Googling found me this message from the Linux-Kernel mailing list: