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:
Rainer Orth 2001-08-01 17:53:00 +00:00 committed by Rainer Orth
parent 2a25b23f7f
commit 60a78ccfac
8 changed files with 380 additions and 314 deletions

View File

@ -1,3 +1,22 @@
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>
* libgcj.spec.in: Pass -fkeep-inline-functions to jc1.

View File

@ -65,6 +65,9 @@
/* Define if struct ip_mreq is defined in netinet/in.h. */
#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. */
#undef HAVE_SOCKLEN_T

627
libjava/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -717,6 +717,12 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [struct ip_mreq mreq;],
AC_MSG_RESULT(yes)],
[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_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;],
[AC_DEFINE(HAVE_INET6)
@ -724,7 +730,8 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;],
[AC_MSG_RESULT(no)])
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;],
[AC_DEFINE(HAVE_SOCKLEN_T)
AC_MSG_RESULT(yes)],

View File

@ -83,6 +83,9 @@
/* Define if struct ip_mreq is defined in netinet/in.h. */
#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. */
#undef HAVE_SOCKLEN_T

View File

@ -8,6 +8,11 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
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 <sys/types.h>

View File

@ -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;

View File

@ -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;