RFR: 8330989: unify os::create_binary_file across platforms [v2]

Matthias Baesken mbaesken at openjdk.org
Wed Apr 24 12:02:28 UTC 2024


On Wed, 24 Apr 2024 07:59:26 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> I think we can fold in the Windows version too and put it in os.cpp with one `WINDOWS_ONLY(xxx)` part
>
>> I think we can fold in the Windows version too and put it in os.cpp with one `WINDOWS_ONLY(xxx)` part
> 
> There is only a small difference, so why not  !

> Sorry @MBaesken I led you astray - I missed the fact that on Windows all the flag constants also start with `_` so `_O_CREAT` instead of `O_CREAT`. etc. If the non-underscore versions exist they will likely generate a compiler warning.

I see no errors in the windows GHAs.
On the other hand,  the MS documentation recommends _open instead of ::open / open  
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/open?view=msvc-170

We already use the  '::open' with non-underscore starting flags for example here  osSupport_windows.cpp ,
see  https://github.com/openjdk/jdk/blob/15190816f704f2e8681bc3e2d74832828a574106/src/java.base/windows/native/libjimage/osSupport_windows.cpp#L42
 seems both work.

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

PR Comment: https://git.openjdk.org/jdk/pull/18918#issuecomment-2074775746


More information about the hotspot-runtime-dev mailing list