duke@435: /* xdono@631: * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: inline void* os::thread_local_storage_at(int index) { duke@435: return pthread_getspecific((pthread_key_t)index); duke@435: } duke@435: duke@435: inline const char* os::file_separator() { duke@435: return "/"; duke@435: } duke@435: duke@435: inline const char* os::line_separator() { duke@435: return "\n"; duke@435: } duke@435: duke@435: inline const char* os::path_separator() { duke@435: return ":"; duke@435: } duke@435: duke@435: inline const char* os::jlong_format_specifier() { duke@435: return "%lld"; duke@435: } duke@435: duke@435: inline const char* os::julong_format_specifier() { duke@435: return "%llu"; duke@435: } duke@435: duke@435: // File names are case-sensitive on windows only duke@435: inline int os::file_name_strcmp(const char* s1, const char* s2) { duke@435: return strcmp(s1, s2); duke@435: } duke@435: duke@435: inline bool os::obsolete_option(const JavaVMOption *option) { duke@435: return false; duke@435: } duke@435: duke@435: inline bool os::uses_stack_guard_pages() { duke@435: return true; duke@435: } duke@435: duke@435: inline bool os::allocate_stack_guard_pages() { duke@435: assert(uses_stack_guard_pages(), "sanity check"); duke@435: return true; duke@435: } duke@435: duke@435: duke@435: // On Linux, reservations are made on a page by page basis, nothing to do. duke@435: inline void os::split_reserved_memory(char *base, size_t size, duke@435: size_t split, bool realloc) { duke@435: } duke@435: duke@435: duke@435: // Bang the shadow pages if they need to be touched to be mapped. duke@435: inline void os::bang_stack_shadow_pages() { duke@435: } duke@435: duke@435: inline DIR* os::opendir(const char* dirname) duke@435: { duke@435: assert(dirname != NULL, "just checking"); duke@435: return ::opendir(dirname); duke@435: } duke@435: duke@435: inline int os::readdir_buf_size(const char *path) duke@435: { duke@435: return NAME_MAX + sizeof(dirent) + 1; duke@435: } duke@435: duke@435: inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) duke@435: { duke@435: dirent* p; duke@435: int status; duke@435: assert(dirp != NULL, "just checking"); duke@435: duke@435: // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX duke@435: // version. Here is the doc for this function: duke@435: // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html duke@435: duke@435: if((status = ::readdir_r(dirp, dbuf, &p)) != 0) { duke@435: errno = status; duke@435: return NULL; duke@435: } else duke@435: return p; duke@435: } duke@435: duke@435: inline int os::closedir(DIR *dirp) duke@435: { duke@435: assert(dirp != NULL, "just checking"); duke@435: return ::closedir(dirp); duke@435: } duke@435: duke@435: // macros for restartable system calls duke@435: duke@435: #define RESTARTABLE(_cmd, _result) do { \ duke@435: _result = _cmd; \ duke@435: } while(((int)_result == OS_ERR) && (errno == EINTR)) duke@435: duke@435: #define RESTARTABLE_RETURN_INT(_cmd) do { \ duke@435: int _result; \ duke@435: RESTARTABLE(_cmd, _result); \ duke@435: return _result; \ duke@435: } while(false) iveresov@576: iveresov@576: inline bool os::numa_has_static_binding() { return true; } iveresov@576: inline bool os::numa_has_group_homing() { return false; }