comparison src/os/linux/vm/os_linux.inline.hpp @ 2033:03e1b9fce89d

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
author dholmes
date Thu, 16 Dec 2010 20:57:03 -0500
parents 828eafbd85cc
children b92c45f2bc75
comparison
equal deleted inserted replaced
2032:320ef6401fce 2033:03e1b9fce89d
43 // System includes 43 // System includes
44 44
45 #include <unistd.h> 45 #include <unistd.h>
46 #include <sys/socket.h> 46 #include <sys/socket.h>
47 #include <sys/poll.h> 47 #include <sys/poll.h>
48 #include <sys/ioctl.h>
49 #include <netdb.h> 48 #include <netdb.h>
50 49
51 inline void* os::thread_local_storage_at(int index) { 50 inline void* os::thread_local_storage_at(int index) {
52 return pthread_getspecific((pthread_key_t)index); 51 return pthread_getspecific((pthread_key_t)index);
53 } 52 }
266 inline int os::sendto(int fd, char *buf, int len, int flags, 265 inline int os::sendto(int fd, char *buf, int len, int flags,
267 struct sockaddr *to, int tolen) { 266 struct sockaddr *to, int tolen) {
268 RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen)); 267 RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen));
269 } 268 }
270 269
271 inline int os::socket_available(int fd, jint *pbytes) {
272 // Linux doc says EINTR not returned, unlike Solaris
273 int ret = ::ioctl(fd, FIONREAD, pbytes);
274
275 //%% note ioctl can return 0 when successful, JVM_SocketAvailable
276 // is expected to return 0 on failure and 1 on success to the jdk.
277 return (ret < 0) ? 0 : 1;
278 }
279
280
281 inline int os::socket_shutdown(int fd, int howto){ 270 inline int os::socket_shutdown(int fd, int howto){
282 return ::shutdown(fd, howto); 271 return ::shutdown(fd, howto);
283 } 272 }
284 273
285 inline int os::bind(int fd, struct sockaddr *him, int len){ 274 inline int os::bind(int fd, struct sockaddr *him, int len){