8228902: add os::dll_load to the unified logging os category
Reviewed-by: coleenp, mdoerr
--- a/src/hotspot/os/aix/os_aix.cpp Mon Aug 05 16:27:30 2019 -0700
+++ b/src/hotspot/os/aix/os_aix.cpp Fri Aug 02 10:10:42 2019 +0200
@@ -1313,6 +1313,8 @@
// for the same architecture as Hotspot is running on.
void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
+ log_info(os)("attempting shared library load of %s", filename);
+
if (ebuf && ebuflen > 0) {
ebuf[0] = '\0';
ebuf[ebuflen - 1] = '\0';
@@ -1329,6 +1331,7 @@
Events::log(NULL, "Loaded shared library %s", filename);
// Reload dll cache. Don't do this in signal handling.
LoadedLibraries::reload();
+ log_info(os)("shared library load of %s was successful", filename);
return result;
} else {
// error analysis when dlopen fails
@@ -1341,6 +1344,7 @@
filename, ::getenv("LIBPATH"), ::getenv("LD_LIBRARY_PATH"), error_report);
}
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
+ log_info(os)("shared library load of %s failed, %s", filename, error_report);
}
return NULL;
}
--- a/src/hotspot/os/bsd/os_bsd.cpp Mon Aug 05 16:27:30 2019 -0700
+++ b/src/hotspot/os/bsd/os_bsd.cpp Fri Aug 02 10:10:42 2019 +0200
@@ -1263,10 +1263,13 @@
#ifdef STATIC_BUILD
return os::get_default_process_handle();
#else
+ log_info(os)("attempting shared library load of %s", filename);
+
void * result= ::dlopen(filename, RTLD_LAZY);
if (result != NULL) {
Events::log(NULL, "Loaded shared library %s", filename);
// Successful loading
+ log_info(os)("shared library load of %s was successful", filename);
return result;
}
@@ -1280,6 +1283,7 @@
ebuf[ebuflen-1]='\0';
}
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
+ log_info(os)("shared library load of %s failed, %s", filename, error_report);
return NULL;
#endif // STATIC_BUILD
@@ -1289,10 +1293,12 @@
#ifdef STATIC_BUILD
return os::get_default_process_handle();
#else
+ log_info(os)("attempting shared library load of %s", filename);
void * result= ::dlopen(filename, RTLD_LAZY);
if (result != NULL) {
Events::log(NULL, "Loaded shared library %s", filename);
// Successful loading
+ log_info(os)("shared library load of %s was successful", filename);
return result;
}
@@ -1308,6 +1314,7 @@
ebuf[ebuflen-1]='\0';
}
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
+ log_info(os)("shared library load of %s failed, %s", filename, error_report);
int diag_msg_max_length=ebuflen-strlen(ebuf);
char* diag_msg_buf=ebuf+strlen(ebuf);
--- a/src/hotspot/os/linux/os_linux.cpp Mon Aug 05 16:27:30 2019 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp Fri Aug 02 10:10:42 2019 +0200
@@ -1739,6 +1739,8 @@
void * result = NULL;
bool load_attempted = false;
+ log_info(os)("attempting shared library load of %s", filename);
+
// Check whether the library to load might change execution rights
// of the stack. If they are changed, the protection of the stack
// guard pages will be lost. We need a safepoint to fix this.
@@ -1990,8 +1992,10 @@
ebuf[ebuflen-1]='\0';
}
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
+ log_info(os)("shared library load of %s failed, %s", filename, error_report);
} else {
Events::log(NULL, "Loaded shared library %s", filename);
+ log_info(os)("shared library load of %s was successful", filename);
}
return result;
}
--- a/src/hotspot/os/solaris/os_solaris.cpp Mon Aug 05 16:27:30 2019 -0700
+++ b/src/hotspot/os/solaris/os_solaris.cpp Fri Aug 02 10:10:42 2019 +0200
@@ -1532,10 +1532,13 @@
// same architecture as Hotspot is running on
void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
+ log_info(os)("attempting shared library load of %s", filename);
+
void * result= ::dlopen(filename, RTLD_LAZY);
if (result != NULL) {
// Successful loading
Events::log(NULL, "Loaded shared library %s", filename);
+ log_info(os)("shared library load of %s was successful", filename);
return result;
}
@@ -1550,6 +1553,7 @@
}
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
+ log_info(os)("shared library load of %s failed, %s", filename, error_report);
int diag_msg_max_length=ebuflen-strlen(ebuf);
char* diag_msg_buf=ebuf+strlen(ebuf);
--- a/src/hotspot/os/windows/os_windows.cpp Mon Aug 05 16:27:30 2019 -0700
+++ b/src/hotspot/os/windows/os_windows.cpp Fri Aug 02 10:10:42 2019 +0200
@@ -1365,11 +1365,14 @@
// in case of error it checks if .dll/.so was built for the
// same architecture as Hotspot is running on
void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
+ log_info(os)("attempting shared library load of %s", name);
+
void * result = LoadLibrary(name);
if (result != NULL) {
Events::log(NULL, "Loaded shared library %s", name);
// Recalculate pdb search path if a DLL was loaded successfully.
SymbolEngine::recalc_search_path();
+ log_info(os)("shared library load of %s was successful", name);
return result;
}
DWORD errcode = GetLastError();
@@ -1378,6 +1381,7 @@
lasterror(ebuf, (size_t) ebuflen);
ebuf[ebuflen - 1] = '\0';
Events::log(NULL, "Loading shared library %s failed, error code %lu", name, errcode);
+ log_info(os)("shared library load of %s failed, error code %lu", name, errcode);
if (errcode == ERROR_MOD_NOT_FOUND) {
strncpy(ebuf, "Can't find dependent libraries", ebuflen - 1);