RFR: 8300088: [IMPROVE] OPEN_MAX is no longer the max limit on macOS >= 10.6 for RLIMIT_NOFILE
David Holmes
dholmes at openjdk.org
Thu Jan 11 04:48:21 UTC 2024
On Wed, 10 Jan 2024 21:49:23 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
> 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`.
Changes requested by dholmes (Reviewer).
src/hotspot/os/bsd/os_bsd.cpp line 2057:
> 2055:
> 2056: status = setrlimit(RLIMIT_NOFILE, &nbr_files);
> 2057: if (status != 0) {
If status == 0 you will redundantly call setrlimit again at line 2066.
-------------
PR Review: https://git.openjdk.org/jdk/pull/17361#pullrequestreview-1814655482
PR Review Comment: https://git.openjdk.org/jdk/pull/17361#discussion_r1448286820
More information about the hotspot-runtime-dev
mailing list