src/solaris/native/java/net/net_util_md.c
Print this page
rev 8975 : 8031581: PPC64: Addons and fixes for AIX to pass the jdk regression tests
@@ -994,15 +994,11 @@
{ java_net_SocketOptions_SO_OOBINLINE, SOL_SOCKET, SO_OOBINLINE },
{ java_net_SocketOptions_SO_LINGER, SOL_SOCKET, SO_LINGER },
{ java_net_SocketOptions_SO_SNDBUF, SOL_SOCKET, SO_SNDBUF },
{ java_net_SocketOptions_SO_RCVBUF, SOL_SOCKET, SO_RCVBUF },
{ java_net_SocketOptions_SO_KEEPALIVE, SOL_SOCKET, SO_KEEPALIVE },
-#if defined(_AIX)
- { java_net_SocketOptions_SO_REUSEADDR, SOL_SOCKET, SO_REUSEPORT },
-#else
{ java_net_SocketOptions_SO_REUSEADDR, SOL_SOCKET, SO_REUSEADDR },
-#endif
{ java_net_SocketOptions_SO_BROADCAST, SOL_SOCKET, SO_BROADCAST },
{ java_net_SocketOptions_IP_TOS, IPPROTO_IP, IP_TOS },
{ java_net_SocketOptions_IP_MULTICAST_IF, IPPROTO_IP, IP_MULTICAST_IF },
{ java_net_SocketOptions_IP_MULTICAST_IF2, IPPROTO_IP, IP_MULTICAST_IF },
{ java_net_SocketOptions_IP_MULTICAST_LOOP, IPPROTO_IP, IP_MULTICAST_LOOP },
@@ -1283,10 +1279,11 @@
*/
int
NET_SetSockOpt(int fd, int level, int opt, const void *arg,
int len)
{
+
#ifndef IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1e
#endif
#ifndef IPTOS_PREC_MASK
#define IPTOS_PREC_MASK 0xe0
@@ -1303,13 +1300,10 @@
#ifdef __APPLE__
static int maxsockbuf = -1;
#else
static long maxsockbuf = -1;
#endif
-
- int addopt;
- struct linger *ling;
#endif
/*
* IPPROTO/IP_TOS :-
* 1. IPv6 on Solaris/Mac OS: NOOP and will be set
@@ -1477,14 +1471,16 @@
*bufsize = 1024;
}
}
}
+#endif
+#if defined(_ALLBSD_SOURCE) || defined(_AIX)
/*
* On Solaris, SO_REUSEADDR will allow multiple datagram
- * sockets to bind to the same port. The network jck tests
+ * sockets to bind to the same port. The network jck tests check
* for this "feature", so we need to emulate it by turning on
* SO_REUSEPORT as well for that combination.
*/
if (level == SOL_SOCKET && opt == SO_REUSEADDR) {
int sotype;
@@ -1494,15 +1490,13 @@
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) < 0) {
return -1;
}
if (sotype == SOCK_DGRAM) {
- addopt = SO_REUSEPORT;
- setsockopt(fd, level, addopt, arg, len);
+ setsockopt(fd, level, SO_REUSEPORT, arg, len);
}
}
-
#endif
return setsockopt(fd, level, opt, arg, len);
}
@@ -1668,11 +1662,11 @@
newTime = JVM_CurrentTimeMillis(env, 0);
timeout -= (newTime - prevTime);
if (timeout <= 0) {
return read_rv > 0 ? 0 : -1;
}
- newTime = prevTime;
+ prevTime = newTime;
if (read_rv > 0) {
break;
}