On Mon, 19 Feb 2024 11:11:23 GMT, Suchismith Roy <s...@openjdk.org> wrote:
>> src/hotspot/os/aix/os_aix.cpp line 1181: >> >>> 1179: // First try to load the existing file. >>> 1180: result = dll_load_library(filename, ebuf, ebuflen); >>> 1181: int error_code = errno; >> >> this might not necessarily be the `errno` of the underlying `dlopen()`, >> because there is to much code in-between and branches without a `dlopen()` >> call. > >> this might not necessarily be the `errno` of the underlying `dlopen()`, >> because there is to much code in-between and branches without a `dlopen()` >> call. > > As i see the code in Aix_dlopen , there is no additional functional call > after the dlopen which might change the errno . Could you tell me the how the > errno would get overriden ? Suchi, errno is a global static variable. If some runtime API sets it, it will continue to have this value until the next runtime call updates it. If you call dll_load_library, there are many execution paths not passing dlopen(). So you receive an errno from some unknown runtime API called before. The correct errno handling is: errno = 0; runtime_API_which_might_set_errno_in_error_case(); error_code = errno; But what you really need is the result of the `search_file_in_LIBPATH(...)` call in `Aix_dlopen()`. If it is false, then the error_report starts with the string "Could not load module . ....." This is called in any case. A `dlopen()` is not called in any case. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16604#discussion_r1494459722