Thu, 16 Dec 2010 20:57:03 -0500
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
src/os/linux/vm/os_linux.cpp | file | annotate | diff | comparison | revisions | |
src/os/linux/vm/os_linux.inline.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/os/linux/vm/os_linux.cpp Thu Dec 16 12:56:51 2010 -0800 1.2 +++ b/src/os/linux/vm/os_linux.cpp Thu Dec 16 20:57:03 2010 -0500 1.3 @@ -115,6 +115,7 @@ 1.4 # include <link.h> 1.5 # include <stdint.h> 1.6 # include <inttypes.h> 1.7 +# include <sys/ioctl.h> 1.8 1.9 #define MAX_PATH (2 * K) 1.10 1.11 @@ -4433,6 +4434,15 @@ 1.12 return 1; 1.13 } 1.14 1.15 +int os::socket_available(int fd, jint *pbytes) { 1.16 + // Linux doc says EINTR not returned, unlike Solaris 1.17 + int ret = ::ioctl(fd, FIONREAD, pbytes); 1.18 + 1.19 + //%% note ioctl can return 0 when successful, JVM_SocketAvailable 1.20 + // is expected to return 0 on failure and 1 on success to the jdk. 1.21 + return (ret < 0) ? 0 : 1; 1.22 +} 1.23 + 1.24 // Map a block of memory. 1.25 char* os::map_memory(int fd, const char* file_name, size_t file_offset, 1.26 char *addr, size_t bytes, bool read_only,
2.1 --- a/src/os/linux/vm/os_linux.inline.hpp Thu Dec 16 12:56:51 2010 -0800 2.2 +++ b/src/os/linux/vm/os_linux.inline.hpp Thu Dec 16 20:57:03 2010 -0500 2.3 @@ -45,7 +45,6 @@ 2.4 #include <unistd.h> 2.5 #include <sys/socket.h> 2.6 #include <sys/poll.h> 2.7 -#include <sys/ioctl.h> 2.8 #include <netdb.h> 2.9 2.10 inline void* os::thread_local_storage_at(int index) { 2.11 @@ -268,16 +267,6 @@ 2.12 RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen)); 2.13 } 2.14 2.15 -inline int os::socket_available(int fd, jint *pbytes) { 2.16 - // Linux doc says EINTR not returned, unlike Solaris 2.17 - int ret = ::ioctl(fd, FIONREAD, pbytes); 2.18 - 2.19 - //%% note ioctl can return 0 when successful, JVM_SocketAvailable 2.20 - // is expected to return 0 on failure and 1 on success to the jdk. 2.21 - return (ret < 0) ? 0 : 1; 2.22 -} 2.23 - 2.24 - 2.25 inline int os::socket_shutdown(int fd, int howto){ 2.26 return ::shutdown(fd, howto); 2.27 }