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

     1 /*
     2  * Copyright (c) 1999, 2010, 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  */
    25 #ifndef OS_LINUX_VM_OS_LINUX_INLINE_HPP
    26 #define OS_LINUX_VM_OS_LINUX_INLINE_HPP
    28 #include "runtime/atomic.hpp"
    29 #include "runtime/os.hpp"
    30 #ifdef TARGET_OS_ARCH_linux_x86
    31 # include "atomic_linux_x86.inline.hpp"
    32 # include "orderAccess_linux_x86.inline.hpp"
    33 #endif
    34 #ifdef TARGET_OS_ARCH_linux_sparc
    35 # include "atomic_linux_sparc.inline.hpp"
    36 # include "orderAccess_linux_sparc.inline.hpp"
    37 #endif
    38 #ifdef TARGET_OS_ARCH_linux_zero
    39 # include "atomic_linux_zero.inline.hpp"
    40 # include "orderAccess_linux_zero.inline.hpp"
    41 #endif
    43 inline void* os::thread_local_storage_at(int index) {
    44   return pthread_getspecific((pthread_key_t)index);
    45 }
    47 inline const char* os::file_separator() {
    48   return "/";
    49 }
    51 inline const char* os::line_separator() {
    52   return "\n";
    53 }
    55 inline const char* os::path_separator() {
    56   return ":";
    57 }
    59 inline const char* os::jlong_format_specifier() {
    60   return "%lld";
    61 }
    63 inline const char* os::julong_format_specifier() {
    64   return "%llu";
    65 }
    67 // File names are case-sensitive on windows only
    68 inline int os::file_name_strcmp(const char* s1, const char* s2) {
    69   return strcmp(s1, s2);
    70 }
    72 inline bool os::obsolete_option(const JavaVMOption *option) {
    73   return false;
    74 }
    76 inline bool os::uses_stack_guard_pages() {
    77   return true;
    78 }
    80 inline bool os::allocate_stack_guard_pages() {
    81   assert(uses_stack_guard_pages(), "sanity check");
    82   return true;
    83 }
    86 // On Linux, reservations are made on a page by page basis, nothing to do.
    87 inline void os::split_reserved_memory(char *base, size_t size,
    88                                       size_t split, bool realloc) {
    89 }
    92 // Bang the shadow pages if they need to be touched to be mapped.
    93 inline void os::bang_stack_shadow_pages() {
    94 }
    96 inline DIR* os::opendir(const char* dirname)
    97 {
    98   assert(dirname != NULL, "just checking");
    99   return ::opendir(dirname);
   100 }
   102 inline int os::readdir_buf_size(const char *path)
   103 {
   104   return NAME_MAX + sizeof(dirent) + 1;
   105 }
   107 inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
   108 {
   109   dirent* p;
   110   int status;
   111   assert(dirp != NULL, "just checking");
   113   // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
   114   // version. Here is the doc for this function:
   115   // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
   117   if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
   118     errno = status;
   119     return NULL;
   120   } else
   121     return p;
   122 }
   124 inline int os::closedir(DIR *dirp)
   125 {
   126   assert(dirp != NULL, "just checking");
   127   return ::closedir(dirp);
   128 }
   130 // macros for restartable system calls
   132 #define RESTARTABLE(_cmd, _result) do { \
   133     _result = _cmd; \
   134   } while(((int)_result == OS_ERR) && (errno == EINTR))
   136 #define RESTARTABLE_RETURN_INT(_cmd) do { \
   137   int _result; \
   138   RESTARTABLE(_cmd, _result); \
   139   return _result; \
   140 } while(false)
   142 inline bool os::numa_has_static_binding()   { return true; }
   143 inline bool os::numa_has_group_homing()     { return false;  }
   145 #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP

mercurial