src/os/linux/vm/os_linux.inline.hpp

Tue, 23 Nov 2010 13:22:55 -0800

author
stefank
date
Tue, 23 Nov 2010 13:22:55 -0800
changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
child 2322
828eafbd85cc
permissions
-rw-r--r--

6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef OS_LINUX_VM_OS_LINUX_INLINE_HPP
stefank@2314 26 #define OS_LINUX_VM_OS_LINUX_INLINE_HPP
stefank@2314 27
stefank@2314 28 #include "runtime/atomic.hpp"
stefank@2314 29 #include "runtime/os.hpp"
stefank@2314 30 #ifdef TARGET_OS_ARCH_linux_x86
stefank@2314 31 # include "atomic_linux_x86.inline.hpp"
stefank@2314 32 # include "orderAccess_linux_x86.inline.hpp"
stefank@2314 33 #endif
stefank@2314 34 #ifdef TARGET_OS_ARCH_linux_sparc
stefank@2314 35 # include "atomic_linux_sparc.inline.hpp"
stefank@2314 36 # include "orderAccess_linux_sparc.inline.hpp"
stefank@2314 37 #endif
stefank@2314 38 #ifdef TARGET_OS_ARCH_linux_zero
stefank@2314 39 # include "atomic_linux_zero.inline.hpp"
stefank@2314 40 # include "orderAccess_linux_zero.inline.hpp"
stefank@2314 41 #endif
stefank@2314 42
duke@435 43 inline void* os::thread_local_storage_at(int index) {
duke@435 44 return pthread_getspecific((pthread_key_t)index);
duke@435 45 }
duke@435 46
duke@435 47 inline const char* os::file_separator() {
duke@435 48 return "/";
duke@435 49 }
duke@435 50
duke@435 51 inline const char* os::line_separator() {
duke@435 52 return "\n";
duke@435 53 }
duke@435 54
duke@435 55 inline const char* os::path_separator() {
duke@435 56 return ":";
duke@435 57 }
duke@435 58
duke@435 59 inline const char* os::jlong_format_specifier() {
duke@435 60 return "%lld";
duke@435 61 }
duke@435 62
duke@435 63 inline const char* os::julong_format_specifier() {
duke@435 64 return "%llu";
duke@435 65 }
duke@435 66
duke@435 67 // File names are case-sensitive on windows only
duke@435 68 inline int os::file_name_strcmp(const char* s1, const char* s2) {
duke@435 69 return strcmp(s1, s2);
duke@435 70 }
duke@435 71
duke@435 72 inline bool os::obsolete_option(const JavaVMOption *option) {
duke@435 73 return false;
duke@435 74 }
duke@435 75
duke@435 76 inline bool os::uses_stack_guard_pages() {
duke@435 77 return true;
duke@435 78 }
duke@435 79
duke@435 80 inline bool os::allocate_stack_guard_pages() {
duke@435 81 assert(uses_stack_guard_pages(), "sanity check");
duke@435 82 return true;
duke@435 83 }
duke@435 84
duke@435 85
duke@435 86 // On Linux, reservations are made on a page by page basis, nothing to do.
duke@435 87 inline void os::split_reserved_memory(char *base, size_t size,
duke@435 88 size_t split, bool realloc) {
duke@435 89 }
duke@435 90
duke@435 91
duke@435 92 // Bang the shadow pages if they need to be touched to be mapped.
duke@435 93 inline void os::bang_stack_shadow_pages() {
duke@435 94 }
duke@435 95
duke@435 96 inline DIR* os::opendir(const char* dirname)
duke@435 97 {
duke@435 98 assert(dirname != NULL, "just checking");
duke@435 99 return ::opendir(dirname);
duke@435 100 }
duke@435 101
duke@435 102 inline int os::readdir_buf_size(const char *path)
duke@435 103 {
duke@435 104 return NAME_MAX + sizeof(dirent) + 1;
duke@435 105 }
duke@435 106
duke@435 107 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
duke@435 108 {
duke@435 109 dirent* p;
duke@435 110 int status;
duke@435 111 assert(dirp != NULL, "just checking");
duke@435 112
duke@435 113 // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
duke@435 114 // version. Here is the doc for this function:
duke@435 115 // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
duke@435 116
duke@435 117 if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
duke@435 118 errno = status;
duke@435 119 return NULL;
duke@435 120 } else
duke@435 121 return p;
duke@435 122 }
duke@435 123
duke@435 124 inline int os::closedir(DIR *dirp)
duke@435 125 {
duke@435 126 assert(dirp != NULL, "just checking");
duke@435 127 return ::closedir(dirp);
duke@435 128 }
duke@435 129
duke@435 130 // macros for restartable system calls
duke@435 131
duke@435 132 #define RESTARTABLE(_cmd, _result) do { \
duke@435 133 _result = _cmd; \
duke@435 134 } while(((int)_result == OS_ERR) && (errno == EINTR))
duke@435 135
duke@435 136 #define RESTARTABLE_RETURN_INT(_cmd) do { \
duke@435 137 int _result; \
duke@435 138 RESTARTABLE(_cmd, _result); \
duke@435 139 return _result; \
duke@435 140 } while(false)
iveresov@576 141
iveresov@576 142 inline bool os::numa_has_static_binding() { return true; }
iveresov@576 143 inline bool os::numa_has_group_homing() { return false; }
stefank@2314 144
stefank@2314 145 #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP

mercurial