limits.h中OPEN_MAX常量在哪里?
《linux程序设计第四版》 P101
The number of files that any one running program may have open at once is limited. The limit, usually
defined by the constant OPEN_MAX in limits.h , varies from system to system, but POSIX requires that
it be at least 16. This limit may itself be subject to local system-wide limits so that a program may not
always be able to open this many files. On Linux, the limit may be changed at runtime so OPEN_MAX is
not a constant. It typically starts out at 256.
The OPEN_MAX macro in limits.h should not be there. It claims to be the
limit on file descriptors in a process, but its value is wrong for that.
There is no constant value, but a variable resource limit (RLIMIT_NOFILE).
Nothing in the kernel uses OPEN_MAX except things that are wrong to do so.
I've submitted other patches to remove those uses.
The proper thing to do according to POSIX is not to define OPEN_MAX at all.
The sysconf (_SC_OPEN_MAX) implementation works by calling getrlimit.