On Tue, 3 Feb 2026 14:07:54 GMT, Thomas Stuefe <[email protected]> wrote:
>> Kieran Farrell has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> minor updates
>
> src/hotspot/os/bsd/os_bsd.cpp line 2608:
>
>> 2606:
>> 2607: nfiles = res / sizeof(struct proc_fdinfo);
>> 2608: if (nfiles >= MAX_SAFE_FDS) {
>
> About MAX_SAFE_FDS:
>
> What is really returned by `pid_for_task`?
>
> If return values > MAX_SAFE_FDS are possible, would that be the reliable
> "number of open fds" ? If so, why not print that instead of ">1024"? In fact,
> if so, why even bother returning an array at all, why not make the array
> 1-element-sized only, pro format? All we are interested in is the number.
proc_pidinfo allocates a buffer to hold a struct proc_fdinfo for each FD. To
avoid using malloc and allocating potentially large amounts of memory in a
signal-handling context, we decided to use a pre-allocated struct and read onto
that.
proc_pidinfo will return once the buffer is full, in that case we have to
assume the actual number of open FDs is >= 1024
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27971#discussion_r2763467160