comparison src/os/linux/vm/os_linux.inline.hpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children fcbfc50865ab
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 1999-2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 inline void* os::thread_local_storage_at(int index) {
26 return pthread_getspecific((pthread_key_t)index);
27 }
28
29 inline const char* os::file_separator() {
30 return "/";
31 }
32
33 inline const char* os::line_separator() {
34 return "\n";
35 }
36
37 inline const char* os::path_separator() {
38 return ":";
39 }
40
41 inline const char* os::jlong_format_specifier() {
42 return "%lld";
43 }
44
45 inline const char* os::julong_format_specifier() {
46 return "%llu";
47 }
48
49 // File names are case-sensitive on windows only
50 inline int os::file_name_strcmp(const char* s1, const char* s2) {
51 return strcmp(s1, s2);
52 }
53
54 inline bool os::obsolete_option(const JavaVMOption *option) {
55 return false;
56 }
57
58 inline bool os::uses_stack_guard_pages() {
59 return true;
60 }
61
62 inline bool os::allocate_stack_guard_pages() {
63 assert(uses_stack_guard_pages(), "sanity check");
64 return true;
65 }
66
67
68 // On Linux, reservations are made on a page by page basis, nothing to do.
69 inline void os::split_reserved_memory(char *base, size_t size,
70 size_t split, bool realloc) {
71 }
72
73
74 // Bang the shadow pages if they need to be touched to be mapped.
75 inline void os::bang_stack_shadow_pages() {
76 }
77
78 inline DIR* os::opendir(const char* dirname)
79 {
80 assert(dirname != NULL, "just checking");
81 return ::opendir(dirname);
82 }
83
84 inline int os::readdir_buf_size(const char *path)
85 {
86 return NAME_MAX + sizeof(dirent) + 1;
87 }
88
89 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
90 {
91 dirent* p;
92 int status;
93 assert(dirp != NULL, "just checking");
94
95 // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
96 // version. Here is the doc for this function:
97 // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
98
99 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
100 errno = status;
101 return NULL;
102 } else
103 return p;
104 }
105
106 inline int os::closedir(DIR *dirp)
107 {
108 assert(dirp != NULL, "just checking");
109 return ::closedir(dirp);
110 }
111
112 // macros for restartable system calls
113
114 #define RESTARTABLE(_cmd, _result) do { \
115 _result = _cmd; \
116 } while(((int)_result == OS_ERR) && (errno == EINTR))
117
118 #define RESTARTABLE_RETURN_INT(_cmd) do { \
119 int _result; \
120 RESTARTABLE(_cmd, _result); \
121 return _result; \
122 } while(false)