re PR libgcj/3694 (natPlainDatagramSocketImpl.cc doesn't compile in ALPHA OSF1)
* include/posix.h (_POSIX_PII_SOCKET): Define. * configure.in (HAVE_SOCKLEN_T): Define. * java/net/natPlainSocketImpl.cc [!HAVE_SOCKLEN_T]: Move socklen_t definition up. (_JV_accept): New function, avoids Tru64 UNIX accept macro. (java::net::PlainSocketImpl::accept): Use it. Fixes PRs libgcj/3694, libgcj/3696. * configure.in (HAVE_STRUCT_IPV6_MREQ): New test. * acconfig.h (HAVE_STRUCT_IPV6_MREQ): Provide template. * configure, include/config.h.in: Regenerate. * java/net/natPlainDatagramSocketImpl.cc (union McastReq): Use it. (mcastGrp): Likewise. (java::net::PlainDatagramSocketImpl::setOption): Guard against missing IPV6_MULTICAST_IF. Fixes PR libgcj/3694. From-SVN: r44546
This commit is contained in:
parent
2a25b23f7f
commit
60a78ccfac
8 changed files with 380 additions and 314 deletions
|
@ -158,7 +158,7 @@ union McastReq
|
|||
#if HAVE_STRUCT_IP_MREQ
|
||||
struct ip_mreq mreq;
|
||||
#endif
|
||||
#ifdef HAVE_INET6
|
||||
#if HAVE_STRUCT_IPV6_MREQ
|
||||
struct ipv6_mreq mreq6;
|
||||
#endif
|
||||
};
|
||||
|
@ -423,7 +423,7 @@ java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *inetaddr,
|
|||
ptr = (const char *) &u.mreq;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_INET6
|
||||
#if HAVE_STRUCT_IPV6_MREQ
|
||||
else if (len == 16)
|
||||
{
|
||||
level = IPPROTO_IPV6;
|
||||
|
@ -531,7 +531,8 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID,
|
|||
len = sizeof (struct in_addr);
|
||||
ptr = (const char *) &u.addr;
|
||||
}
|
||||
#ifdef HAVE_INET6
|
||||
// Tru64 UNIX V5.0 has struct sockaddr_in6, but no IPV6_MULTICAST_IF
|
||||
#if defined (HAVE_INET6) && defined (IPV6_MULTICAST_IF)
|
||||
else if (len == 16)
|
||||
{
|
||||
level = IPPROTO_IPV6;
|
||||
|
|
|
@ -33,6 +33,10 @@ details. */
|
|||
#include <bstring.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
// Avoid macro definitions of bind, connect from system headers, e.g. on
|
||||
// Solaris 7 with _XOPEN_SOURCE. FIXME
|
||||
static inline int
|
||||
|
@ -55,6 +59,17 @@ _Jv_connect (int fd, struct sockaddr *addr, int addrlen)
|
|||
#undef connect
|
||||
#endif
|
||||
|
||||
// Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
|
||||
static inline int
|
||||
_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
{
|
||||
return ::accept (fd, addr, addrlen);
|
||||
}
|
||||
|
||||
#ifdef accept
|
||||
#undef accept
|
||||
#endif
|
||||
|
||||
#include <gcj/cni.h>
|
||||
#include <gcj/javaprims.h>
|
||||
#include <java/io/IOException.h>
|
||||
|
@ -126,10 +141,6 @@ java::net::PlainSocketImpl::getOption (jint)
|
|||
|
||||
#else /* DISABLE_JAVA_NET */
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
union SockAddr
|
||||
{
|
||||
struct sockaddr_in address;
|
||||
|
@ -283,7 +294,7 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
|
|||
JvNewStringUTF("Accept timed out"));
|
||||
}
|
||||
|
||||
new_socket = ::accept (fnum, (sockaddr*) &u, &addrlen);
|
||||
new_socket = _Jv_accept (fnum, (sockaddr*) &u, &addrlen);
|
||||
if (new_socket < 0)
|
||||
goto error;
|
||||
jbyteArray raddr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue