RFR: 8366272: The os::xxx APIs do not manage errno correctly [v6]
David Holmes
dholmes at openjdk.org
Tue Dec 9 04:22:01 UTC 2025
On Mon, 8 Dec 2025 16:17:41 GMT, Anton Artemov <aartemov at openjdk.org> wrote:
>> Hi, please consider the following changes:
>>
>> In this PR the handling of `errno` is improved by inspection of the codebase and fixing potential overwrites of `errno` by other methods. Potential overwrites are addressed using `ErrnoPreserver` functionality where necessary.
>>
>> Tested in tiers 1 - 5.
>
> Anton Artemov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>
> - Merge remote-tracking branch 'origin/master' into JDK-8366272-the-os-xxx-api-do-not-manage-errno-correctly
> - 8366272: Fixed whitespaces.
> - 8366272: Addressed reviewer's comments.
> - 8366272: Addressed reviewer's comments.
> - Merge remote-tracking branch 'origin/master' into JDK-8366272-the-os-xxx-api-do-not-manage-errno-correctly
> - 8366272: Improved errno management in os:xxx methods
Looks good. Thanks
src/hotspot/os/posix/signals_posix.cpp line 1648:
> 1646: // Save and restore errno to avoid confusing native code with EINTR
> 1647: // after sigsuspend.
> 1648: ErrnoPreserver ep;
I don't think this is incorrect but I will just note that by using the `ErrnoPreserver` we now restore `errno` on all the return paths below, not just for the "success" case.
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28086#pullrequestreview-3555349386
PR Review Comment: https://git.openjdk.org/jdk/pull/28086#discussion_r2601028047
More information about the hotspot-runtime-dev
mailing list