annotate src/os/posix/vm/os_posix.cpp @ 7433:730cc4ddd550

7173959: Jvm crashed during coherence exabus (tmb) testing Summary: Mapping of aligned memory needs to be MT safe. Also reviewed by: vitalyd@gmail.com Reviewed-by: dholmes, coleenp, zgu
author brutisso
date Mon, 17 Dec 2012 08:49:20 +0100
parents b9a9ed0f8eeb
children 754c24457b20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
1 /*
6842
b9a9ed0f8eeb 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 6200
diff changeset
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
4 *
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
7 * published by the Free Software Foundation.
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
8 *
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
13 * accompanied this code).
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
14 *
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
18 *
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
21 * questions.
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
22 *
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
23 */
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
24
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
25 #include "prims/jvm.h"
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
26 #include "runtime/frame.inline.hpp"
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
27 #include "runtime/os.hpp"
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
28 #include "utilities/vmError.hpp"
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
29
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
30 #include <unistd.h>
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
31 #include <sys/resource.h>
6080
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
32 #include <sys/utsname.h>
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
33
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
34
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
35 // Check core dump limit and report possible place where core can be found
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
36 void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
6200
65906dc96aa1 7129724: MAC: Core file location is wrong in crash report
mikael
parents: 6197
diff changeset
37 int n;
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
38 struct rlimit rlim;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
39 bool success;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
40
6200
65906dc96aa1 7129724: MAC: Core file location is wrong in crash report
mikael
parents: 6197
diff changeset
41 n = get_core_path(buffer, bufferSize);
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
42
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
43 if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
6200
65906dc96aa1 7129724: MAC: Core file location is wrong in crash report
mikael
parents: 6197
diff changeset
44 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (may not exist)", current_process_id());
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
45 success = true;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
46 } else {
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
47 switch(rlim.rlim_cur) {
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
48 case RLIM_INFINITY:
6200
65906dc96aa1 7129724: MAC: Core file location is wrong in crash report
mikael
parents: 6197
diff changeset
49 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d", current_process_id());
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
50 success = true;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
51 break;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
52 case 0:
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
53 jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
54 success = false;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
55 break;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
56 default:
6200
65906dc96aa1 7129724: MAC: Core file location is wrong in crash report
mikael
parents: 6197
diff changeset
57 jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
2204
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
58 success = true;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
59 break;
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
60 }
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
61 }
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
62 VMError::report_coredump_status(buffer, success);
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
63 }
63d374c54045 7014918: Improve core/minidump handling in Hotspot
ctornqvi
parents:
diff changeset
64
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
65 address os::get_caller_pc(int n) {
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
66 #ifdef _NMT_NOINLINE_
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
67 n ++;
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
68 #endif
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
69 frame fr = os::current_frame();
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
70 while (n > 0 && fr.pc() &&
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
71 !os::is_first_C_frame(&fr) && fr.sender_pc()) {
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
72 fr = os::get_sender_for_C_frame(&fr);
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
73 n --;
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
74 }
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
75 if (n == 0) {
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
76 return fr.pc();
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
77 } else {
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
78 return NULL;
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
79 }
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
80 }
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 6080
diff changeset
81
4750
b16494a69d3d 7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents: 2302
diff changeset
82 int os::get_last_error() {
b16494a69d3d 7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents: 2302
diff changeset
83 return errno;
b16494a69d3d 7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents: 2302
diff changeset
84 }
b16494a69d3d 7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents: 2302
diff changeset
85
2302
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
86 bool os::is_debugger_attached() {
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
87 // not implemented
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
88 return false;
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
89 }
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
90
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
91 void os::wait_for_keypress_at_exit(void) {
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
92 // don't do anything on posix platforms
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
93 return;
da091bb67459 7022037: Pause when exiting if debugger is attached on windows
sla
parents: 2204
diff changeset
94 }
6080
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
95
7433
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
96 // Multiple threads can race in this code, and can remap over each other with MAP_FIXED,
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
97 // so on posix, unmap the section at the start and at the end of the chunk that we mapped
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
98 // rather than unmapping and remapping the whole chunk to get requested alignment.
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
99 char* os::reserve_memory_aligned(size_t size, size_t alignment) {
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
100 assert((alignment & (os::vm_allocation_granularity() - 1)) == 0,
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
101 "Alignment must be a multiple of allocation granularity (page size)");
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
102 assert((size & (alignment -1)) == 0, "size must be 'alignment' aligned");
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
103
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
104 size_t extra_size = size + alignment;
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
105 assert(extra_size >= size, "overflow, size is too large to allow alignment");
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
106
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
107 char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
108
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
109 if (extra_base == NULL) {
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
110 return NULL;
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
111 }
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
112
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
113 // Do manual alignment
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
114 char* aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
115
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
116 // [ | | ]
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
117 // ^ extra_base
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
118 // ^ extra_base + begin_offset == aligned_base
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
119 // extra_base + begin_offset + size ^
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
120 // extra_base + extra_size ^
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
121 // |<>| == begin_offset
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
122 // end_offset == |<>|
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
123 size_t begin_offset = aligned_base - extra_base;
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
124 size_t end_offset = (extra_base + extra_size) - (aligned_base + size);
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
125
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
126 if (begin_offset > 0) {
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
127 os::release_memory(extra_base, begin_offset);
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
128 }
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
129
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
130 if (end_offset > 0) {
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
131 os::release_memory(extra_base + begin_offset + size, end_offset);
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
132 }
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
133
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
134 return aligned_base;
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
135 }
730cc4ddd550 7173959: Jvm crashed during coherence exabus (tmb) testing
brutisso
parents: 6842
diff changeset
136
6080
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
137 void os::Posix::print_load_average(outputStream* st) {
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
138 st->print("load average:");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
139 double loadavg[3];
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
140 os::loadavg(loadavg, 3);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
141 st->print("%0.02f %0.02f %0.02f", loadavg[0], loadavg[1], loadavg[2]);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
142 st->cr();
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
143 }
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
144
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
145 void os::Posix::print_rlimit_info(outputStream* st) {
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
146 st->print("rlimit:");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
147 struct rlimit rlim;
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
148
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
149 st->print(" STACK ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
150 getrlimit(RLIMIT_STACK, &rlim);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
151 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
152 else st->print("%uk", rlim.rlim_cur >> 10);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
153
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
154 st->print(", CORE ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
155 getrlimit(RLIMIT_CORE, &rlim);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
156 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
157 else st->print("%uk", rlim.rlim_cur >> 10);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
158
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
159 //Isn't there on solaris
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
160 #ifndef TARGET_OS_FAMILY_solaris
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
161 st->print(", NPROC ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
162 getrlimit(RLIMIT_NPROC, &rlim);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
163 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
164 else st->print("%d", rlim.rlim_cur);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
165 #endif
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
166
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
167 st->print(", NOFILE ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
168 getrlimit(RLIMIT_NOFILE, &rlim);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
169 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
170 else st->print("%d", rlim.rlim_cur);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
171
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
172 st->print(", AS ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
173 getrlimit(RLIMIT_AS, &rlim);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
174 if (rlim.rlim_cur == RLIM_INFINITY) st->print("infinity");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
175 else st->print("%uk", rlim.rlim_cur >> 10);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
176 st->cr();
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
177 }
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
178
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
179 void os::Posix::print_uname_info(outputStream* st) {
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
180 // kernel
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
181 st->print("uname:");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
182 struct utsname name;
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
183 uname(&name);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
184 st->print(name.sysname); st->print(" ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
185 st->print(name.release); st->print(" ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
186 st->print(name.version); st->print(" ");
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
187 st->print(name.machine);
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
188 st->cr();
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
189 }
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
190
7432b9db36ff 7165755: OS Information much longer on linux than other platforms
nloodin
parents: 4750
diff changeset
191