提交 4a70c4a9 编写于 作者: D dholmes

7003707: need to remove (some) system include files from the HotSpot header files

Summary: move socket_available into os_linux.cpp to avoid inclusion of ioctl.h in os_linux.inline.hpp
Reviewed-by: coleenp, stefank, ikrylov
上级 61bf249c
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
# include <link.h> # include <link.h>
# include <stdint.h> # include <stdint.h>
# include <inttypes.h> # include <inttypes.h>
# include <sys/ioctl.h>
#define MAX_PATH (2 * K) #define MAX_PATH (2 * K)
...@@ -4433,6 +4434,15 @@ int os::available(int fd, jlong *bytes) { ...@@ -4433,6 +4434,15 @@ int os::available(int fd, jlong *bytes) {
return 1; 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. // Map a block of memory.
char* os::map_memory(int fd, const char* file_name, size_t file_offset, char* os::map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only, char *addr, size_t bytes, bool read_only,
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <unistd.h> #include <unistd.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/poll.h> #include <sys/poll.h>
#include <sys/ioctl.h>
#include <netdb.h> #include <netdb.h>
inline void* os::thread_local_storage_at(int index) { inline void* os::thread_local_storage_at(int index) {
...@@ -268,16 +267,6 @@ inline int os::sendto(int fd, char *buf, int len, int flags, ...@@ -268,16 +267,6 @@ inline int os::sendto(int fd, char *buf, int len, int flags,
RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, 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){ inline int os::socket_shutdown(int fd, int howto){
return ::shutdown(fd, howto); return ::shutdown(fd, howto);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册