RFR: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC [v2]
Thomas Stuefe
stuefe at openjdk.org
Fri Nov 11 10:43:20 UTC 2022
On Wed, 28 Sep 2022 17:21:53 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
>> O_CLOEXEC is also available on macOS (__DARWIN_C_LEVEL >= 200809L), so use it same as on linux.
>
> Gerard Ziemski has updated the pull request incrementally with two additional commits since the last revision:
>
> - add test to verify that open(O_CLOEXEC) implies FD_CLOEXEC on macOS
> - assume O_CLOEXEC on macOS
Some small remarks inline, otherwise this looks ok
src/hotspot/os/bsd/os_bsd.cpp line 2214:
> 2212: // O_CLOEXEC is preferable to using FD_CLOEXEC on an open file descriptor
> 2213: // because it saves a system call and removes a small window where the flag
> 2214: // is unset.
I'm not even sure this comment is useful. Your code is clear and obvious. Discussing an alternate route may be confusing if people don't know the history if this code.
src/hotspot/os/bsd/os_bsd.cpp line 2215:
> 2213: // because it saves a system call and removes a small window where the flag
> 2214: // is unset.
> 2215: int fd = ::open(path, oflag|O_CLOEXEC, mode);
Style nit: should there be spaces between |?
-------------
PR: https://git.openjdk.org/jdk/pull/9663
More information about the hotspot-runtime-dev
mailing list