< prev index next >

src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c

Print this page
rev 59383 : [mq]: final

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -25,14 +25,10 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
 
-#if defined(__solaris__)
-#include <sys/filio.h>
-#endif
-
 #include "net_util.h"
 
 #include "java_net_PlainDatagramSocketImpl.h"
 #include "java_net_InetAddress.h"
 #include "java_net_NetworkInterface.h"

@@ -50,16 +46,10 @@
 #ifndef IP_MULTICAST_ALL
 #define IP_MULTICAST_ALL      49
 #endif
 #endif  //  __linux__
 
-#ifdef __solaris__
-#ifndef BSD_COMP
-#define BSD_COMP
-#endif
-#endif
-
 #ifndef IPTOS_TOS_MASK
 #define IPTOS_TOS_MASK 0x1e
 #endif
 #ifndef IPTOS_PREC_MASK
 #define IPTOS_PREC_MASK 0xe0

@@ -496,18 +486,10 @@
     }
 
     n = NET_RecvFrom(fd, buf, 1, MSG_PEEK, &rmtaddr.sa, &slen);
 
     if (n == -1) {
-
-#ifdef __solaris__
-        if (errno == ECONNREFUSED) {
-            int orig_errno = errno;
-            recv(fd, buf, 1, 0);
-            errno = orig_errno;
-        }
-#endif
         if (errno == ECONNREFUSED) {
             JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException",
                             "ICMP Port Unreachable");
         } else {
             if (errno == EBADF) {

@@ -630,18 +612,10 @@
     /* truncate the data if the packet's length is too small */
     if (n > packetBufferLen) {
         n = packetBufferLen;
     }
     if (n == -1) {
-
-#ifdef __solaris__
-        if (errno == ECONNREFUSED) {
-            int orig_errno = errno;
-            (void) recv(fd, fullPacket, 1, 0);
-            errno = orig_errno;
-        }
-#endif
         (*env)->SetIntField(env, packet, dp_offsetID, 0);
         (*env)->SetIntField(env, packet, dp_lengthID, 0);
         if (errno == ECONNREFUSED) {
             JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException",
                             "ICMP Port Unreachable");

@@ -1851,14 +1825,13 @@
  *
  * On Linux with IPv6 if we wish to join/leave an IPv4 multicast group then
  * we must use the IPv4 socket options. This is because the IPv6 socket options
  * don't support IPv4-mapped addresses. This is true as per 2.2.19 and 2.4.7
  * kernel releases. In the future it's possible that IP_ADD_MEMBERSHIP
- * will be updated to return ENOPROTOOPT if uses with an IPv6 socket (Solaris
- * already does this). Thus to cater for this we first try with the IPv4
- * socket options and if they fail we use the IPv6 socket options. This
- * seems a reasonable failsafe solution.
+ * will be updated to return ENOPROTOOPT if uses with an IPv6 socket. Thus to
+ * cater for this we first try with the IPv4 socket options and if they fail we
+ * use the IPv6 socket options. This seems a reasonable failsafe solution.
  */
 static void mcast_join_leave(JNIEnv *env, jobject this,
                              jobject iaObj, jobject niObj,
                              jboolean join) {
 
< prev index next >