author | redestad |
Fri, 22 Feb 2019 09:23:37 +0100 | |
changeset 53886 | e94ed0236046 |
parent 53266 | 57d8566a2732 |
child 55524 | b279ae9843b8 |
child 58678 | 9cf78a70fa4f |
permissions | -rw-r--r-- |
10565 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
2 |
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. |
10565 | 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 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
25 |
#ifndef OS_BSD_OS_BSD_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
26 |
#define OS_BSD_OS_BSD_INLINE_HPP |
10565 | 27 |
|
28 |
#include "runtime/os.hpp" |
|
53886
e94ed0236046
8219247: Enable inlining of newly introduced PlatformMonitor methods
redestad
parents:
53266
diff
changeset
|
29 |
#include "os_posix.inline.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
13963
diff
changeset
|
30 |
|
10565 | 31 |
// System includes |
32 |
||
33 |
#include <unistd.h> |
|
34 |
#include <sys/socket.h> |
|
46454
f090a0a198cd
8180003: Remove sys/ prefix from poll.h and signal.h includes
mikael
parents:
39390
diff
changeset
|
35 |
#include <poll.h> |
10565 | 36 |
#include <netdb.h> |
37 |
||
50199
83d8b3a25f25
8199807: AppCDS performs overly restrictive path matching check.
jiangli
parents:
47216
diff
changeset
|
38 |
// File names are case-insensitive on windows only |
83d8b3a25f25
8199807: AppCDS performs overly restrictive path matching check.
jiangli
parents:
47216
diff
changeset
|
39 |
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:
47216
diff
changeset
|
40 |
return strncmp(s1, s2, num); |
10565 | 41 |
} |
42 |
||
43 |
inline bool os::uses_stack_guard_pages() { |
|
44 |
return true; |
|
45 |
} |
|
46 |
||
39390
edf6a424a8b7
8159335: Fix problems with stack overflow handling.
goetz
parents:
35479
diff
changeset
|
47 |
inline bool os::must_commit_stack_guard_pages() { |
10565 | 48 |
assert(uses_stack_guard_pages(), "sanity check"); |
49 |
#if !defined(__FreeBSD__) || __FreeBSD__ < 5 |
|
50 |
// Since FreeBSD 4 uses malloc() for allocating the thread stack |
|
51 |
// there is no need to do anything extra to allocate the guard pages |
|
52 |
return false; |
|
53 |
#else |
|
54 |
// FreeBSD 5+ uses mmap MAP_STACK for allocating the thread stacks. |
|
55 |
// Must 'allocate' them or guard pages are ignored. |
|
56 |
return true; |
|
57 |
#endif |
|
58 |
} |
|
59 |
||
60 |
||
61 |
// On Bsd, reservations are made on a page by page basis, nothing to do. |
|
13195 | 62 |
inline void os::pd_split_reserved_memory(char *base, size_t size, |
10565 | 63 |
size_t split, bool realloc) { |
64 |
} |
|
65 |
||
66 |
||
67 |
// 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
|
68 |
inline void os::map_stack_shadow_pages(address sp) { |
10565 | 69 |
} |
70 |
||
71 |
inline void os::dll_unload(void *lib) { |
|
72 |
::dlclose(lib); |
|
73 |
} |
|
74 |
||
75 |
inline const int os::default_file_open_flags() { return 0;} |
|
76 |
||
77 |
inline jlong os::lseek(int fd, jlong offset, int whence) { |
|
78 |
return (jlong) ::lseek(fd, offset, whence); |
|
79 |
} |
|
80 |
||
81 |
inline int os::fsync(int fd) { |
|
82 |
return ::fsync(fd); |
|
83 |
} |
|
84 |
||
85 |
inline int os::ftruncate(int fd, jlong length) { |
|
86 |
return ::ftruncate(fd, length); |
|
87 |
} |
|
88 |
||
89 |
// macros for restartable system calls |
|
90 |
||
91 |
#define RESTARTABLE(_cmd, _result) do { \ |
|
92 |
_result = _cmd; \ |
|
93 |
} while(((int)_result == OS_ERR) && (errno == EINTR)) |
|
94 |
||
95 |
#define RESTARTABLE_RETURN_INT(_cmd) do { \ |
|
96 |
int _result; \ |
|
97 |
RESTARTABLE(_cmd, _result); \ |
|
98 |
return _result; \ |
|
99 |
} while(false) |
|
100 |
||
101 |
inline bool os::numa_has_static_binding() { return true; } |
|
102 |
inline bool os::numa_has_group_homing() { return false; } |
|
103 |
||
104 |
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) { |
|
105 |
size_t res; |
|
106 |
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res); |
|
107 |
return res; |
|
108 |
} |
|
109 |
||
110 |
inline int os::close(int fd) { |
|
18078
10417cf9967d
7178026: os::close can restart ::close but that is not a restartable syscall
rdurbin
parents:
18025
diff
changeset
|
111 |
return ::close(fd); |
10565 | 112 |
} |
113 |
||
114 |
inline int os::socket_close(int fd) { |
|
18078
10417cf9967d
7178026: os::close can restart ::close but that is not a restartable syscall
rdurbin
parents:
18025
diff
changeset
|
115 |
return ::close(fd); |
10565 | 116 |
} |
117 |
||
118 |
inline int os::socket(int domain, int type, int protocol) { |
|
119 |
return ::socket(domain, type, protocol); |
|
120 |
} |
|
121 |
||
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
10565
diff
changeset
|
122 |
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:
10565
diff
changeset
|
123 |
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags)); |
10565 | 124 |
} |
125 |
||
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
10565
diff
changeset
|
126 |
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:
10565
diff
changeset
|
127 |
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); |
10565 | 128 |
} |
129 |
||
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
10565
diff
changeset
|
130 |
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { |
10565 | 131 |
return os::send(fd, buf, nBytes, flags); |
132 |
} |
|
133 |
||
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
10565
diff
changeset
|
134 |
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) { |
10565 | 135 |
RESTARTABLE_RETURN_INT(::connect(fd, him, len)); |
136 |
} |
|
137 |
||
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
10565
diff
changeset
|
138 |
inline struct hostent* os::get_host_by_name(char* name) { |
10565 | 139 |
return ::gethostbyname(name); |
140 |
} |
|
11256
025cd1741566
7091417: recvfrom's 6th input should be of type socklen_t
phh
parents:
10565
diff
changeset
|
141 |
|
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18078
diff
changeset
|
142 |
inline bool os::supports_monotonic_clock() { |
24239
db81abb281bc
8040140: System.nanoTime() is slow and non-monotonic on OS X
sla
parents:
22891
diff
changeset
|
143 |
#ifdef __APPLE__ |
db81abb281bc
8040140: System.nanoTime() is slow and non-monotonic on OS X
sla
parents:
22891
diff
changeset
|
144 |
return true; |
db81abb281bc
8040140: System.nanoTime() is slow and non-monotonic on OS X
sla
parents:
22891
diff
changeset
|
145 |
#else |
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18078
diff
changeset
|
146 |
return Bsd::_clock_gettime != NULL; |
24239
db81abb281bc
8040140: System.nanoTime() is slow and non-monotonic on OS X
sla
parents:
22891
diff
changeset
|
147 |
#endif |
22891
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18078
diff
changeset
|
148 |
} |
1f5d1fff23fa
6546236: Thread interrupt() of Thread.sleep() can be lost on Solaris due to race with signal handler
fparain
parents:
18078
diff
changeset
|
149 |
|
26682
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
150 |
inline void os::exit(int num) { |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
151 |
::exit(num); |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
152 |
} |
f339669ba825
8057744: (process) Synchronize exiting of threads and process [win]
igerasim
parents:
25468
diff
changeset
|
153 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52508
diff
changeset
|
154 |
#endif // OS_BSD_OS_BSD_INLINE_HPP |