RFR: JDK-8288003: log events for os::dll_unload [v4]

Yasumasa Suenaga ysuenaga at openjdk.java.net
Fri Jun 10 14:25:11 UTC 2022


On Fri, 10 Jun 2022 07:38:03 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Currently we only log events for os::dll_load, but not for os::dll_unload, this patch adds it. On some platforms (Linux/Windows) we can use OS APIs (e.g. dlinfo on Linux) to log the path of the unloaded shared lib.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   dll_path on Linux - add NULL check, change special output to not available

src/hotspot/os/linux/os_linux.cpp line 1791:

> 1789: const char* os::Linux::dll_path(void* lib) {
> 1790:   struct link_map *lmap;
> 1791:   const char* l_path = "<not available>";

To be honest, I prefer to return NULL if `dlinfo` is failed.
IIUC the caller expects return dll path of `lib` - `<not available>` is not the path.

I think it is better that alternative string would be set by the caller (`os::dll_unload()`) like a change of os_windows. But I do not stick my opinion. I'm ok if other reviewer approve your change.

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

> 1239:   char name[MAX_PATH];
> 1240:   if (::GetModuleFileName((HMODULE)lib, name, sizeof(name)) == 0) {
> 1241:     name[0] = '\0';

Should we set `<not available>` to `name` like a change for linux code?

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

PR: https://git.openjdk.org/jdk/pull/9101


More information about the hotspot-runtime-dev mailing list