United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7191275 Cleanup OS specific blocks in PlainDatagramSocketImpl.c to support more unix-like platforms
JDK-7191275 : Cleanup OS specific blocks in PlainDatagramSocketImpl.c to support more unix-like platforms

Details
Type:
Bug
Submit Date:
2012-08-14
Status:
Closed
Updated Date:
2013-09-04
Project Name:
JDK
Resolved Date:
2012-09-28
Component:
core-libs
OS:
generic
Sub-Component:
java.net
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

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

                                     
2012-09-28



Hardware and Software, Engineered to Work Together