HP-UX 11i Version 2 Release Notes (October 2003)
Libraries and Programming
400K File Descriptors
Chapter 9
202
400K File Descriptors
The “maximum supported number of file descriptors” refers to the maximum number of
simultaneous open files allowed per process. MAXFUPLIM specifies the absolute maximum
number of files a process can have open at one time.
Summary of Change
The maximum supported number of file descriptors per process has been raised from
60000 (60K) to 400,000 (400K).
The semantics of USE_BIG_FDS has changed. In the 10.10 and above releases, the use of
the _USE_BIG_FDS define raised MAXFUPLIM from the default value of 2048 to 1048576.
In HP-UX 11i v2, in order to support the 400K file descriptor feature, if USE_BIG_FDS is
defined to a value > 60,000 (e.g., _USE_BIG_FDS=400000), then _MAXFUPLIM and
FD_SETSIZE will be set to (1024 * 1024). Applications using the select (2) system call
must set FD_SETSIZE to the appropriate value for the application. Failure to do so may
result in a memory resource issue resulting in the application terminating abnormally.
The related value of FD_SETSIZE is changed based on the definition of _USE_BIG_FDS as
follows:
• The default value will remain at 2048 if _USE_BIG_FDS is not defined.
•The value for FD_SETSIZE will default to 60,000 if _USE_BIG_FDS is defined but not
assigned a value.
•The value for FD_SETSIZE will default to (1024 * 1024) if _USE_BIG_FDS=400000 is
defined.
This feature is an enhancement of the 60,000 File Descriptor Feature. It is optional
because it will not be often used and to minimize the impact on existing code. An
application requiring more than 2048 file descriptors must be recompiled with the
symbol _USE_BIG_FDS defined. To do this, add the flag -D_USE_BIG_FDS=400000 to the
compile command in the application's makefile. This symbol can be defined at the
beginning of every application source file (via #define _USE_BIG_FDS which must be
done before the #includes). For applications that define _USE_BIG_FDS=400000,
FD_SETSIZE will be defined as (1024 * 1024) by default. To use the select (2) system call
for more file descriptors, FD_SETSIZE must be defined appropriately by the application.
Impact
NOTE It should be noted that this feature does not impact existing binaries. All executables
will run unaffected on this release.
As in previous releases, there are also per-application resource limits, independent of the
MAXFUPLIM limit. To use a large amount of file descriptors, your application might need
to modify its RLIMIT_NOFILE resource limits with getrlimit (2) and setrlimit (2). (See the
manpages for these system calls for more information.) Alternatively, the system-wide