diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp index 8700d10bee06d7d0a1137f1f45282aafb533f3db..330e347a7e5fb0f4ea9d752e362879c7f4512dd4 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -115,6 +115,7 @@ # include # include # include +# include #define MAX_PATH (2 * K) @@ -4433,6 +4434,15 @@ 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::map_memory(int fd, const char* file_name, size_t file_offset, char *addr, size_t bytes, bool read_only, diff --git a/src/os/linux/vm/os_linux.inline.hpp b/src/os/linux/vm/os_linux.inline.hpp index 6e52d108fb82ea5296fb18d96d67f15a58d441b5..9af7e789764c8fa603be547f38e78f973b828c26 100644 --- a/src/os/linux/vm/os_linux.inline.hpp +++ b/src/os/linux/vm/os_linux.inline.hpp @@ -45,7 +45,6 @@ #include #include #include -#include #include 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, 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); }