8224958: add os::dll_load calls to event log

Reviewed-by: dholmes, mdoerr, stuefe
This commit is contained in:
Matthias Baesken 2019-06-05 16:53:52 +02:00
parent 189345db4a
commit 0bf2650bb1
5 changed files with 59 additions and 21 deletions

View file

@ -1881,8 +1881,17 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf,
int ebuflen) {
void * result = ::dlopen(filename, RTLD_LAZY);
if (result == NULL) {
::strncpy(ebuf, ::dlerror(), ebuflen - 1);
ebuf[ebuflen-1] = '\0';
const char* error_report = ::dlerror();
if (error_report == NULL) {
error_report = "dlerror returned no error description";
}
if (ebuf != NULL && ebuflen > 0) {
::strncpy(ebuf, error_report, ebuflen-1);
ebuf[ebuflen-1]='\0';
}
Events::log(NULL, "Loading shared library %s failed, %s", filename, error_report);
} else {
Events::log(NULL, "Loaded shared library %s", filename);
}
return result;
}