author | serb |
Sun, 24 Jun 2018 16:35:21 -0700 | |
changeset 50834 | 9cf279436b9d |
parent 50667 | cc58f1fa0438 |
child 51106 | f605c91e5219 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
50199
83d8b3a25f25
8199807: AppCDS performs overly restrictive path matching check.
jiangli
parents:
49957
diff
changeset
|
2 |
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
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 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef OS_LINUX_VM_OS_LINUX_INLINE_HPP |
26 |
#define OS_LINUX_VM_OS_LINUX_INLINE_HPP |
|
27 |
||
28 |
#include "runtime/os.hpp" |
|
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
13963
diff
changeset
|
29 |
|
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
30 |
// System includes |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
31 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
32 |
#include <unistd.h> |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
33 |
#include <sys/socket.h> |
46454
f090a0a198cd
8180003: Remove sys/ prefix from poll.h and signal.h includes
mikael
parents:
39390
diff
changeset
|
34 |
#include <poll.h> |
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
35 |
#include <netdb.h> |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
36 |
|
50199
83d8b3a25f25
8199807: AppCDS performs overly restrictive path matching check.
jiangli
parents:
49957
diff
changeset
|
37 |
// File names are case-insensitive on windows only |
83d8b3a25f25
8199807: AppCDS performs overly restrictive path matching check.
jiangli
parents:
49957
diff
changeset
|
38 |
inline int os::file_name_strncmp(const char* s1, const char* s2, size_t num) { |
83d8b3a25f25
8199807: AppCDS performs overly restrictive path matching check.
jiangli
parents:
49957
diff
changeset
|
39 |
return strncmp(s1, s2, num); |
1 | 40 |
} |
41 |
||
42 |
inline bool os::obsolete_option(const JavaVMOption *option) { |
|
43 |
return false; |
|
44 |
} |
|
45 |
||
46 |
inline bool os::uses_stack_guard_pages() { |
|
47 |
return true; |
|
48 |
} |
|
49 |
||
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
50 |
inline bool os::must_commit_stack_guard_pages() { |
1 | 51 |
assert(uses_stack_guard_pages(), "sanity check"); |
52 |
return true; |
|
53 |
} |
|
54 |
||
55 |
||
56 |
// On Linux, reservations are made on a page by page basis, nothing to do. |
|
13195 | 57 |
inline void os::pd_split_reserved_memory(char *base, size_t size, |
1 | 58 |
size_t split, bool realloc) { |
59 |
} |
|
60 |
||
61 |
||
62 |
// Bang the shadow pages if they need to be touched to be mapped. |
|
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
63 |
inline void os::map_stack_shadow_pages(address sp) { |
1 | 64 |
} |
65 |
||
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
66 |
inline void os::dll_unload(void *lib) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
67 |
::dlclose(lib); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
68 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
69 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
70 |
inline const int os::default_file_open_flags() { return 0;} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
71 |
|
1 | 72 |
inline DIR* os::opendir(const char* dirname) |
73 |
{ |
|
74 |
assert(dirname != NULL, "just checking"); |
|
75 |
return ::opendir(dirname); |
|
76 |
} |
|
77 |
||
78 |
inline int os::readdir_buf_size(const char *path) |
|
79 |
{ |
|
80 |
return NAME_MAX + sizeof(dirent) + 1; |
|
81 |
} |
|
82 |
||
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
83 |
inline jlong os::lseek(int fd, jlong offset, int whence) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
84 |
return (jlong) ::lseek64(fd, offset, whence); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
85 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
86 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
87 |
inline int os::fsync(int fd) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
88 |
return ::fsync(fd); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
89 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
90 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
91 |
inline int os::ftruncate(int fd, jlong length) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
92 |
return ::ftruncate64(fd, length); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
93 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
94 |
|
1 | 95 |
inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf) |
96 |
{ |
|
97 |
assert(dirp != NULL, "just checking"); |
|
49957
746229cc1ab0
8179887: Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated
kbarrett
parents:
47621
diff
changeset
|
98 |
return ::readdir(dirp); |
1 | 99 |
} |
100 |
||
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
101 |
inline int os::closedir(DIR *dirp) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
102 |
assert(dirp != NULL, "argument is NULL"); |
1 | 103 |
return ::closedir(dirp); |
104 |
} |
|
105 |
||
106 |
// macros for restartable system calls |
|
107 |
||
108 |
#define RESTARTABLE(_cmd, _result) do { \ |
|
109 |
_result = _cmd; \ |
|
110 |
} while(((int)_result == OS_ERR) && (errno == EINTR)) |
|
111 |
||
112 |
#define RESTARTABLE_RETURN_INT(_cmd) do { \ |
|
113 |
int _result; \ |
|
114 |
RESTARTABLE(_cmd, _result); \ |
|
115 |
return _result; \ |
|
116 |
} while(false) |
|
388 | 117 |
|
118 |
inline bool os::numa_has_static_binding() { return true; } |
|
119 |
inline bool os::numa_has_group_homing() { return false; } |
|
7397 | 120 |
|
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
121 |
inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
122 |
size_t res; |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
123 |
RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
124 |
return res; |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
125 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
126 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
127 |
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
128 |
size_t res; |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
129 |
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
130 |
return res; |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
131 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
132 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
133 |
inline int os::close(int fd) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
134 |
return ::close(fd); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
135 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
136 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
137 |
inline int os::socket_close(int fd) { |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
138 |
return ::close(fd); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
139 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
140 |
|
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
141 |
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
|
142 |
return ::socket(domain, type, protocol); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
143 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
144 |
|
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
145 |
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) { |
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
146 |
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags)); |
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
147 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
148 |
|
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
149 |
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) { |
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
150 |
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); |
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
151 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
152 |
|
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
153 |
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { |
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
154 |
return os::send(fd, buf, nBytes, flags); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
155 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
156 |
|
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
157 |
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) { |
7405
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
158 |
RESTARTABLE_RETURN_INT(::connect(fd, him, len)); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
159 |
} |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
160 |
|
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
161 |
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
|
162 |
return ::gethostbyname(name); |
e6fc8d3926f8
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
7397
diff
changeset
|
163 |
} |
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
8921
diff
changeset
|
164 |
|
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18025
diff
changeset
|
165 |
inline bool os::supports_monotonic_clock() { |
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18025
diff
changeset
|
166 |
return Linux::_clock_gettime != NULL; |
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18025
diff
changeset
|
167 |
} |
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18025
diff
changeset
|
168 |
|
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
169 |
inline void os::exit(int num) { |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
170 |
::exit(num); |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
171 |
} |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
172 |
|
7397 | 173 |
#endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP |