8061618: Removed unused networking functions from os class

Reviewed-by: lfoltan, hseigel, dholmes
This commit is contained in:
Frederic Parain 2014-10-22 02:31:25 -07:00
parent aed4b0760c
commit 209ffcd9a5
10 changed files with 0 additions and 447 deletions

View File

@ -4137,15 +4137,6 @@ int os::available(int fd, jlong *bytes) {
return 1;
}
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;
}
// Map a block of memory.
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,

View File

@ -178,92 +178,14 @@ inline int os::raw_send(int fd, char* buf, size_t nBytes, uint 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, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}
inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
// Linux doc says this can't return EINTR, unlike accept() on Solaris.
// But see attachListener_linux.cpp, LinuxAttachListener::dequeue().
return (int)::accept(fd, him, len);
}
inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen));
}
inline int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen));
}
inline int os::socket_shutdown(int fd, int howto) {
return ::shutdown(fd, howto);
}
inline int os::bind(int fd, struct sockaddr* him, socklen_t len) {
return ::bind(fd, him, len);
}
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
return ::getsockname(fd, him, 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, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char* optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
inline bool os::supports_monotonic_clock() {
// mread_real_time() is monotonic on AIX (see os::javaTimeNanos() comments)
return true;

View File

@ -3958,21 +3958,6 @@ int os::available(int fd, jlong *bytes) {
return 1;
}
int os::socket_available(int fd, jint *pbytes) {
if (fd < 0) {
return OS_OK;
}
int ret;
RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
//%% 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 == OS_ERR) ? 0 : 1;
}
// Map a block of memory.
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,

View File

@ -181,91 +181,14 @@ inline int os::raw_send(int fd, char* buf, size_t nBytes, uint 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 Bsd 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, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}
inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
// At least OpenBSD and FreeBSD can return EINTR from accept.
RESTARTABLE_RETURN_INT(::accept(fd, him, len));
}
inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen));
}
inline int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr *to, socklen_t tolen) {
RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen));
}
inline int os::socket_shutdown(int fd, int howto) {
return ::shutdown(fd, howto);
}
inline int os::bind(int fd, struct sockaddr* him, socklen_t len) {
return ::bind(fd, him, len);
}
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
return ::getsockname(fd, him, 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, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char* optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
inline bool os::supports_monotonic_clock() {
#ifdef __APPLE__
return true;

View File

@ -5211,15 +5211,6 @@ int os::available(int fd, jlong *bytes) {
return 1;
}
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;
}
// Map a block of memory.
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,

View File

@ -173,92 +173,14 @@ inline int os::raw_send(int fd, char* buf, size_t nBytes, uint 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, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}
inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
// Linux doc says this can't return EINTR, unlike accept() on Solaris.
// But see attachListener_linux.cpp, LinuxAttachListener::dequeue().
return (int)::accept(fd, him, len);
}
inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen));
}
inline int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen));
}
inline int os::socket_shutdown(int fd, int howto) {
return ::shutdown(fd, howto);
}
inline int os::bind(int fd, struct sockaddr* him, socklen_t len) {
return ::bind(fd, him, len);
}
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
return ::getsockname(fd, him, 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, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char* optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
inline bool os::supports_monotonic_clock() {
return Linux::_clock_gettime != NULL;
}

View File

@ -5912,37 +5912,6 @@ int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
// a poll() is done with timeout == -1, in which case we repeat with this
// "wait forever" value.
int os::timeout(int fd, long timeout) {
int res;
struct timeval t;
julong prevtime, newtime;
static const char* aNull = 0;
struct pollfd pfd;
pfd.fd = fd;
pfd.events = POLLIN;
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
"Assumed _thread_in_native");
gettimeofday(&t, &aNull);
prevtime = ((julong)t.tv_sec * 1000) + t.tv_usec / 1000;
for (;;) {
res = ::poll(&pfd, 1, timeout);
if (res == OS_ERR && errno == EINTR) {
if (timeout != -1) {
gettimeofday(&t, &aNull);
newtime = ((julong)t.tv_sec * 1000) + t.tv_usec /1000;
timeout -= newtime - prevtime;
if (timeout <= 0) {
return OS_OK;
}
prevtime = newtime;
}
} else return res;
}
}
int os::connect(int fd, struct sockaddr *him, socklen_t len) {
int _result;
_result = ::connect(fd, him, len);
@ -5982,46 +5951,6 @@ int os::connect(int fd, struct sockaddr *him, socklen_t len) {
return _result;
}
int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
if (fd < 0) {
return OS_ERR;
}
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
"Assumed _thread_in_native");
RESTARTABLE_RETURN_INT((int)::accept(fd, him, len));
}
int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
"Assumed _thread_in_native");
RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen));
}
int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
"Assumed _thread_in_native");
RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen));
}
int os::socket_available(int fd, jint *pbytes) {
if (fd < 0) {
return OS_OK;
}
int ret;
RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
// 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 == OS_ERR) ? 0 : 1;
}
int os::bind(int fd, struct sockaddr* him, socklen_t len) {
assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
"Assumed _thread_in_native");
return ::bind(fd, him, len);
}
// Get the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {

