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

Fri, 11 Jul 2008 01:14:44 -0700

author
trims
date
Fri, 11 Jul 2008 01:14:44 -0700
changeset 670
9c2ecc2ffb12
parent 631
d1605aabd0a1
child 1907
c18cbe5936b8
permissions
-rw-r--r--

Merge

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

mercurial