RFR: 8300088: [IMPROVE] OPEN_MAX is no longer the max limit on macOS >= 10.6 for RLIMIT_NOFILE

Gerard Ziemski gziemski at openjdk.org
Wed Jan 10 22:04:31 UTC 2024


On current macOS (> 10.6) we can use `RLIM_INFINITY` for `setrlimit(RLIMIT_NOFILE)`, even though the man page for setrlimit(2) claims otherwise.

The only wrinkle here is that some terminals (ksh) will crash with `RLIM_INFINITY`, because that value overflows `int` type, which they use internally, causing crash, so we work around that by using `INT_MAX` instead of `RLIM_INFINITY`.

-------------

Commit messages:
 - remove incorrect if
 - try max limit if possible

Changes: https://git.openjdk.org/jdk/pull/17361/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17361&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8300088
  Stats: 20 lines in 1 file changed: 15 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/17361.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17361/head:pull/17361

PR: https://git.openjdk.org/jdk/pull/17361


More information about the hotspot-runtime-dev mailing list