JDK-7191275 : Cleanup OS specific blocks in PlainDatagramSocketImpl.c to support more unix-like platforms
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-08-14
  • Updated: 2013-09-04
  • Resolved: 2012-09-28
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
7u40Fixed 8 b56Fixed
Description
In source code "jdk\src\solaris\native\java\net\PlainDatagramSocketImpl.c",
there are several macros in the form of:

  #ifdef AF_INET6
  #if defined(__solaris__) || defined(MACOSX)
       //  code for solaris and macosx (unix) [1]
  #endif
  #ifdef __linux__
       //  code for linux
  #endif
  #else
       // code for non AF_INET6
  #endif  /* AF_INET6 */

The code blocks enclosed by the macro are method invocations of 
mcast_set_if_by_addr_v6(),  mcast_set_if_by_addr_v4(), 
mcast_set_loop_v4(), mcast_set_loop_v6(), setHopLimit() and setTTL().

Other unix-like os, i.e. AIX, BSD and some others need the exact calling 
sequence coded in block [1].  This CR proposes to a adopt the following 
pattern:

  #ifdef AF_INET6
  #ifdef __linux__
       //  code for linux
  #else  /* __linux__ not defined */
       //  code for UNIX
  #endif  /* __linux__ */
  #else
       // non AF_INET6
  #endif  /* AF_INET6 */

see the full discussion on the net-dev mailing list:
  http://mail.openjdk.java.net/pipermail/net-dev/2012-August/004620.html

Comments
JDK8 changeset http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4993f8aa7f2e changeset: 5704:4993f8aa7f2e tag: tip user: dingxmin date: Fri Aug 17 17:10:56 2012 +0800 files: src/solaris/native/java/net/PlainDatagramSocketImpl.c description: 7191275: Cleanup OS specific blocks in PlainDatagramSocketImpl.c to support more unix-like platforms Reviewed-by: chegar
28-09-2012