8210964: add more ld preloading related info to hs_error file on Linux

Reviewed-by: clanger, stuefe
This commit is contained in:
Matthias Baesken 2018-09-28 09:20:46 +02:00
parent b20e2cd963
commit 36f62aa6c0
2 changed files with 13 additions and 1 deletions

View file

@ -1877,12 +1877,16 @@ void* os::get_default_process_handle() {
return (void*)::dlopen(NULL, RTLD_LAZY);
}
static bool _print_ascii_file(const char* filename, outputStream* st) {
static bool _print_ascii_file(const char* filename, outputStream* st, const char* hdr = NULL) {
int fd = ::open(filename, O_RDONLY);
if (fd == -1) {
return false;
}
if (hdr != NULL) {
st->print_cr("%s", hdr);
}
char buf[33];
int bytes;
buf[32] = '\0';
@ -1975,6 +1979,8 @@ void os::print_os_info(outputStream* st) {
os::Linux::print_proc_sys_info(st);
os::Linux::print_ld_preload_file(st);
os::Linux::print_container_info(st);
}
@ -2133,6 +2139,11 @@ void os::Linux::print_full_memory_info(outputStream* st) {
st->cr();
}
void os::Linux::print_ld_preload_file(outputStream* st) {
_print_ascii_file("/etc/ld.so.preload", st, "\n/etc/ld.so.preload:");
st->cr();
}
void os::Linux::print_container_info(outputStream* st) {
if (!OSContainer::is_containerized()) {
return;