changeset 5398:979c364ea1f1

7191275: Cleanup OS specific blocks in PlainDatagramSocketImpl.c to support more unix-like platforms Reviewed-by: chegar
author dingxmin
date Fri, 17 Aug 2012 17:10:56 +0800
parents dc357f9feaa2
children cc5a750d21df
files src/solaris/native/java/net/PlainDatagramSocketImpl.c
diffstat 1 files changed, 28 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Thu Aug 23 16:28:17 2012 +0800
+++ b/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Fri Aug 17 17:10:56 2012 +0800
@@ -1350,19 +1350,18 @@
          * value is an InetAddress.
          */
 #ifdef AF_INET6
-#if defined(__solaris__) || defined(MACOSX)
+#ifdef __linux__
+        mcast_set_if_by_addr_v4(env, this, fd, value);
+        if (ipv6_available()) {
+            mcast_set_if_by_addr_v6(env, this, fd, value);
+        }
+#else  /* __linux__ not defined */
         if (ipv6_available()) {
             mcast_set_if_by_addr_v6(env, this, fd, value);
         } else {
             mcast_set_if_by_addr_v4(env, this, fd, value);
         }
-#endif
-#ifdef __linux__
-        mcast_set_if_by_addr_v4(env, this, fd, value);
-        if (ipv6_available()) {
-            mcast_set_if_by_addr_v6(env, this, fd, value);
-        }
-#endif
+#endif  /* __linux__ */
 #else
         mcast_set_if_by_addr_v4(env, this, fd, value);
 #endif  /* AF_INET6 */
@@ -1373,19 +1372,18 @@
          * value is a NetworkInterface.
          */
 #ifdef AF_INET6
-#if defined(__solaris__) || defined(MACOSX)
+#ifdef __linux__
+        mcast_set_if_by_if_v4(env, this, fd, value);
+        if (ipv6_available()) {
+            mcast_set_if_by_if_v6(env, this, fd, value);
+        }
+#else  /* __linux__ not defined */
         if (ipv6_available()) {
             mcast_set_if_by_if_v6(env, this, fd, value);
         } else {
             mcast_set_if_by_if_v4(env, this, fd, value);
         }
-#endif
-#ifdef __linux__
-        mcast_set_if_by_if_v4(env, this, fd, value);
-        if (ipv6_available()) {
-            mcast_set_if_by_if_v6(env, this, fd, value);
-        }
-#endif
+#endif  /* __linux__ */
 #else
         mcast_set_if_by_if_v4(env, this, fd, value);
 #endif  /* AF_INET6 */
@@ -1456,19 +1454,18 @@
 static void setMulticastLoopbackMode(JNIEnv *env, jobject this, int fd,
                                   jint opt, jobject value) {
 #ifdef AF_INET6
-#if defined(__solaris__) || defined(MACOSX)
+#ifdef __linux__
+    mcast_set_loop_v4(env, this, fd, value);
+    if (ipv6_available()) {
+        mcast_set_loop_v6(env, this, fd, value);
+    }
+#else  /* __linux__ not defined */
     if (ipv6_available()) {
         mcast_set_loop_v6(env, this, fd, value);
     } else {
         mcast_set_loop_v4(env, this, fd, value);
     }
-#endif
-#ifdef __linux__
-    mcast_set_loop_v4(env, this, fd, value);
-    if (ipv6_available()) {
-        mcast_set_loop_v6(env, this, fd, value);
-    }
-#endif
+#endif  /* __linux__ */
 #else
     mcast_set_loop_v4(env, this, fd, value);
 #endif  /* AF_INET6 */
@@ -2030,13 +2027,6 @@
     }
     /* setsockopt to be correct ttl */
 #ifdef AF_INET6
-#if defined(__solaris__) || defined(MACOSX)
-    if (ipv6_available()) {
-        setHopLimit(env, fd, ttl);
-    } else {
-        setTTL(env, fd, ttl);
-    }
-#endif
 #ifdef __linux__
     setTTL(env, fd, ttl);
     if (ipv6_available()) {
@@ -2045,7 +2035,13 @@
             (*env)->SetIntField(env, this, pdsi_ttlID, ttl);
         }
     }
-#endif  // __linux__
+#else  /*  __linux__ not defined */
+    if (ipv6_available()) {
+        setHopLimit(env, fd, ttl);
+    } else {
+        setTTL(env, fd, ttl);
+    }
+#endif  /* __linux__ */
 #else
     setTTL(env, fd, ttl);
 #endif  /* AF_INET6 */