mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8260264: Move common os_<unix> inline methods to a common posix source file
Reviewed-by: iklam, dholmes, coleenp, stuefe
This commit is contained in:
parent
288a4fed3f
commit
189b65b2ca
4 changed files with 60 additions and 194 deletions
|
@ -29,14 +29,6 @@
|
|||
#include "runtime/os.hpp"
|
||||
#include "os_posix.inline.hpp"
|
||||
|
||||
// System includes
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <poll.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netdb.h>
|
||||
|
||||
inline bool os::uses_stack_guard_pages() {
|
||||
return true;
|
||||
}
|
||||
|
@ -53,62 +45,4 @@ inline bool os::must_commit_stack_guard_pages() {
|
|||
inline void os::map_stack_shadow_pages(address sp) {
|
||||
}
|
||||
|
||||
inline void os::dll_unload(void *lib) {
|
||||
::dlclose(lib);
|
||||
}
|
||||
|
||||
inline jlong os::lseek(int fd, jlong offset, int whence) {
|
||||
return (jlong) ::lseek64(fd, offset, whence);
|
||||
}
|
||||
|
||||
inline int os::fsync(int fd) {
|
||||
return ::fsync(fd);
|
||||
}
|
||||
|
||||
inline int os::ftruncate(int fd, jlong length) {
|
||||
return ::ftruncate64(fd, length);
|
||||
}
|
||||
|
||||
// We don't have NUMA support on Aix, but we need this for compilation.
|
||||
inline bool os::numa_has_static_binding() { ShouldNotReachHere(); return true; }
|
||||
inline bool os::numa_has_group_homing() { ShouldNotReachHere(); return false; }
|
||||
|
||||
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
|
||||
size_t res;
|
||||
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
inline int os::socket_close(int fd) {
|
||||
return ::close(fd);
|
||||
}
|
||||
|
||||
inline int os::socket(int domain, int type, int protocol) {
|
||||
return ::socket(domain, type, protocol);
|
||||
}
|
||||
|
||||
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::raw_send(int fd, char *buf, size_t nBytes, uint flags) {
|
||||
return os::send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
inline int os::connect(int fd, struct sockaddr *him, socklen_t len) {
|
||||
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
|
||||
}
|
||||
|
||||
inline struct hostent* os::get_host_by_name(char* name) {
|
||||
return ::gethostbyname(name);
|
||||
}
|
||||
|
||||
inline void os::exit(int num) {
|
||||
::exit(num);
|
||||
}
|
||||
|
||||
#endif // OS_AIX_OS_AIX_INLINE_HPP
|
||||
|
|
|
@ -28,13 +28,6 @@
|
|||
#include "runtime/os.hpp"
|
||||
#include "os_posix.inline.hpp"
|
||||
|
||||
// System includes
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <poll.h>
|
||||
#include <netdb.h>
|
||||
|
||||
inline bool os::uses_stack_guard_pages() {
|
||||
return true;
|
||||
}
|
||||
|
@ -56,61 +49,4 @@ inline bool os::must_commit_stack_guard_pages() {
|
|||
inline void os::map_stack_shadow_pages(address sp) {
|
||||
}
|
||||
|
||||
inline void os::dll_unload(void *lib) {
|
||||
::dlclose(lib);
|
||||
}
|
||||
|
||||
inline jlong os::lseek(int fd, jlong offset, int whence) {
|
||||
return (jlong) ::lseek(fd, offset, whence);
|
||||
}
|
||||
|
||||
inline int os::fsync(int fd) {
|
||||
return ::fsync(fd);
|
||||
}
|
||||
|
||||
inline int os::ftruncate(int fd, jlong length) {
|
||||
return ::ftruncate(fd, length);
|
||||
}
|
||||
|
||||
inline bool os::numa_has_static_binding() { return true; }
|
||||
inline bool os::numa_has_group_homing() { return false; }
|
||||
|
||||
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
|
||||
size_t res;
|
||||
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
inline int os::socket_close(int fd) {
|
||||
return ::close(fd);
|
||||
}
|
||||
|
||||
inline int os::socket(int domain, int type, int protocol) {
|
||||
return ::socket(domain, type, protocol);
|
||||
}
|
||||
|
||||
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
return os::send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) {
|
||||
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
|
||||
}
|
||||
|
||||
inline struct hostent* os::get_host_by_name(char* name) {
|
||||
return ::gethostbyname(name);
|
||||
}
|
||||
|
||||
inline void os::exit(int num) {
|
||||
::exit(num);
|
||||
}
|
||||
|
||||
#endif // OS_BSD_OS_BSD_INLINE_HPP
|
||||
|
|
|
@ -28,13 +28,6 @@
|
|||
#include "runtime/os.hpp"
|
||||
#include "os_posix.inline.hpp"
|
||||
|
||||
// System includes
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <poll.h>
|
||||
#include <netdb.h>
|
||||
|
||||
inline bool os::uses_stack_guard_pages() {
|
||||
return true;
|
||||
}
|
||||
|
@ -48,61 +41,4 @@ inline bool os::must_commit_stack_guard_pages() {
|
|||
inline void os::map_stack_shadow_pages(address sp) {
|
||||
}
|
||||
|
||||
inline void os::dll_unload(void *lib) {
|
||||
::dlclose(lib);
|
||||
}
|
||||
|
||||
inline jlong os::lseek(int fd, jlong offset, int whence) {
|
||||
return (jlong) ::lseek64(fd, offset, whence);
|
||||
}
|
||||
|
||||
inline int os::fsync(int fd) {
|
||||
return ::fsync(fd);
|
||||
}
|
||||
|
||||
inline int os::ftruncate(int fd, jlong length) {
|
||||
return ::ftruncate64(fd, length);
|
||||
}
|
||||
|
||||
inline bool os::numa_has_static_binding() { return true; }
|
||||
inline bool os::numa_has_group_homing() { return false; }
|
||||
|
||||
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
|
||||
size_t res;
|
||||
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
inline int os::socket_close(int fd) {
|
||||
return ::close(fd);
|
||||
}
|
||||
|
||||
inline int os::socket(int domain, int type, int protocol) {
|
||||
return ::socket(domain, type, protocol);
|
||||
}
|
||||
|
||||
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
return os::send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) {
|
||||
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
|
||||
}
|
||||
|
||||
inline struct hostent* os::get_host_by_name(char* name) {
|
||||
return ::gethostbyname(name);
|
||||
}
|
||||
|
||||
inline void os::exit(int num) {
|
||||
::exit(num);
|
||||
}
|
||||
|
||||
#endif // OS_LINUX_OS_LINUX_INLINE_HPP
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "runtime/os.hpp"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
// macros for restartable system calls
|
||||
|
||||
|
@ -42,10 +44,68 @@
|
|||
} while(false)
|
||||
|
||||
|
||||
inline void os::dll_unload(void *lib) {
|
||||
::dlclose(lib);
|
||||
}
|
||||
|
||||
inline jlong os::lseek(int fd, jlong offset, int whence) {
|
||||
return (jlong) BSD_ONLY(::lseek) NOT_BSD(::lseek64)(fd, offset, whence);
|
||||
}
|
||||
|
||||
inline int os::fsync(int fd) {
|
||||
return ::fsync(fd);
|
||||
}
|
||||
|
||||
inline int os::ftruncate(int fd, jlong length) {
|
||||
return BSD_ONLY(::ftruncate) NOT_BSD(::ftruncate64)(fd, length);
|
||||
}
|
||||
|
||||
// Aix does not have NUMA support but need these for compilation.
|
||||
inline bool os::numa_has_static_binding() { AIX_ONLY(ShouldNotReachHere();) return true; }
|
||||
inline bool os::numa_has_group_homing() { AIX_ONLY(ShouldNotReachHere();) return false; }
|
||||
|
||||
inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
|
||||
size_t res;
|
||||
RESTARTABLE((size_t) ::write(fd, buf, (size_t) nBytes), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
inline int os::close(int fd) {
|
||||
return ::close(fd);
|
||||
}
|
||||
|
||||
inline int os::socket_close(int fd) {
|
||||
return ::close(fd);
|
||||
}
|
||||
|
||||
inline int os::socket(int domain, int type, int protocol) {
|
||||
return ::socket(domain, type, protocol);
|
||||
}
|
||||
|
||||
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
|
||||
}
|
||||
|
||||
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
|
||||
return os::send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) {
|
||||
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
|
||||
}
|
||||
|
||||
inline struct hostent* os::get_host_by_name(char* name) {
|
||||
return ::gethostbyname(name);
|
||||
}
|
||||
|
||||
inline void os::exit(int num) {
|
||||
::exit(num);
|
||||
}
|
||||
|
||||
// Platform Mutex/Monitor implementation
|
||||
|
||||
inline void os::PlatformMutex::lock() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue