RFR: 8364312: debug agent should set FD_CLOEXEC flag rather than explicitly closing every open file [v3]
Kevin Walls
kevinw at openjdk.org
Wed Aug 6 11:02:03 UTC 2025
On Tue, 5 Aug 2025 10:32:42 GMT, Guanqiang Han <ghan at openjdk.org> wrote:
>> Create a new function that marks all file descriptors found in /proc/self/fd with the FD_CLOEXEC flag to ensure they are automatically closed upon execution of a new program via exec().
>
> Guanqiang Han has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>
> - a small fix
> - Merge remote-tracking branch 'upstream/master' into 8364312
> - Update exec_md.c
>
> correct an compilation error
> - 8364312: debug agent should set FD_CLOEXEC flag rather than explicitly closing every open file
>
> Create a new function that marks all file descriptors found in /proc/self/fd with the FD_CLOEXEC flag to ensure they are automatically closed upon execution of a new program via exec().
src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c line 59:
> 57: #else
> 58: #define FD_DIR "/proc/self/fd"
> 59: #endif
Nitpicking, but this FD_DIR define now has a function between its definition here, and where it's used in markDescriptorsCloseOnExec. It would make sense to move it down to be just before that function.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26568#discussion_r2256793737
More information about the serviceability-dev
mailing list