changeset 51942:1d12935177ed

8210964: add more ld preloading related info to hs_error file on Linux Reviewed-by: clanger, stuefe
author mbaesken
date Fri, 28 Sep 2018 09:20:46 +0200
parents 0f7d0bb6cfe2
children 5e9c922eafbc
files src/hotspot/os/linux/os_linux.cpp src/hotspot/os/linux/os_linux.hpp
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/os/linux/os_linux.cpp	Thu Sep 27 15:56:40 2018 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp	Fri Sep 28 09:20:46 2018 +0200
@@ -1877,12 +1877,16 @@
   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 @@
 
   os::Linux::print_proc_sys_info(st);
 
+  os::Linux::print_ld_preload_file(st);
+
   os::Linux::print_container_info(st);
 }
 
@@ -2133,6 +2139,11 @@
   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;
--- a/src/hotspot/os/linux/os_linux.hpp	Thu Sep 27 15:56:40 2018 -0700
+++ b/src/hotspot/os/linux/os_linux.hpp	Fri Sep 28 09:20:46 2018 +0200
@@ -114,6 +114,7 @@
   static void print_distro_info(outputStream* st);
   static void print_libversion_info(outputStream* st);
   static void print_proc_sys_info(outputStream* st);
+  static void print_ld_preload_file(outputStream* st);
 
  public:
   static bool _stack_is_executable;