Suggestion of combining some macros of processing solaris, macosx with other UNIX

Frank Ding dingxmin at linux.vnet.ibm.com
Mon Aug 6 22:46:32 PDT 2012


Hi all,
   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 other need exact calling 
sequence coded in block [1].  So I made a patch that transformed the 
above code into 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 */

Could anybody take a look at my patch below and make comment?
http://cr.openjdk.java.net/~youdwei/ojdk-533/webrev.00/

Thanks & Best regards,
Frank




More information about the net-dev mailing list