RFR: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC
Gerard Ziemski
gziemski at openjdk.org
Thu Jul 28 20:43:36 UTC 2022
On Thu, 28 Jul 2022 20:00:07 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:
>> O_CLOEXEC is also available on macOS (__DARWIN_C_LEVEL >= 200809L), so use it same as on linux.
>
> 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. On ancient Linux kernels the O_CLOEXEC flag will be ignored
>> 2215: // and we fall back to using FD_CLOEXEC (see below).
>
> This comment was confusing me until I looked at os_linux.cpp and see
> that you are getting in sync with the comments in that file (which is
> where this code was ported from).
>
> Your changes below are also getting in sync with the code in the
> os_linux.cpp file.
>
> Did you want to mention here the macOS version info that includes
> the support for O_CLOEXEC?
Thank you for the review Dan!
I thought about it, but I decided that keeping the code in sync between linux and macOS was the priority. Eventually we might want to have a single impl shared between linux and mac I thought.
I ran Mach5 hs-tier1...5 for the testing.
-------------
PR: https://git.openjdk.org/jdk/pull/9663
More information about the hotspot-runtime-dev
mailing list