1.1 --- a/src/os/solaris/vm/os_solaris.cpp Tue Dec 20 12:27:31 2011 -0800 1.2 +++ b/src/os/solaris/vm/os_solaris.cpp Thu Dec 22 12:01:46 2011 -0500 1.3 @@ -6359,17 +6359,16 @@ 1.4 RESTARTABLE_RETURN_INT(::close(fd)); 1.5 } 1.6 1.7 -int os::recv(int fd, char *buf, int nBytes, int flags) { 1.8 - INTERRUPTIBLE_RETURN_INT(::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); 1.9 -} 1.10 - 1.11 - 1.12 -int os::send(int fd, char *buf, int nBytes, int flags) { 1.13 - INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); 1.14 -} 1.15 - 1.16 -int os::raw_send(int fd, char *buf, int nBytes, int flags) { 1.17 - RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags)); 1.18 +int os::recv(int fd, char* buf, size_t nBytes, uint flags) { 1.19 + INTERRUPTIBLE_RETURN_INT((int)::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); 1.20 +} 1.21 + 1.22 +int os::send(int fd, char* buf, size_t nBytes, uint flags) { 1.23 + INTERRUPTIBLE_RETURN_INT((int)::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted); 1.24 +} 1.25 + 1.26 +int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) { 1.27 + RESTARTABLE_RETURN_INT((int)::send(fd, buf, nBytes, flags)); 1.28 } 1.29 1.30 // As both poll and select can be interrupted by signals, we have to be 1.31 @@ -6404,19 +6403,19 @@ 1.32 } 1.33 } 1.34 1.35 -int os::connect(int fd, struct sockaddr *him, int len) { 1.36 +int os::connect(int fd, struct sockaddr *him, socklen_t len) { 1.37 int _result; 1.38 - INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result, 1.39 + INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result,\ 1.40 os::Solaris::clear_interrupted); 1.41 1.42 // Depending on when thread interruption is reset, _result could be 1.43 // one of two values when errno == EINTR 1.44 1.45 if (((_result == OS_INTRPT) || (_result == OS_ERR)) 1.46 - && (errno == EINTR)) { 1.47 + && (errno == EINTR)) { 1.48 /* restarting a connect() changes its errno semantics */ 1.49 - INTERRUPTIBLE(::connect(fd, him, len), _result, 1.50 - os::Solaris::clear_interrupted); 1.51 + INTERRUPTIBLE(::connect(fd, him, len), _result,\ 1.52 + os::Solaris::clear_interrupted); 1.53 /* undo these changes */ 1.54 if (_result == OS_ERR) { 1.55 if (errno == EALREADY) { 1.56 @@ -6430,43 +6429,38 @@ 1.57 return _result; 1.58 } 1.59 1.60 -int os::accept(int fd, struct sockaddr *him, int *len) { 1.61 - if (fd < 0) 1.62 - return OS_ERR; 1.63 - INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him,\ 1.64 - (socklen_t*) len), os::Solaris::clear_interrupted); 1.65 - } 1.66 - 1.67 -int os::recvfrom(int fd, char *buf, int nBytes, int flags, 1.68 - sockaddr *from, int *fromlen) { 1.69 - //%%note jvm_r11 1.70 - INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes,\ 1.71 - flags, from, fromlen), os::Solaris::clear_interrupted); 1.72 -} 1.73 - 1.74 -int os::sendto(int fd, char *buf, int len, int flags, 1.75 - struct sockaddr *to, int tolen) { 1.76 - //%%note jvm_r11 1.77 - INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags,\ 1.78 - to, tolen), os::Solaris::clear_interrupted); 1.79 +int os::accept(int fd, struct sockaddr* him, socklen_t* len) { 1.80 + if (fd < 0) { 1.81 + return OS_ERR; 1.82 + } 1.83 + INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him, len),\ 1.84 + os::Solaris::clear_interrupted); 1.85 +} 1.86 + 1.87 +int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags, 1.88 + sockaddr* from, socklen_t* fromlen) { 1.89 + INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen),\ 1.90 + os::Solaris::clear_interrupted); 1.91 +} 1.92 + 1.93 +int os::sendto(int fd, char* buf, size_t len, uint flags, 1.94 + struct sockaddr* to, socklen_t tolen) { 1.95 + INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen),\ 1.96 + os::Solaris::clear_interrupted); 1.97 } 1.98 1.99 int os::socket_available(int fd, jint *pbytes) { 1.100 - if (fd < 0) 1.101 - return OS_OK; 1.102 - 1.103 - int ret; 1.104 - 1.105 - RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); 1.106 - 1.107 - //%% note ioctl can return 0 when successful, JVM_SocketAvailable 1.108 - // is expected to return 0 on failure and 1 on success to the jdk. 1.109 - 1.110 - return (ret == OS_ERR) ? 0 : 1; 1.111 -} 1.112 - 1.113 - 1.114 -int os::bind(int fd, struct sockaddr *him, int len) { 1.115 + if (fd < 0) { 1.116 + return OS_OK; 1.117 + } 1.118 + int ret; 1.119 + RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret); 1.120 + // note: ioctl can return 0 when successful, JVM_SocketAvailable 1.121 + // is expected to return 0 on failure and 1 on success to the jdk. 1.122 + return (ret == OS_ERR) ? 0 : 1; 1.123 +} 1.124 + 1.125 +int os::bind(int fd, struct sockaddr* him, socklen_t len) { 1.126 INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\ 1.127 - os::Solaris::clear_interrupted); 1.128 -} 1.129 + os::Solaris::clear_interrupted); 1.130 +}