[Contents] [Prev Chap] [*] [*] [Next Chap] [Index] [(i)]

E    Maximum Number of Open Files

You can enable extended (64K) file descriptors in DIGITAL UNIX Version 4.0D, as described in Section 1.10, by following these steps:

  1. Set the SSI_FD_NEWMAX option of the setsysinfo() system call to 1. When SSI_FD_NEWMAX is set to 1, the process utask bit is turned on and the process's hard file limit is raised to 64K. This setting is inherited by child processes.

  2. Set the process's file descriptor soft limit to be greater than 4K by using the setrlimit() call:

    #include <sys/resource.h>
    
     
    struct rlimit *rlp;
     
    rlp->rlim_cur = 6000; rlp->rlim_max = 6000; setrlimit(RLIMIT_NOFILE, rlp);

    This setting is inherited by child processes. See the setrlimit() reference page for details.

  3. This step is required only for applications that use select(), fd_set, FD_CLR, FD_ISSET, FD_SET, or FD_ZERO. Choose one of the following:

System administrators should note that max-vnodes must be set high enough for the needs of any application that requires a high number of descriptors. The max-vnodes is the number of in-memory structures for files, and is usually set by default to 5% of system memory. A rough guide is 1 vnode per descriptor. For more information about this setting, see the System Administration and System Configuration and Tuning guides.

To disable support for up to 64K file descriptors once the previous procedure has been carried out, set the SSI_FD_NEWMAX option of the setsysinfo() system call to 0. When SSI_FD_NEWMAX is set to 0, the process utask bit is turned off and the process's hard file limit returns to the default maximum of 4K, unless the process is using more than 4K file descriptors. In that case, the setsysinfo() call returns an error, EINVAL. Additionally, if a calling process's file descriptor hard or soft limit exceeds 4K, it is set to 4K. This setting can be inherited by child processes.