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

David Holmes dholmes at openjdk.org
Thu Sep 19 04:30:38 UTC 2024


On Wed, 18 Sep 2024 10:18:28 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 a Windows implementation of realpath(), using Windows _fullpath(), and renaming os::Posix::realpath() to os::realpath().
>> 
>> The main difference between POSIX and Windows behaviour is that POSIX actually requires an existing accessible file, while Windows will happily work with made-up filenames.
>> 
>> Please note that guidelines for doing this appear in src/hotspot/share/runtime/os.hpp
>
> Simon Tooke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove tabs

test/hotspot/gtest/runtime/test_os.cpp line 433:

> 431:   errno = 0;
> 432:   returnedBuffer = os::realpath(tmppath, buffer, MAX_PATH);
> 433:   EXPECT_TRUE(returnedBuffer == buffer);

Should we also do `EXPECT_TRUE(errno == 0);` ? Here and below.

test/hotspot/gtest/runtime/test_os.cpp line 453:

> 451:     errno = 0;
> 452:     returnedBuffer = os::realpath(tmppath, buffer, sizeof(buffer));
> 453:     EXPECT_TRUE(errno == EINVAL);

How is this an EINVAL case?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20683#discussion_r1766138433
PR Review Comment: https://git.openjdk.org/jdk/pull/20683#discussion_r1766140771


More information about the serviceability-dev mailing list