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

Gerard Ziemski gziemski at openjdk.org
Thu Nov 17 16:30:29 UTC 2022


On Thu, 17 Nov 2022 08:15:57 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> 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?
>
> I agree, this is fragile. Also, I think you don't need it. Just let the open that you test also create the file if it does not exist. E.g. `os::open("test", O_RDWR | O_CREAT | O_TRUNC, 0666);`. The "create file" and "open existing file" code paths are identical, so testing one should cover the other too.

I like that, let me try it...

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

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


More information about the hotspot-runtime-dev mailing list