author | sla |
Mon, 28 Feb 2011 14:19:52 +0100 | |
changeset 8476 | 7e34c2d4cf9b |
parent 8119 | 81eef1b06988 |
child 11418 | 66ca80da30e2 |
permissions | -rw-r--r-- |
8119 | 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 |
||
8476
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
62 |
bool os::is_debugger_attached() { |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
63 |
// not implemented |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
64 |
return false; |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
65 |
} |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
66 |
|
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
67 |
void os::wait_for_keypress_at_exit(void) { |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
68 |
// don't do anything on posix platforms |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
69 |
return; |
7e34c2d4cf9b
7022037: Pause when exiting if debugger is attached on windows
sla
parents:
8119
diff
changeset
|
70 |
} |