View File

@ -120,38 +120,10 @@ inline int os::socket(int domain, int type, int protocol) {
return ::socket(domain, type, protocol);
}
inline int os::listen(int fd, int count) {
if (fd < 0) return OS_ERR;
return ::listen(fd, count);
}
inline int os::socket_shutdown(int fd, int howto){
return ::shutdown(fd, howto);
}
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len){
return ::getsockname(fd, him, 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, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char *optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
inline bool os::supports_monotonic_clock() {
// javaTimeNanos() is monotonic on Solaris, see getTimeNanos() comments
return true;

View File

@ -5091,39 +5091,14 @@ int os::socket_close(int fd) {
return ::closesocket(fd);
}
int os::socket_available(int fd, jint *pbytes) {
int ret = ::ioctlsocket(fd, FIONREAD, (u_long*)pbytes);
return (ret < 0) ? 0 : 1;
}
int os::socket(int domain, int type, int protocol) {
return ::socket(domain, type, protocol);
}
int os::listen(int fd, int count) {
return ::listen(fd, count);
}
int os::connect(int fd, struct sockaddr* him, socklen_t len) {
return ::connect(fd, him, len);
}
int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
return ::accept(fd, him, len);
}
int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
return ::sendto(fd, buf, (int)len, flags, to, tolen);
}
int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
return ::recvfrom(fd, buf, (int)nBytes, flags, from, fromlen);
}
int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
return ::recv(fd, buf, (int)nBytes, flags);
}
@ -5136,45 +5111,6 @@ int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
return ::send(fd, buf, (int)nBytes, flags);
}
int os::timeout(int fd, long timeout) {
fd_set tbl;
struct timeval t;
t.tv_sec = timeout / 1000;
t.tv_usec = (timeout % 1000) * 1000;
tbl.fd_count = 1;
tbl.fd_array[0] = fd;
return ::select(1, &tbl, 0, 0, &t);
}
int os::get_host_name(char* name, int namelen) {
return ::gethostname(name, namelen);
}
int os::socket_shutdown(int fd, int howto) {
return ::shutdown(fd, howto);
}
int os::bind(int fd, struct sockaddr* him, socklen_t len) {
return ::bind(fd, him, len);
}
int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
return ::getsockname(fd, him, len);
}
int os::get_sock_opt(int fd, int level, int optname,
char* optval, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
int os::set_sock_opt(int fd, int level, int optname,
const char* optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
// WINDOWS CONTEXT Flags for THREAD_SAMPLING
#if defined(IA32)
#define sampling_context_flags (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_EXTENDED_REGISTERS)

View File

@ -680,28 +680,10 @@ class os: AllStatic {
// SocketInterface (ex HPI SocketInterface )
static int socket(int domain, int type, int protocol);
static int socket_close(int fd);
static int socket_shutdown(int fd, int howto);
static int recv(int fd, char* buf, size_t nBytes, uint flags);
static int send(int fd, char* buf, size_t nBytes, uint flags);
static int raw_send(int fd, char* buf, size_t nBytes, uint flags);
static int timeout(int fd, long timeout);
static int listen(int fd, int count);
static int connect(int fd, struct sockaddr* him, socklen_t len);
static int bind(int fd, struct sockaddr* him, socklen_t len);
static int accept(int fd, struct sockaddr* him, socklen_t* len);
static int recvfrom(int fd, char* buf, size_t nbytes, uint flags,
struct sockaddr* from, socklen_t* fromlen);
static int get_sock_name(int fd, struct sockaddr* him, socklen_t* len);
static int sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen);
static int socket_available(int fd, jint* pbytes);
static int get_sock_opt(int fd, int level, int optname,
char* optval, socklen_t* optlen);
static int set_sock_opt(int fd, int level, int optname,
const char* optval, socklen_t optlen);
static int get_host_name(char* name, int namelen);
static struct hostent* get_host_by_name(char* name);
// Support for signals (see JVM_RaiseSignal, JVM_RegisterSignal)