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,