SUMMARY:File Descriptors

From: Ralph Howard (
Date: Wed Jan 25 1995 - 10:22:36 CST

Sun Managers,

Sorry for the delay with this summary. Turns out that I
would need Sun source code to do what I want to do. I
ended up just using "limit". Thanks to the following for
their answers:

don@alaska.opensys.COM (Don Lenamond)
Casper Dik <>
Nate Itkin <> (Roy Ramberg)

----- My original posting -----

In SunOS 4.1.3, I am trying to increase the the default
number of file descriptors from 64 to 128. I found an old
summary in the sun-managers archive that states that you
should be able to alter this value by changing the NOFILE
variable in /usr/sys/sys/param.h. I have also tried to
increase the maximum number from 256 to something greater
by altering the FD_SETSIZE variable in /usr/sys/sys/types.h.
After recompiling the kernel, neither of these seem to have
any affect on my limits. In csh, I still get:

        hopey> csh
        hopey% limit
        cputime unlimited
        filesize unlimited
        datasize unlimited
        stacksize 8192 kbytes
        coredumpsize unlimited
        memoryuse unlimited
        descriptors 64
        hopey% limit descriptors 256
        hopey% limit
        cputime unlimited
        filesize unlimited
        datasize unlimited
        stacksize 8192 kbytes
        coredumpsize unlimited
        memoryuse unlimited
        descriptors 256
        hopey% limit descriptors 257
        limit: descriptors: Can't set limit

Am I missing some step? Any help would be greatly appreciated.

        - ralph h.

----- End of my post -----


From: don@alaska.opensys.COM (Don Lenamond)
Message-Id: <9412310012.AA00892@ alaska.opensys.COM>
Subject: Re: File Descriptors

Hi Ralph,

This comes from SunSolve. Hope it works...

| #### #### ##### | DON LENAMOND: Mgr Network Systems |
| # # # # | Enterprise Integration Services |
| # # # # | E-mail: don@alaska.opensys.COM |
| # # # # | Phone: (907) 261-8715 |
| #### ##### ##### | Fax: (907) 261-8710 |
| OpenSystems Inc. 3111 C Street,Ste 400,Anchorage, AK 99503 |

SRDB ID: 7242

SYNOPSIS: how to increase number of open files using setrlimit(2) 12


This is a sample of a program that is increasing the number of
open files per process using serlimit() and checks that value
is modified using getrlimit() and sysconf().


/* Increasing the number of file descriptors that
* a process can create using setrlimit(2)

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>

main(argc, argv)
int argc;
char *argv[];
  struct rlimit my_limit;

getrlimit (RLIMIT_NOFILE, &my_limit);
printf ( "Current limit of open files is %d.\n", my_limit.rlim_cur);

my_limit.rlim_cur = 1024;

    if (setrlimit(RLIMIT_NOFILE, &my_limit) == -1)
        perror("error in setrlimit");

getrlimit (RLIMIT_NOFILE, &my_limit);
printf ( "Now current limit of open files is %d.\n", my_limit.rlim_cur);
printf ( "sysconf() says %d files.\n", sysconf(_SC_OPEN_MAX));


Subject: Re: File Descriptors
In-Reply-To: Your message of "Fri, 30 Dec 1994 15:44:41 EST."
Date: Sat, 31 Dec 1994 12:13:10 +0100
From: Casper Dik <>

You cannot change teh NOFILE parameter unless you have kernel source code.
You cannot increase the number of descriptors past 256 unless you
run SunDBE (DataBase Engine kernel enhancements). With SunDBE
the limit is 1024. In Solaris 2.x, there is no limit.


From: Nate Itkin <>
Subject: Re: File Descriptors
Date: Sat, 31 Dec 94 19:11:48 PST
In-Reply-To: <>; from "Ralph Howard" at Dec 30, 94 3:44 pm
Precedence: first-class
X-Mailer: ELM [version 2.3 PL11]

I think it would be necessary to recompile several SunOS objects which
are not distributed as C source to raise the limit above NOFILE (256).
On a per process basis, you can set the limit to 256 by putting
"limit descriptors 256" in your .cshrc file.

- Nate Itkin
- Portland Technology Development, Intel Corporation      Aloha, Oregon
- E-mail:


From: (Roy Ramberg) Message-Id: <9501021020.AA00549@moon.noname> To: Subject: Re: File Descriptors

Hi Ralph!

There is a hard limit and a soft limit. The upper hard limit you can only modify as super user, i.e become super user and run limit. These limits that are shown will tell you the upper limit that are possible. I.e any user can not go above these limits. You will find that the upper limit for descriptors is 256 if you have installed a "standard" OS (i.e no kernel modifications). If you want to raise this limit you will have to reconfigure the kernel and set the number appropiately to your needs (look in manual for doing kernel modifications).

Hope this helps! Sincerely Roy Ramberg ,,, (. .) -------------------o00-(_)-00o------------------------- Roy Ramberg Programmer/System staff READ WELL SERVICES Telephone: +47 669822040 Ravnsborgvn.56 Fax : +47 66982022 P.O BOX 25 e-mail : 1364 HVALSTAD NORWAY _______________________________________________________ | | | | ooo ooo


Ralph Howard Telecommunications Premium Services 120 Wood Avenue South, Suite 404 Voice/Fax: (908)435-3855 Iselin, New Jersey 08830

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:14 CDT