Mercurial > hg > truffle
annotate src/os/posix/vm/os_posix.cpp @ 5619:d50c788195a5
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 15 Jun 2012 13:17:04 +0200 |
parents | b16494a69d3d |
children | 7432b9db36ff |
rev | line source |
---|---|
2204 | 1 /* |
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 #include "prims/jvm.h" | |
26 #include "runtime/os.hpp" | |
27 #include "utilities/vmError.hpp" | |
28 | |
29 #include <unistd.h> | |
30 #include <sys/resource.h> | |
31 | |
32 // 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) { | |
34 struct rlimit rlim; | |
35 static char cwd[O_BUFLEN]; | |
36 bool success; | |
37 | |
38 get_current_directory(cwd, sizeof(cwd)); | |
39 | |
40 if (getrlimit(RLIMIT_CORE, &rlim) != 0) { | |
41 jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id()); | |
42 success = true; | |
43 } else { | |
44 switch(rlim.rlim_cur) { | |
45 case RLIM_INFINITY: | |
46 jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id()); | |
47 success = true; | |
48 break; | |
49 case 0: | |
50 jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again"); | |
51 success = false; | |
52 break; | |
53 default: | |
54 jio_snprintf(buffer, bufferSize, "%s/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", cwd, current_process_id(), (unsigned long)(rlim.rlim_cur >> 10)); | |
55 success = true; | |
56 break; | |
57 } | |
58 } | |
59 VMError::report_coredump_status(buffer, success); | |
60 } | |
61 | |
4750
b16494a69d3d
7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents:
2302
diff
changeset
|
62 int os::get_last_error() { |
b16494a69d3d
7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents:
2302
diff
changeset
|
63 return errno; |
b16494a69d3d
7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents:
2302
diff
changeset
|
64 } |
b16494a69d3d
7126185: Clean up lasterror handling, add os::get_last_error()
phh
parents:
2302
diff
changeset
|
65 |
2302
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
66 bool os::is_debugger_attached() { |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
67 // not implemented |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
68 return false; |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
69 } |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
70 |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
71 void os::wait_for_keypress_at_exit(void) { |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
72 // don't do anything on posix platforms |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
73 return; |
da091bb67459
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
2204
diff
changeset
|
74 } |