hotspot/src/os/solaris/vm/os_solaris.inline.hpp
author tamao
Fri, 07 Jun 2013 09:46:58 -0700
changeset 18441 1f6241296fda
parent 15855 2ac9ebea17f3
child 22891 1f5d1fff23fa
permissions -rw-r--r--
7122222: GC log is limited to 2G for 32-bit Summary: Enable large file support for generated 32-bit ostream.o on Linux and Solaris (as only the two need this) by setting -D_FILE_OFFSET_BITS=64 in compilation Reviewed-by: tbell, mgerdin, dcubed Contributed-by: tamao <tao.mao@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
15228
e92acc84ade3 7102489: RFE: cleanup jlong typedef on __APPLE__and _LLP64 systems.
hseigel
parents: 14626
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 13963
diff changeset
    28
#include "runtime/atomic.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/os.hpp"
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 13963
diff changeset
    30
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#ifdef TARGET_OS_ARCH_solaris_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
# include "orderAccess_solaris_x86.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#ifdef TARGET_OS_ARCH_solaris_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
# include "orderAccess_solaris_sparc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    38
// System includes
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    39
#include <sys/param.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    40
#include <dlfcn.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    41
#include <sys/socket.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    42
#include <sys/poll.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    43
#include <sys/filio.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    44
#include <unistd.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    45
#include <netdb.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    46
#include <setjmp.h>
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    47
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
inline const char* os::file_separator() { return "/"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
inline const char* os::line_separator() { return "\n"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
inline const char* os::path_separator() { return ":"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// File names are case-sensitive on windows only
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
inline int os::file_name_strcmp(const char* s1, const char* s2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  return strcmp(s1, s2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
inline bool os::uses_stack_guard_pages() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
inline bool os::allocate_stack_guard_pages() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  assert(uses_stack_guard_pages(), "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  int r = thr_main() ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  guarantee (r == 0 || r == 1, "CR6501650 or CR6493689") ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  return r;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// On Solaris, reservations are made on a page by page basis, nothing to do.
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 11256
diff changeset
    70
inline void os::pd_split_reserved_memory(char *base, size_t size,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
                                      size_t split, bool realloc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
// Bang the shadow pages if they need to be touched to be mapped.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
inline void os::bang_stack_shadow_pages() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
}
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    78
inline void os::dll_unload(void *lib) { ::dlclose(lib); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    80
inline DIR* os::opendir(const char* dirname) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  assert(dirname != NULL, "just checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  return ::opendir(dirname);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    85
inline int os::readdir_buf_size(const char *path) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  int size = pathconf(path, _PC_NAME_MAX);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  return (size < 0 ? MAXPATHLEN : size) + sizeof(dirent) + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
    90
inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  assert(dirp != NULL, "just checking");
18441
1f6241296fda 7122222: GC log is limited to 2G for 32-bit
tamao
parents: 15855
diff changeset
    92
#if defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  dirent* p;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  int status;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    errno = status;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  } else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    return p;
18441
1f6241296fda 7122222: GC log is limited to 2G for 32-bit
tamao
parents: 15855
diff changeset
   101
#else  // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  return ::readdir_r(dirp, dbuf);
18441
1f6241296fda 7122222: GC log is limited to 2G for 32-bit
tamao
parents: 15855
diff changeset
   103
#endif // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   106
inline int os::closedir(DIR *dirp) {
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   107
  assert(dirp != NULL, "argument is NULL");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  return ::closedir(dirp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
//////////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
////////////////////////////////////////////////////////////////////////////////
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
// macros for interruptible io and system calls and system call restarting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
#define _INTERRUPTIBLE(_setup, _cmd, _result, _thread, _clear, _before, _after, _int_enable) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  _setup; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  _before; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  OSThread* _osthread = _thread->osthread(); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  if (_int_enable && _thread->has_last_Java_frame()) { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    /* this is java interruptible io stuff */ \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    if (os::is_interrupted(_thread, _clear))  { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      os::Solaris::bump_interrupted_before_count(); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      _result = OS_INTRPT; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    } else { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
      /* _cmd always expands to an assignment to _result */ \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
      if ((_cmd) < 0 && errno == EINTR  \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
       && os::is_interrupted(_thread, _clear)) { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
        os::Solaris::bump_interrupted_during_count(); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
        _result = OS_INTRPT; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
      } \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    } \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  } else { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    /* this is normal blocking io stuff */ \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    _cmd; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  } \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  _after; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
} while(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
// Interruptible io support + restarting of interrupted system calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
#ifndef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
#define INTERRUPTIBLE(_cmd, _result, _clear) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
} while((_result == OS_ERR) && (errno == EINTR))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
// This adds an assertion that it is only called from thread_in_native
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
// The call overhead is skipped for performance in product mode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
#define INTERRUPTIBLE(_cmd, _result, _clear) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO ); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
} while((_result == OS_ERR) && (errno == EINTR))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
// Used for calls from _thread_in_vm, not from _thread_in_native
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
#define INTERRUPTIBLE_VM(_cmd, _result, _clear) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible(_thread), UseVMInterruptibleIO ); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
} while((_result == OS_ERR) && (errno == EINTR))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
/* Use NORESTART when the system call cannot return EINTR, when something other
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
   than a system call is being invoked, or when the caller must do EINTR
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
   handling. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
#ifndef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
#define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  _INTERRUPTIBLE( JavaThread* _thread = (JavaThread*)ThreadLocalStorage::thread(),_result = _cmd, _result, _thread, _clear, , , UseVMInterruptibleIO)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
// This adds an assertion that it is only called from thread_in_native
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
// The call overhead is skipped for performance in product mode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
#define INTERRUPTIBLE_NORESTART(_cmd, _result, _clear) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  _INTERRUPTIBLE(JavaThread* _thread = os::Solaris::setup_interruptible_native(), _result = _cmd, _result, _thread, _clear, , os::Solaris::cleanup_interruptible_native(_thread), UseVMInterruptibleIO )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
// Don't attend to UseVMInterruptibleIO. Always allow interruption.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
// Also assumes that it is called from the _thread_blocked state.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
// Used by os_sleep().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
#define INTERRUPTIBLE_NORESTART_VM_ALWAYS(_cmd, _result, _thread, _clear) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  _INTERRUPTIBLE(os::Solaris::setup_interruptible_already_blocked(_thread), _result = _cmd, _result, _thread, _clear, , , true )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
#define INTERRUPTIBLE_RETURN_INT(_cmd, _clear) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  int _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    INTERRUPTIBLE(_cmd, _result, _clear); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  } while((_result == OS_ERR) && (errno == EINTR)); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  return _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
} while(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
#define INTERRUPTIBLE_RETURN_INT_VM(_cmd, _clear) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  int _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    INTERRUPTIBLE_VM(_cmd, _result, _clear); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  } while((_result == OS_ERR) && (errno == EINTR)); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  return _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
} while(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
#define INTERRUPTIBLE_RETURN_INT_NORESTART(_cmd, _clear) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  int _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  INTERRUPTIBLE_NORESTART(_cmd, _result, _clear); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  return _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
} while(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
/* Use the RESTARTABLE macros when interruptible io is not needed */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
#define RESTARTABLE(_cmd, _result) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    _result = _cmd; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  } while((_result == OS_ERR) && (errno == EINTR)); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
} while(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
#define RESTARTABLE_RETURN_INT(_cmd) do { \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  int _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  RESTARTABLE(_cmd, _result); \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  return _result; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
} while(false)
388
bcc631c5bbec 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 1
diff changeset
   224
bcc631c5bbec 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 1
diff changeset
   225
inline bool os::numa_has_static_binding()   { return false; }
bcc631c5bbec 6684395: Port NUMA-aware allocator to linux
iveresov
parents: 1
diff changeset
   226
inline bool os::numa_has_group_homing()     { return true;  }
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   227
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   228
inline int    os::socket(int domain, int type, int protocol) {
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   229
  return ::socket(domain, type, protocol);
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   230
}
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   231
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   232
inline int    os::listen(int fd, int count) {
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   233
  if (fd < 0) return OS_ERR;
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   234
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   235
  return ::listen(fd, count);
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   236
}
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   237
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   238
inline int os::socket_shutdown(int fd, int howto){
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   239
  return ::shutdown(fd, howto);
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   240
}
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   241
11256
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   242
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len){
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   243
  return ::getsockname(fd, him, len);
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   244
}
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   245
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   246
inline int os::get_host_name(char* name, int namelen){
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   247
  return ::gethostname(name, namelen);
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   248
}
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   249
11256
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   250
inline struct hostent* os::get_host_by_name(char* name) {
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   251
  return ::gethostbyname(name);
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   252
}
11256
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   253
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   254
inline int os::get_sock_opt(int fd, int level, int optname,
11256
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   255
                            char* optval, socklen_t* optlen) {
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   256
  return ::getsockopt(fd, level, optname, optval, optlen);
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   257
}
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   258
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   259
inline int os::set_sock_opt(int fd, int level, int optname,
11256
025cd1741566 7091417: recvfrom's 6th input should be of type socklen_t
phh
parents: 7405
diff changeset
   260
                            const char *optval, socklen_t optlen) {
7405
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   261
  return ::setsockopt(fd, level, optname, optval, optlen);
e6fc8d3926f8 6348631: remove the use of the HPI library from Hotspot
ikrylov
parents: 7397
diff changeset
   262
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   263
#endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP