Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Dec 1996 16:44:05 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, sameer@c2.net
Cc:        freebsd-hackers@FreeBSD.ORG, freebsd-questions@FreeBSD.ORG
Subject:   Re: getdtablesize, OPEN_MAX, and sysctl
Message-ID:  <199612140544.QAA27898@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>	By OPEN_MAX I am referring to the 
>
>options OPEN_MAX=XX
>
>	in the kernel config file. I thought that OPEN_MAX was the
>thing to use for setting max # of fds in your kernel. If that isn't
>it, what should I use?

This option sets the soft resource limit for the maximum number of open
files for the init process.  The limit is inherited by all processes
but may be changed.  Processes should change it using setrlimit() if
they or their children need a larger limit.

>> select() only supports a fixed maximum number of descriptors in
>> -stable.  The default is FD_SETSIZE = 256.  2.2 and -current support
>> any reasonable number provided the application is compiled with
>> FD_SETSIZE defined as a larger number.
>> 
>
>	I'm pretty sure this is the problem. Are you saying that on
>2.1-stable you can't do a select on more than 256 fds, and on 2.2 and
>-current you can do a select on more than 256 fds but you need to make
>sure you #define FD_SETSIZE first?

In 2.1-stable, you can't do a select on more than FD_SETSIZE fd's, where
FD_SETSIZE is whatever it is when the kernel is compiled (default 256).
In later versions, there is no limit in the kernel; if you want more
than the default FD_SETSIZE number of fds, you just have to define
FD_SETSIZE consistently before including any headers (since any header
might include <sys/types.h>).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612140544.QAA27898>