RFR: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC [v4]
Thomas Stuefe
stuefe at openjdk.org
Thu Nov 17 08:18:21 UTC 2022
On Wed, 16 Nov 2022 23:47:22 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> 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?
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.
-------------
PR: https://git.openjdk.org/jdk/pull/9663
More information about the hotspot-runtime-dev
mailing list