JDK-7091417 : recvfrom's 6th input should be of type socklen_t
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7u2
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_11
  • CPU: generic
  • Submitted: 2011-09-16
  • Updated: 2012-03-29
  • Resolved: 2012-03-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Related Reports
Relates :  
Description
The current JVM doesn't build under Solaris 11 since recvfrom method's 6th input should be a socklen_t.  Diffs are attached.

Comments
EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/11c26bfcf8c7
22-03-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/11c26bfcf8c7
22-12-2011

EVALUATION The attached suggested fix doesn't cover enough ground. In addition to recvfrom and sendto, the interfaces to recv, send, connect, accept, getsockname, getsockopt, and setsockopt should also be fixed to use either socklen_t*, socklen_t or size_t. This is also a correctness issue, as on some systems socklen_t isn't the same width as int.
20-12-2011

SUGGESTED FIX From ###@###.###: diff -r 35c656d0b685 src/os/linux/vm/jvm_linux.h --- a/src/os/linux/vm/jvm_linux.h Wed Sep 14 13:57:32 2011 -0700 +++ b/src/os/linux/vm/jvm_linux.h Fri Sep 16 08:41:24 2011 -0500 @@ -73,6 +73,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/socket.h> #include <fcntl.h> #include <errno.h> diff -r 35c656d0b685 src/os/linux/vm/os_linux.inline.hpp --- a/src/os/linux/vm/os_linux.inline.hpp Wed Sep 14 13:57:32 2011 -0700 +++ b/src/os/linux/vm/os_linux.inline.hpp Fri Sep 16 08:41:24 2011 -0500 @@ -266,7 +266,7 @@ } inline int os::recvfrom(int fd, char *buf, int nBytes, int flags, - sockaddr *from, int *fromlen) { + sockaddr *from, socklen_t *fromlen) { RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen)); } diff -r 35c656d0b685 src/os/solaris/vm/jvm_solaris.h --- a/src/os/solaris/vm/jvm_solaris.h Wed Sep 14 13:57:32 2011 -0700 +++ b/src/os/solaris/vm/jvm_solaris.h Fri Sep 16 08:41:24 2011 -0500 @@ -70,6 +70,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/socket.h> #include <fcntl.h> #include <errno.h> diff -r 35c656d0b685 src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp Wed Sep 14 13:57:32 2011 -0700 +++ b/src/os/solaris/vm/os_solaris.cpp Fri Sep 16 08:41:24 2011 -0500 @@ -6429,7 +6429,7 @@ } int os::recvfrom(int fd, char *buf, int nBytes, int flags, - sockaddr *from, int *fromlen) { + sockaddr *from, socklen_t *fromlen) { //%%note jvm_r11 INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes,\ flags, from, fromlen), os::Solaris::clear_interrupted); diff -r 35c656d0b685 src/share/vm/prims/jvm.cpp --- a/src/share/vm/prims/jvm.cpp Wed Sep 14 13:57:32 2011 -0700 +++ b/src/share/vm/prims/jvm.cpp Fri Sep 16 08:41:24 2011 -0500 @@ -3523,7 +3523,7 @@ JVM_END -JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen)) +JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, socklen_t *fromlen)) JVMWrapper2("JVM_RecvFrom (0x%x)", fd); //%note jvm_r6 return os::recvfrom(fd, buf, nBytes, flags, from, fromlen); diff -r 35c656d0b685 src/share/vm/prims/jvm.h --- a/src/share/vm/prims/jvm.h Wed Sep 14 13:57:32 2011 -0700 +++ b/src/share/vm/prims/jvm.h Fri Sep 16 08:41:24 2011 -0500 @@ -1376,7 +1376,7 @@ JNIEXPORT jint JNICALL JVM_RecvFrom(jint fd, char *buf, int nBytes, - int flags, struct sockaddr *from, int *fromlen); + int flags, struct sockaddr *from, socklen_t *fromlen); JNIEXPORT jint JNICALL JVM_SendTo(jint fd, char *buf, int len, diff -r 35c656d0b685 src/share/vm/runtime/os.hpp --- a/src/share/vm/runtime/os.hpp Wed Sep 14 13:57:32 2011 -0700 +++ b/src/share/vm/runtime/os.hpp Fri Sep 16 08:41:24 2011 -0500 @@ -587,7 +587,7 @@ static int bind(int fd, struct sockaddr *him, int len); static int accept(int fd, struct sockaddr *him, int *len); static int recvfrom(int fd, char *buf, int nbytes, int flags, - struct sockaddr *from, int *fromlen); + struct sockaddr *from, socklen_t *fromlen); static int get_sock_name(int fd, struct sockaddr *him, int *len); static int sendto(int fd, char *buf, int len, int flags, struct sockaddr *to, int tolen);
23-09-2011

EVALUATION Ok.
23-09-2011