annotate src/os/solaris/vm/os_solaris.inline.hpp @ 7623:203f64878aab

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