RFR: 8338851: Hoist os::Posix::realpath() to os::realpath() and implement on Windows [v5]

Thomas Stuefe stuefe at openjdk.org
Fri Sep 13 06:02:08 UTC 2024


On Thu, 12 Sep 2024 13:56:42 GMT, Simon Tooke <stooke at openjdk.org> wrote:

>> This PR changes the status of realpath() from a Posix-specific API to a globally available API, i.e. adding it to the "Hotspot Porting API".  Code would refer to os::realpath() instead of os::Posix::realpath().
>> 
>> This requires the addition of a stub routine in os_posix.cpp and a Windows implementation of realpath(), using Windows _fullpath().
>> 
>> This PR depends on #20597 in that it removes the need for one #ifdef in that PR.  Because of that, this PR will be modified when and if #20597 is integrated (or vice-versa)
>> 
>> Please note that guidelines for doing this appear in src/hotspot/share/runtime/os.hpp
>
> Simon Tooke has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - remove empty line
>  - fix indentation
>  - fix missing return statement

Possibly for another RFE, since this one has been in the making long enough: Write a gtest for this new function.

src/hotspot/os/windows/os_windows.cpp line 5334:

> 5332:     } else {
> 5333:       errno = ENAMETOOLONG;
> 5334:     }

Curious, why not just passing in outbuf and outbuflen directly instead of letting the function allocate memory just to then copy the content? To get a guaranteed ENAMETOOLONG?

Just a question, not a comment. I am fine with this as it is.

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

Marked as reviewed by stuefe (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20683#pullrequestreview-2302179063
PR Review Comment: https://git.openjdk.org/jdk/pull/20683#discussion_r1758226212


More information about the serviceability-dev mailing list