aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornloodin <none@none>2012-05-10 15:44:19 +0200
committernloodin <none@none>2012-05-10 15:44:19 +0200
commit6921eca982212a5811d4c96d75150641889bff8d (patch)
treeb49b1d7492da725d4b9b1845bdfe8ec54a37a146 /src
parentbeb3c0a1a44f7df71515bac545a10612b75786b9 (diff)
7165755: OS Information much longer on linux than other platforms
Reviewed-by: sla, dholmes
Diffstat (limited to 'src')
-rw-r--r--src/os/bsd/vm/os_bsd.cpp90
-rw-r--r--src/os/linux/vm/os_linux.cpp116
-rw-r--r--src/os/linux/vm/os_linux.hpp4
-rw-r--r--src/os/posix/vm/os_posix.cpp58
-rw-r--r--src/os/posix/vm/os_posix.hpp41
-rw-r--r--src/os/solaris/vm/os_solaris.cpp77
-rw-r--r--src/os/solaris/vm/os_solaris.hpp3
-rw-r--r--src/os/windows/vm/os_windows.cpp8
-rw-r--r--src/os/windows/vm/os_windows.hpp3
-rw-r--r--src/share/vm/runtime/os.hpp4
10 files changed, 207 insertions, 197 deletions
diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp
index 5643798bc..f9b21acb4 100644
--- a/src/os/bsd/vm/os_bsd.cpp
+++ b/src/os/bsd/vm/os_bsd.cpp
@@ -2340,93 +2340,21 @@ void os::print_dll_info(outputStream *st) {
#endif
}
+void os::print_os_info_brief(outputStream* st) {
+ st->print("Bsd");
+
+ os::Posix::print_uname_info(st);
+}
void os::print_os_info(outputStream* st) {
st->print("OS:");
+ st->print("Bsd");
- // Try to identify popular distros.
- // Most Bsd distributions have /etc/XXX-release file, which contains
- // the OS version string. Some have more than one /etc/XXX-release file
- // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
- // so the order is important.
- if (!_print_ascii_file("/etc/mandrake-release", st) &&
- !_print_ascii_file("/etc/sun-release", st) &&
- !_print_ascii_file("/etc/redhat-release", st) &&
- !_print_ascii_file("/etc/SuSE-release", st) &&
- !_print_ascii_file("/etc/turbobsd-release", st) &&
- !_print_ascii_file("/etc/gentoo-release", st) &&
- !_print_ascii_file("/etc/debian_version", st) &&
- !_print_ascii_file("/etc/ltib-release", st) &&
- !_print_ascii_file("/etc/angstrom-version", st)) {
- st->print("Bsd");
- }
- st->cr();
-
- // kernel
- st->print("uname:");
- struct utsname name;
- uname(&name);
- st->print(name.sysname); st->print(" ");
- st->print(name.release); st->print(" ");
- st->print(name.version); st->print(" ");
- st->print(name.machine);
- st->cr();
-
-#ifndef _ALLBSD_SOURCE
- // Print warning if unsafe chroot environment detected
- if (unsafe_chroot_detected) {
- st->print("WARNING!! ");
- st->print_cr(unstable_chroot_error);
- }
-
- // libc, pthread
- st->print("libc:");
- st->print(os::Bsd::glibc_version()); st->print(" ");
- st->print(os::Bsd::libpthread_version()); st->print(" ");
- if (os::Bsd::is_BsdThreads()) {
- st->print("(%s stack)", os::Bsd::is_floating_stack() ? "floating" : "fixed");
- }
- st->cr();
-#endif
-
- // rlimit
- st->print("rlimit:");
- struct rlimit rlim;
-
- st->print(" STACK ");
- getrlimit(RLIMIT_STACK, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
-
- st->print(", CORE ");
- getrlimit(RLIMIT_CORE, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
+ os::Posix::print_uname_info(st);
- st->print(", NPROC ");
- getrlimit(RLIMIT_NPROC, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%d", rlim.rlim_cur);
+ os::Posix::print_rlimit_info(st);
- st->print(", NOFILE ");
- getrlimit(RLIMIT_NOFILE, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%d", rlim.rlim_cur);
-
-#ifndef _ALLBSD_SOURCE
- st->print(", AS ");
- getrlimit(RLIMIT_AS, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
- st->cr();
-
- // load average
- st->print("load average:");
- double loadavg[3];
- os::loadavg(loadavg, 3);
- st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
- st->cr();
-#endif
+ os::Posix::print_load_average(st);
}
void os::pd_print_cpu_info(outputStream* st) {
diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp
index 0297df4dc..53457ec8d 100644
--- a/src/os/linux/vm/os_linux.cpp
+++ b/src/os/linux/vm/os_linux.cpp
@@ -2020,15 +2020,43 @@ void os::print_dll_info(outputStream *st) {
}
}
+void os::print_os_info_brief(outputStream* st) {
+ os::Linux::print_distro_info(st);
+
+ os::Posix::print_uname_info(st);
+
+ os::Linux::print_libversion_info(st);
+
+}
void os::print_os_info(outputStream* st) {
st->print("OS:");
- // Try to identify popular distros.
- // Most Linux distributions have /etc/XXX-release file, which contains
- // the OS version string. Some have more than one /etc/XXX-release file
- // (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
- // so the order is important.
+ os::Linux::print_distro_info(st);
+
+ os::Posix::print_uname_info(st);
+
+ // Print warning if unsafe chroot environment detected
+ if (unsafe_chroot_detected) {
+ st->print("WARNING!! ");
+ st->print_cr(unstable_chroot_error);
+ }
+
+ os::Linux::print_libversion_info(st);
+
+ os::Posix::print_rlimit_info(st);
+
+ os::Posix::print_load_average(st);
+
+ os::Linux::print_full_memory_info(st);
+}
+
+// Try to identify popular distros.
+// Most Linux distributions have /etc/XXX-release file, which contains
+// the OS version string. Some have more than one /etc/XXX-release file
+// (e.g. Mandrake has both /etc/mandrake-release and /etc/redhat-release.),
+// so the order is important.
+void os::Linux::print_distro_info(outputStream* st) {
if (!_print_ascii_file("/etc/mandrake-release", st) &&
!_print_ascii_file("/etc/sun-release", st) &&
!_print_ascii_file("/etc/redhat-release", st) &&
@@ -2041,23 +2069,9 @@ void os::print_os_info(outputStream* st) {
st->print("Linux");
}
st->cr();
+}
- // kernel
- st->print("uname:");
- struct utsname name;
- uname(&name);
- st->print(name.sysname); st->print(" ");
- st->print(name.release); st->print(" ");
- st->print(name.version); st->print(" ");
- st->print(name.machine);
- st->cr();
-
- // Print warning if unsafe chroot environment detected
- if (unsafe_chroot_detected) {
- st->print("WARNING!! ");
- st->print_cr(unstable_chroot_error);
- }
-
+void os::Linux::print_libversion_info(outputStream* st) {
// libc, pthread
st->print("libc:");
st->print(os::Linux::glibc_version()); st->print(" ");
@@ -2066,56 +2080,12 @@ void os::print_os_info(outputStream* st) {
st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
}
st->cr();
-
- // rlimit
- st->print("rlimit:");
- struct rlimit rlim;
-
- st->print(" STACK ");
- getrlimit(RLIMIT_STACK, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
-
- st->print(", CORE ");
- getrlimit(RLIMIT_CORE, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
-
- st->print(", NPROC ");
- getrlimit(RLIMIT_NPROC, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%d", rlim.rlim_cur);
-
- st->print(", NOFILE ");
- getrlimit(RLIMIT_NOFILE, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%d", rlim.rlim_cur);
-
- st->print(", AS ");
- getrlimit(RLIMIT_AS, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
- st->cr();
-
- // load average
- st->print("load average:");
- double loadavg[3];
- os::loadavg(loadavg, 3);
- st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
- st->cr();
-
- // meminfo
- st->print("\n/proc/meminfo:\n");
- _print_ascii_file("/proc/meminfo", st);
- st->cr();
}
-void os::pd_print_cpu_info(outputStream* st) {
- st->print("\n/proc/cpuinfo:\n");
- if (!_print_ascii_file("/proc/cpuinfo", st)) {
- st->print(" <Not Available>");
- }
- st->cr();
+void os::Linux::print_full_memory_info(outputStream* st) {
+ st->print("\n/proc/meminfo:\n");
+ _print_ascii_file("/proc/meminfo", st);
+ st->cr();
}
void os::print_memory_info(outputStream* st) {
@@ -2138,6 +2108,14 @@ void os::print_memory_info(outputStream* st) {
st->cr();
}
+void os::pd_print_cpu_info(outputStream* st) {
+ st->print("\n/proc/cpuinfo:\n");
+ if (!_print_ascii_file("/proc/cpuinfo", st)) {
+ st->print(" <Not Available>");
+ }
+ st->cr();
+}
+
// Taken from /usr/include/bits/siginfo.h Supposed to be architecture specific
// but they're the same for all the linux arch that we support
// and they're the same for solaris but there's no common place to put this.
diff --git a/src/os/linux/vm/os_linux.hpp b/src/os/linux/vm/os_linux.hpp
index ec32232f4..7c19517e2 100644
--- a/src/os/linux/vm/os_linux.hpp
+++ b/src/os/linux/vm/os_linux.hpp
@@ -89,6 +89,10 @@ class Linux {
static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
+ static void print_full_memory_info(outputStream* st);
+ static void print_distro_info(outputStream* st);
+ static void print_libversion_info(outputStream* st);
+
public:
static void init_thread_fpu_state();
static int get_fpu_control_word();
diff --git a/src/os/posix/vm/os_posix.cpp b/src/os/posix/vm/os_posix.cpp
index 42078342e..9f05a74a4 100644
--- a/src/os/posix/vm/os_posix.cpp
+++ b/src/os/posix/vm/os_posix.cpp
@@ -28,6 +28,8 @@
#include <unistd.h>
#include <sys/resource.h>
+#include <sys/utsname.h>
+
// Check core dump limit and report possible place where core can be found
void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
@@ -72,3 +74,59 @@ void os::wait_for_keypress_at_exit(void) {
// don't do anything on posix platforms
return;
}
+
+void os::Posix::print_load_average(outputStream* st) {
+ st->print("load average:");
+ double loadavg[3];
+ os::loadavg(loadavg, 3);
+ st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
+ st->cr();
+}
+
+void os::Posix::print_rlimit_info(outputStream* st) {
+ st->print("rlimit:");
+ struct rlimit rlim;
+
+ st->print(" STACK ");
+ getrlimit(RLIMIT_STACK, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%uk", rlim.rlim_cur >> 10);
+
+ st->print(", CORE ");
+ getrlimit(RLIMIT_CORE, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%uk", rlim.rlim_cur >> 10);
+
+ //Isn't there on solaris
+#ifndef TARGET_OS_FAMILY_solaris
+ st->print(", NPROC ");
+ getrlimit(RLIMIT_NPROC, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%d", rlim.rlim_cur);
+#endif
+
+ st->print(", NOFILE ");
+ getrlimit(RLIMIT_NOFILE, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%d", rlim.rlim_cur);
+
+ st->print(", AS ");
+ getrlimit(RLIMIT_AS, &rlim);
+ if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
+ else st->print("%uk", rlim.rlim_cur >> 10);
+ st->cr();
+}
+
+void os::Posix::print_uname_info(outputStream* st) {
+ // kernel
+ st->print("uname:");
+ struct utsname name;
+ uname(&name);
+ st->print(name.sysname); st->print(" ");
+ st->print(name.release); st->print(" ");
+ st->print(name.version); st->print(" ");
+ st->print(name.machine);
+ st->cr();
+}
+
+
diff --git a/src/os/posix/vm/os_posix.hpp b/src/os/posix/vm/os_posix.hpp
new file mode 100644
index 000000000..62ec7135d
--- /dev/null
+++ b/src/os/posix/vm/os_posix.hpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_POSIX_VM_OS_POSIX_HPP
+#define OS_POSIX_VM_OS_POSIX_HPP
+class Posix {
+ friend class os;
+
+protected:
+ static void print_distro_info(outputStream* st);
+ static void print_rlimit_info(outputStream* st);
+ static void print_uname_info(outputStream* st);
+ static void print_libversion_info(outputStream* st);
+ static void print_load_average(outputStream* st);
+
+
+};
+
+
+#endif
diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp
index 31bd41862..c3389a477 100644
--- a/src/os/solaris/vm/os_solaris.cpp
+++ b/src/os/solaris/vm/os_solaris.cpp
@@ -2242,61 +2242,44 @@ static bool _print_ascii_file(const char* filename, outputStream* st) {
return true;
}
+void os::print_os_info_brief(outputStream* st) {
+ os::Solaris::print_distro_info(st);
+
+ os::Posix::print_uname_info(st);
+
+ os::Solaris::print_libversion_info(st);
+}
+
void os::print_os_info(outputStream* st) {
st->print("OS:");
- if (!_print_ascii_file("/etc/release", st)) {
- st->print("Solaris");
- }
- st->cr();
+ os::Solaris::print_distro_info(st);
- // kernel
- st->print("uname:");
- struct utsname name;
- uname(&name);
- st->print(name.sysname); st->print(" ");
- st->print(name.release); st->print(" ");
- st->print(name.version); st->print(" ");
- st->print(name.machine);
-
- // libthread
- if (os::Solaris::T2_libthread()) st->print(" (T2 libthread)");
- else st->print(" (T1 libthread)");
- st->cr();
+ os::Posix::print_uname_info(st);
- // rlimit
- st->print("rlimit:");
- struct rlimit rlim;
-
- st->print(" STACK ");
- getrlimit(RLIMIT_STACK, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
-
- st->print(", CORE ");
- getrlimit(RLIMIT_CORE, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
-
- st->print(", NOFILE ");
- getrlimit(RLIMIT_NOFILE, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%d", rlim.rlim_cur);
-
- st->print(", AS ");
- getrlimit(RLIMIT_AS, &rlim);
- if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
- else st->print("%uk", rlim.rlim_cur >> 10);
- st->cr();
+ os::Solaris::print_libversion_info(st);
- // load average
- st->print("load average:");
- double loadavg[3];
- os::loadavg(loadavg, 3);
- st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
- st->cr();
+ os::Posix::print_rlimit_info(st);
+
+ os::Posix::print_load_average(st);
}
+void os::Solaris::print_distro_info(outputStream* st) {
+ if (!_print_ascii_file("/etc/release", st)) {
+ st->print("Solaris");
+ }
+ st->cr();
+}
+
+void os::Solaris::print_libversion_info(outputStream* st) {
+ if (os::Solaris::T2_libthread()) {
+ st->print(" (T2 libthread)");
+ }
+ else {
+ st->print(" (T1 libthread)");
+ }
+ st->cr();
+}
static bool check_addr0(outputStream* st) {
jboolean status = false;
diff --git a/src/os/solaris/vm/os_solaris.hpp b/src/os/solaris/vm/os_solaris.hpp
index 991cf0210..340aa4b77 100644
--- a/src/os/solaris/vm/os_solaris.hpp
+++ b/src/os/solaris/vm/os_solaris.hpp
@@ -180,6 +180,9 @@ class Solaris {
// proc_t structure (note that this is a system struct).
static address _main_stack_base;
+ static void print_distro_info(outputStream* st);
+ static void print_libversion_info(outputStream* st);
+
public:
static void libthread_init();
static void synchronization_init();
diff --git a/src/os/windows/vm/os_windows.cpp b/src/os/windows/vm/os_windows.cpp
index c607905e8..0a8ff6808 100644
--- a/src/os/windows/vm/os_windows.cpp
+++ b/src/os/windows/vm/os_windows.cpp
@@ -1562,9 +1562,17 @@ void os::print_dll_info(outputStream *st) {
enumerate_modules(pid, _print_module, (void *)st);
}
+void os::print_os_info_brief(outputStream* st) {
+ os::print_os_info(st);
+}
+
void os::print_os_info(outputStream* st) {
st->print("OS:");
+ os::win32::print_windows_version(st);
+}
+
+void os::win32::print_windows_version(outputStream* st) {
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
diff --git a/src/os/windows/vm/os_windows.hpp b/src/os/windows/vm/os_windows.hpp
index 353d595eb..e0692e5f2 100644
--- a/src/os/windows/vm/os_windows.hpp
+++ b/src/os/windows/vm/os_windows.hpp
@@ -27,6 +27,7 @@
// Win32_OS defines the interface to windows operating systems
class win32 {
+ friend class os;
protected:
static int _vm_page_size;
@@ -39,6 +40,8 @@ class win32 {
static bool _is_windows_2003;
static bool _is_windows_server;
+ static void print_windows_version(outputStream* st);
+
public:
// Windows-specific interface:
static void initialize_system_info();
diff --git a/src/share/vm/runtime/os.hpp b/src/share/vm/runtime/os.hpp
index dd163e9a9..68f8a3ab6 100644
--- a/src/share/vm/runtime/os.hpp
+++ b/src/share/vm/runtime/os.hpp
@@ -492,6 +492,7 @@ class os: AllStatic {
// Print out system information; they are called by fatal error handler.
// Output format may be different on different platforms.
static void print_os_info(outputStream* st);
+ static void print_os_info_brief(outputStream* st);
static void print_cpu_info(outputStream* st);
static void pd_print_cpu_info(outputStream* st);
static void print_memory_info(outputStream* st);
@@ -685,14 +686,17 @@ class os: AllStatic {
// Platform dependent stuff
#ifdef TARGET_OS_FAMILY_linux
# include "os_linux.hpp"
+# include "os_posix.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "os_solaris.hpp"
+# include "os_posix.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "os_windows.hpp"
#endif
#ifdef TARGET_OS_FAMILY_bsd
+# include "os_posix.hpp"
# include "os_bsd.hpp"
#endif
#ifdef TARGET_OS_ARCH_linux_x86