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

David Holmes dholmes at openjdk.org
Wed Nov 16 23:51:20 UTC 2022


On Wed, 16 Nov 2022 20:36:20 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:

>> test/hotspot/gtest/runtime/test_os.cpp line 893:
>> 
>>> 891: TEST_VM(os, open_O_CLOEXEC) {
>>> 892: #if !defined(_WIN32)
>>> 893:   int err = system("touch test.txt"); // create the "test.txt" file
>> 
>> Where will the new test file get created and what will clean it up?
>> If it's created in the JTREG scratch dir, then I believe it is cleaned
>> up automatically.
>
> On Mach5 it would be created here:

I'm concerned this may be fragile. If `system` does a fork/exec then we may have OOM issues. Is `touch` guaranteed to be available and in the path or else a built-in?

Can we not create the file via the appropriate API, then close it and then check os::open?

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

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


More information about the hotspot-runtime-dev mailing list