annotate src/os/linux/vm/os_linux.inline.hpp @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents fcbfc50865ab
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 141
diff changeset
2 * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 inline void* os::thread_local_storage_at(int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
26 return pthread_getspecific((pthread_key_t)index);
a61af66fc99e Initial load
duke
parents:
diff changeset
27 }
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 inline const char* os::file_separator() {
a61af66fc99e Initial load
duke
parents:
diff changeset
30 return "/";
a61af66fc99e Initial load
duke
parents:
diff changeset
31 }
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 inline const char* os::line_separator() {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 return "\n";
a61af66fc99e Initial load
duke
parents:
diff changeset
35 }
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 inline const char* os::path_separator() {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 return ":";
a61af66fc99e Initial load
duke
parents:
diff changeset
39 }
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 inline const char* os::jlong_format_specifier() {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 return "%lld";
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 inline const char* os::julong_format_specifier() {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 return "%llu";
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // File names are case-sensitive on windows only
a61af66fc99e Initial load
duke
parents:
diff changeset
50 inline int os::file_name_strcmp(const char* s1, const char* s2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 return strcmp(s1, s2);
a61af66fc99e Initial load
duke
parents:
diff changeset
52 }
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 inline bool os::obsolete_option(const JavaVMOption *option) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57
a61af66fc99e Initial load
duke
parents:
diff changeset
58 inline bool os::uses_stack_guard_pages() {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 inline bool os::allocate_stack_guard_pages() {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 assert(uses_stack_guard_pages(), "sanity check");
a61af66fc99e Initial load
duke
parents:
diff changeset
64 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // On Linux, reservations are made on a page by page basis, nothing to do.
a61af66fc99e Initial load
duke
parents:
diff changeset
69 inline void os::split_reserved_memory(char *base, size_t size,
a61af66fc99e Initial load
duke
parents:
diff changeset
70 size_t split, bool realloc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Bang the shadow pages if they need to be touched to be mapped.
a61af66fc99e Initial load
duke
parents:
diff changeset
75 inline void os::bang_stack_shadow_pages() {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 inline DIR* os::opendir(const char* dirname)
a61af66fc99e Initial load
duke
parents:
diff changeset
79 {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 assert(dirname != NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
81 return ::opendir(dirname);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 inline int os::readdir_buf_size(const char *path)
a61af66fc99e Initial load
duke
parents:
diff changeset
85 {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 return NAME_MAX + sizeof(dirent) + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
a61af66fc99e Initial load
duke
parents:
diff changeset
90 {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 dirent* p;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 int status;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 assert(dirp != NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // version. Here is the doc for this function:
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 errno = status;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 } else
a61af66fc99e Initial load
duke
parents:
diff changeset
103 return p;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 inline int os::closedir(DIR *dirp)
a61af66fc99e Initial load
duke
parents:
diff changeset
107 {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 assert(dirp != NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
109 return ::closedir(dirp);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // macros for restartable system calls
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 #define RESTARTABLE(_cmd, _result) do { \
a61af66fc99e Initial load
duke
parents:
diff changeset
115 _result = _cmd; \
a61af66fc99e Initial load
duke
parents:
diff changeset
116 } while(((int)_result == OS_ERR) && (errno == EINTR))
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 #define RESTARTABLE_RETURN_INT(_cmd) do { \
a61af66fc99e Initial load
duke
parents:
diff changeset
119 int _result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
120 RESTARTABLE(_cmd, _result); \
a61af66fc99e Initial load
duke
parents:
diff changeset
121 return _result; \
a61af66fc99e Initial load
duke
parents:
diff changeset
122 } while(false)
141
fcbfc50865ab 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 0
diff changeset
123
fcbfc50865ab 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 0
diff changeset
124 inline bool os::numa_has_static_binding() { return true; }
fcbfc50865ab 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 0
diff changeset
125 inline bool os::numa_has_group_homing() { return false; }