[crac] RFR: List open FDs through reading /proc/self/fd

Anton Kozlov akozlov at openjdk.org
Thu May 25 13:18:26 UTC 2023


On Fri, 12 May 2023 07:36:33 GMT, Radim Vansa <duke at openjdk.org> wrote:

> Previously the code was iterating through all possible FD values, up to highest allowed FD number, and required allocation of possibly huge array. Reading /proc/self/fd into a compact array is both more memory efficient and does not require excessive syscalls.

Mostly LGTM!

src/hotspot/os/linux/os_linux.cpp line 193:

> 191:   };
> 192: 
> 193:   bool same_fd(int fd1, int fd2);

The declaration has wrong parameter names.

src/hotspot/os/linux/os_linux.cpp line 5814:

> 5812:       // skip "." and ".."
> 5813:       continue;
> 5814:     }

May be just look at the first char `== '.'`?

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

Marked as reviewed by akozlov (Lead).

PR Review: https://git.openjdk.org/crac/pull/67#pullrequestreview-1443824365
PR Review Comment: https://git.openjdk.org/crac/pull/67#discussion_r1205496914
PR Review Comment: https://git.openjdk.org/crac/pull/67#discussion_r1205475025


More information about the crac-dev mailing list