On Mon, 19 Feb 2024 12:15:22 GMT, Joachim Kern <jk...@openjdk.org> wrote:
>>> 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. Thanks for the detailed explanation @JoKern65 . Do then in this errno check may not be necessary ? or can we still set errno and access it some way ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16604#discussion_r1494516185