On Wed, Jul 30, 2008 at 02:52:16PM -0700, JINMEI Tatuya / ?$B?@L@C#:H?(B wrote:
> I've written a small test tool to check if a given system (+
> operational environment) can support a given (normally large) number
> of sockets and whether and how the select() system call/function can
> support the given number of sockets. It might be a useful check tool
> for those who are currently suffering from 'too many files' kind of
> problems with the P1 versions but cannot move to a beta and plan to
> try and deploy P2.
> The test tool is available at
> http://www.jinmei.org/selecttest.tgz

I'd suggest adding code in the beginning to raise RLIMIT_NOFILE
to the processes hardlimit, eg.:

struct rlimit rlim;

if (getrlimit (RLIMIT_NOFILE, &rlim) == -1) {
return 1;

if (rlim.rlim_cur < rlim.rlim_max)
rlim.rlim_cur = rlim.rlim_max;

if (setrlimit (RLIMIT_NOFILE, &rlim) == -1) {
return 1;

On a vanilla Solaris 10 system, the soft limit for open files
is only 256, so your test will fail pretty early, whereas the
hardlimit is 65536.