Commit 60a78ccf by Rainer Orth Committed by Rainer Orth

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
parent 2a25b23f
2001-08-01 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* 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.
2001-08-01 Jeff Sturm <jsturm@one-point.com> 2001-08-01 Jeff Sturm <jsturm@one-point.com>
* libgcj.spec.in: Pass -fkeep-inline-functions to jc1. * libgcj.spec.in: Pass -fkeep-inline-functions to jc1.
......
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
/* Define if struct ip_mreq is defined in netinet/in.h. */ /* Define if struct ip_mreq is defined in netinet/in.h. */
#undef HAVE_STRUCT_IP_MREQ #undef HAVE_STRUCT_IP_MREQ
/* Define if struct ipv6_mreq is defined in netinet/in.h. */
#undef HAVE_STRUCT_IPV6_MREQ
/* Define it socklen_t typedef is in sys/socket.h. */ /* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T #undef HAVE_SOCKLEN_T
......
...@@ -717,6 +717,12 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [struct ip_mreq mreq;], ...@@ -717,6 +717,12 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [struct ip_mreq mreq;],
AC_MSG_RESULT(yes)], AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h])
AC_TRY_COMPILE([#include <netinet/in.h>], [struct ipv6_mreq mreq6;],
[AC_DEFINE(HAVE_STRUCT_IPV6_MREQ)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h]) AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;], AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;],
[AC_DEFINE(HAVE_INET6) [AC_DEFINE(HAVE_INET6)
...@@ -724,7 +730,8 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;], ...@@ -724,7 +730,8 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;],
[AC_MSG_RESULT(no)]) [AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for socklen_t in sys/socket.h]) AC_MSG_CHECKING([for socklen_t in sys/socket.h])
AC_TRY_COMPILE([#include <sys/types.h> AC_TRY_COMPILE([#define _POSIX_PII_SOCKET
#include <sys/types.h>
#include <sys/socket.h>], [socklen_t x = 5;], #include <sys/socket.h>], [socklen_t x = 5;],
[AC_DEFINE(HAVE_SOCKLEN_T) [AC_DEFINE(HAVE_SOCKLEN_T)
AC_MSG_RESULT(yes)], AC_MSG_RESULT(yes)],
......
...@@ -83,6 +83,9 @@ ...@@ -83,6 +83,9 @@
/* Define if struct ip_mreq is defined in netinet/in.h. */ /* Define if struct ip_mreq is defined in netinet/in.h. */
#undef HAVE_STRUCT_IP_MREQ #undef HAVE_STRUCT_IP_MREQ
/* Define if struct ipv6_mreq is defined in netinet/in.h. */
#undef HAVE_STRUCT_IPV6_MREQ
/* Define it socklen_t typedef is in sys/socket.h. */ /* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T #undef HAVE_SOCKLEN_T
......
...@@ -8,6 +8,11 @@ This software is copyrighted work licensed under the terms of the ...@@ -8,6 +8,11 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */ details. */
/* Required on Tru64 UNIX V4/V5 so <sys/socket.h> defines prototypes of
socket functions with socklen_t instead of size_t. This must be defined
early so <standards.h> defines the correct version of __PIIX. */
#define _POSIX_PII_SOCKET
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
......
...@@ -158,7 +158,7 @@ union McastReq ...@@ -158,7 +158,7 @@ union McastReq
#if HAVE_STRUCT_IP_MREQ #if HAVE_STRUCT_IP_MREQ
struct ip_mreq mreq; struct ip_mreq mreq;
#endif #endif
#ifdef HAVE_INET6 #if HAVE_STRUCT_IPV6_MREQ
struct ipv6_mreq mreq6; struct ipv6_mreq mreq6;
#endif #endif
}; };
...@@ -423,7 +423,7 @@ java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *inetaddr, ...@@ -423,7 +423,7 @@ java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *inetaddr,
ptr = (const char *) &u.mreq; ptr = (const char *) &u.mreq;
} }
#endif #endif
#ifdef HAVE_INET6 #if HAVE_STRUCT_IPV6_MREQ
else if (len == 16) else if (len == 16)
{ {
level = IPPROTO_IPV6; level = IPPROTO_IPV6;
...@@ -531,7 +531,8 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID, ...@@ -531,7 +531,8 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID,
len = sizeof (struct in_addr); len = sizeof (struct in_addr);
ptr = (const char *) &u.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) else if (len == 16)
{ {
level = IPPROTO_IPV6; level = IPPROTO_IPV6;
......
...@@ -33,6 +33,10 @@ details. */ ...@@ -33,6 +33,10 @@ details. */
#include <bstring.h> #include <bstring.h>
#endif #endif
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
// Avoid macro definitions of bind, connect from system headers, e.g. on // Avoid macro definitions of bind, connect from system headers, e.g. on
// Solaris 7 with _XOPEN_SOURCE. FIXME // Solaris 7 with _XOPEN_SOURCE. FIXME
static inline int static inline int
...@@ -55,6 +59,17 @@ _Jv_connect (int fd, struct sockaddr *addr, int addrlen) ...@@ -55,6 +59,17 @@ _Jv_connect (int fd, struct sockaddr *addr, int addrlen)
#undef connect #undef connect
#endif #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/cni.h>
#include <gcj/javaprims.h> #include <gcj/javaprims.h>
#include <java/io/IOException.h> #include <java/io/IOException.h>
...@@ -126,10 +141,6 @@ java::net::PlainSocketImpl::getOption (jint) ...@@ -126,10 +141,6 @@ java::net::PlainSocketImpl::getOption (jint)
#else /* DISABLE_JAVA_NET */ #else /* DISABLE_JAVA_NET */
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
union SockAddr union SockAddr
{ {
struct sockaddr_in address; struct sockaddr_in address;
...@@ -283,7 +294,7 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s) ...@@ -283,7 +294,7 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
JvNewStringUTF("Accept timed out")); JvNewStringUTF("Accept timed out"));
} }
new_socket = ::accept (fnum, (sockaddr*) &u, &addrlen); new_socket = _Jv_accept (fnum, (sockaddr*) &u, &addrlen);
if (new_socket < 0) if (new_socket < 0)
goto error; goto error;
jbyteArray raddr; jbyteArray raddr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment