RFR: 8357086: os::xxx functions returning memory size should return size_t [v25]
David Holmes
dholmes at openjdk.org
Wed Aug 6 12:11:11 UTC 2025
On Wed, 6 Aug 2025 09:22:12 GMT, Anton Artemov <duke at openjdk.org> wrote:
>> src/hotspot/os/windows/os_windows.cpp line 869:
>>
>>> 867: return true;
>>> 868: } else {
>>> 869: errno = ::GetLastError();
>>
>> Why are you setting `errno` here and elsewhere? I see a couple of places where we do do that though I do not know why, but generally we just want to save the `::GetlastError()` value (here we do need a local) and print it.
>
> You are correct, there is no relationship between `errno` and `GetLastError()`. Addressed.
>
> I created a separate issue to fix this inconsistency in other places.
I had forgotten that this oddity was also raised in the review of [JDK-8350869](https://bugs.openjdk.org/browse/JDK-8350869). If it is part of the `os::xxx` function's specification to set `errno` on failure then we would need to do something to achieve that (which I think was the intended case with something like `os::stat`) though as previously noted the set of allowed values for `errno` and `GetLastErrror` are not the same. But the API's in question here are not specified that way.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25450#discussion_r2256937209
More information about the hotspot-dev
mailing list