RFR: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC

David Holmes dholmes at openjdk.org
Sun Jul 31 21:59:00 UTC 2022


On Thu, 28 Jul 2022 20:39:43 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> 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.

Sorry but copying a comment from os_linux to os_bsd really doesn't make sense. We've been cleaning up these "mis-ports" ever since the macOS port was done, so please don't add new occurrences.

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

PR: https://git.openjdk.org/jdk/pull/9663


More information about the hotspot-runtime-dev mailing list