26 #include "runtime/os.hpp" |
26 #include "runtime/os.hpp" |
27 #include "utilities/vmError.hpp" |
27 #include "utilities/vmError.hpp" |
28 |
28 |
29 #include <unistd.h> |
29 #include <unistd.h> |
30 #include <sys/resource.h> |
30 #include <sys/resource.h> |
|
31 #include <sys/utsname.h> |
|
32 |
31 |
33 |
32 // Check core dump limit and report possible place where core can be found |
34 // Check core dump limit and report possible place where core can be found |
33 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { |
35 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) { |
34 struct rlimit rlim; |
36 struct rlimit rlim; |
35 static char cwd[O_BUFLEN]; |
37 static char cwd[O_BUFLEN]; |
70 |
72 |
71 void os::wait_for_keypress_at_exit(void) { |
73 void os::wait_for_keypress_at_exit(void) { |
72 // don't do anything on posix platforms |
74 // don't do anything on posix platforms |
73 return; |
75 return; |
74 } |
76 } |
|
77 |
|
78 void os::Posix::print_load_average(outputStream* st) { |
|
79 st->print("load average:"); |
|
80 double loadavg[3]; |
|
81 os::loadavg(loadavg, 3); |
|
82 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]); |
|
83 st->cr(); |
|
84 } |
|
85 |
|
86 void os::Posix::print_rlimit_info(outputStream* st) { |
|
87 st->print("rlimit:"); |
|
88 struct rlimit rlim; |
|
89 |
|
90 st->print(" STACK "); |
|
91 getrlimit(RLIMIT_STACK, &rlim); |
|
92 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); |
|
93 else st->print("%uk", rlim.rlim_cur >> 10); |
|
94 |
|
95 st->print(", CORE "); |
|
96 getrlimit(RLIMIT_CORE, &rlim); |
|
97 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); |
|
98 else st->print("%uk", rlim.rlim_cur >> 10); |
|
99 |
|
100 //Isn't there on solaris |
|
101 #ifndef TARGET_OS_FAMILY_solaris |
|
102 st->print(", NPROC "); |
|
103 getrlimit(RLIMIT_NPROC, &rlim); |
|
104 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); |
|
105 else st->print("%d", rlim.rlim_cur); |
|
106 #endif |
|
107 |
|
108 st->print(", NOFILE "); |
|
109 getrlimit(RLIMIT_NOFILE, &rlim); |
|
110 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); |
|
111 else st->print("%d", rlim.rlim_cur); |
|
112 |
|
113 st->print(", AS "); |
|
114 getrlimit(RLIMIT_AS, &rlim); |
|
115 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity"); |
|
116 else st->print("%uk", rlim.rlim_cur >> 10); |
|
117 st->cr(); |
|
118 } |
|
119 |
|
120 void os::Posix::print_uname_info(outputStream* st) { |
|
121 // kernel |
|
122 st->print("uname:"); |
|
123 struct utsname name; |
|
124 uname(&name); |
|
125 st->print(name.sysname); st->print(" "); |
|
126 st->print(name.release); st->print(" "); |
|
127 st->print(name.version); st->print(" "); |
|
128 st->print(name.machine); |
|
129 st->cr(); |
|
130 } |
|
131 |
|
132 |