RFR: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC [v2]

Thomas Stuefe stuefe at openjdk.org
Fri Nov 11 10:43:22 UTC 2022


On Thu, 29 Sep 2022 14:39:58 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> test/hotspot/gtest/runtime/test_os.cpp line 892:
>> 
>>> 890: 
>>> 891: TEST_VM(os, open_O_CLOEXEC) {
>>> 892: #if defined(__APPLE__)
>> 
>> Does this not work on other OS ie Linux?
>
> It works on Linux too and originally I had it for both Mac and Linux, but I figured that since this issue (dropping `FD_CLOEXEC` and relaying on only `O_CLOEXEC`) is focused just on MacOS, then that's the platform we should test.
> 
> I can add Linux here though, if you think it would be useful.

This should work for all Unices. Can you test it for all !windows platforms?

Also, thanks for adding the test. The reason I did ask for it was that we have that insanely complicated `test/hotspot/jtreg/runtime/8176717/TestInheritFD.java` in the jtreg suite that checks whether UL log files are inherited to child processes (so, not marked with CLOEXEC). I always wondered whether we could replace that one with just a very simple gtest, that tests that UL opens its files with CLOEXEC.

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

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


More information about the hotspot-runtime-dev mailing list