mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
6348631: remove the use of the HPI library from Hotspot
Move functions from hpi library to hotspot, communicate with licensees and open source community, check jdk for dependency, file CCC request Reviewed-by: coleenp, acorn, dsamersoff
This commit is contained in:
parent
8006fe8f75
commit
9802f91e66
43 changed files with 1364 additions and 1839 deletions
|
@ -40,6 +40,14 @@
|
|||
# include "orderAccess_linux_zero.inline.hpp"
|
||||
#endif
|
||||
|
||||
// System includes
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netdb.h>
|
||||
|
||||
inline void* os::thread_local_storage_at(int index) {
|
||||
return pthread_getspecific((pthread_key_t)index);
|
||||
}
|
||||
|
@ -93,6 +101,12 @@ inline void os::split_reserved_memory(char *base, size_t size,
|
|||
inline void os::bang_stack_shadow_pages() {
|
||||
}
|
||||
|
||||
inline void os::dll_unload(void *lib) {
|
||||
::dlclose(lib);
|
||||
}
|
||||
|
||||
inline const int os::default_file_open_flags() { return 0;}
|
||||
|
||||
inline DIR* os::opendir(const char* dirname)
|
||||
{
|
||||
assert(dirname != NULL, "just checking");
|
||||
|
@ -104,6 +118,22 @@ inline int os::readdir_buf_size(const char *path)
|
|||
return NAME_MAX + sizeof(dirent) + 1;
|
||||
}
|
||||
|
||||
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 char* os::native_path(char *path) {
|
||||
return path;
|
||||
}
|
||||
|
||||
inline int os::ftruncate(int fd, jlong length) {
|
||||
return ::ftruncate64(fd, length);
|
||||
}
|
||||
|
||||
inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
|
||||
{
|
||||
dirent* p;
|
||||
|
@ -121,9 +151,8 @@ inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
|
|||
return p;
|
||||
}
|
||||
|
||||
inline int os::closedir(DIR *dirp)
|
||||
{
|
||||
assert(dirp != NULL, "just checking");
|
||||
inline int os::closedir(DIR *dirp) {
|
||||
assert(dirp != NULL, "argument is NULL");
|
||||
return ::closedir(dirp);
|
||||
}
|
||||
|
||||
|
@ -142,4 +171,139 @@ inline int os::closedir(DIR *dirp)
|
|||
inline bool os::numa_has_static_binding() { return true; }
|
||||
inline bool os::numa_has_group_homing() { return false; }
|
||||
|
||||
inline size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
|
||||
size_t res;
|
||||
RESTARTABLE( (size_t) ::read(fd, buf, (size_t) nBytes), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
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, int nBytes, int flags) {
|
||||
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags));
|
||||
}
|
||||
|
||||
inline int os::send(int fd, char *buf, int nBytes, int flags) {
|
||||
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
|
||||
}
|
||||
|
||||
inline int os::raw_send(int fd, char *buf, int nBytes, int flags) {
|
||||
return os::send(fd, buf, nBytes, flags);
|
||||
}
|
||||
|
||||
inline int os::timeout(int fd, long timeout) {
|
||||
julong prevtime,newtime;
|
||||
struct timeval t;
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
prevtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000;
|
||||
|
||||
for(;;) {
|
||||
struct pollfd pfd;
|
||||
|
||||
pfd.fd = fd;
|
||||
pfd.events = POLLIN | POLLERR;
|
||||
|
||||
int res = ::poll(&pfd, 1, timeout);
|
||||
|
||||
if (res == OS_ERR && errno == EINTR) {
|
||||
|
||||
// On Linux any value < 0 means "forever"
|
||||
|
||||
if(timeout >= 0) {
|
||||
gettimeofday(&t, NULL);
|
||||
newtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000;
|
||||
timeout -= newtime - prevtime;
|
||||
if(timeout <= 0)
|
||||
return OS_OK;
|
||||
prevtime = newtime;
|
||||
}
|
||||
} else
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
inline int os::listen(int fd, int count) {
|
||||
return ::listen(fd, count);
|
||||
}
|
||||
|
||||
inline int os::connect(int fd, struct sockaddr *him, int len) {
|
||||
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
|
||||
}
|
||||
|
||||
inline int os::accept(int fd, struct sockaddr *him, int *len) {
|
||||
// This cast is from int to unsigned int on linux. Since we
|
||||
// only pass the parameter "len" around the vm and don't try to
|
||||
// fetch it's value, this cast is safe for now. The java.net group
|
||||
// may need and want to change this interface someday if socklen_t goes
|
||||
// to 64 bits on some platform that we support.
|
||||
// Linux doc says this can't return EINTR, unlike accept() on Solaris
|
||||
|
||||
return ::accept(fd, him, (socklen_t *)len);
|
||||
}
|
||||
|
||||
inline int os::recvfrom(int fd, char *buf, int nBytes, int flags,
|
||||
sockaddr *from, int *fromlen) {
|
||||
RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen));
|
||||
}
|
||||
|
||||
inline int os::sendto(int fd, char *buf, int len, int flags,
|
||||
struct sockaddr *to, int tolen) {
|
||||
RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen));
|
||||
}
|
||||
|
||||
inline int os::socket_available(int fd, jint *pbytes) {
|
||||
// Linux doc says EINTR not returned, unlike Solaris
|
||||
int ret = ::ioctl(fd, FIONREAD, pbytes);
|
||||
|
||||
//%% note ioctl can return 0 when successful, JVM_SocketAvailable
|
||||
// is expected to return 0 on failure and 1 on success to the jdk.
|
||||
return (ret < 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
inline int os::socket_shutdown(int fd, int howto){
|
||||
return ::shutdown(fd, howto);
|
||||
}
|
||||
|
||||
inline int os::bind(int fd, struct sockaddr *him, int len){
|
||||
return ::bind(fd, him, len);
|
||||
}
|
||||
|
||||
inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
|
||||
return ::getsockname(fd, him, (socklen_t *)len);
|
||||
}
|
||||
|
||||
inline int os::get_host_name(char* name, int namelen){
|
||||
return ::gethostname(name, namelen);
|
||||
}
|
||||
|
||||
inline struct hostent* os::get_host_by_name(char* name) {
|
||||
return ::gethostbyname(name);
|
||||
}
|
||||
inline int os::get_sock_opt(int fd, int level, int optname,
|
||||
char *optval, int* optlen){
|
||||
return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen);
|
||||
}
|
||||
|
||||
inline int os::set_sock_opt(int fd, int level, int optname,
|
||||
const char *optval, int optlen){
|
||||
return ::setsockopt(fd, level, optname, optval, optlen);
|
||||
}
|
||||
#endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue