natPlainDatagramSocketImpl.cc: Undefine bind if defined.
* java/net/natPlainDatagramSocketImpl.cc: Undefine bind if defined. (_Jv_bind): New static function. (bind): Use _Jv_bind. * java/net/natPlainSocketImpl.cc: Undefine bind, connect if defined. (_Jv_bind, _Jv_connect): New static functions. (bind): Use _Jv_bind. (connect): Use _Jv_connect. From-SVN: r44494
This commit is contained in:
parent
3fe670a469
commit
2ff78183f8
3 changed files with 47 additions and 3 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2001-07-30 Jeff Sturm <jsturm@one-point.com>
|
||||||
|
|
||||||
|
* java/net/natPlainDatagramSocketImpl.cc: Undefine bind if defined.
|
||||||
|
(_Jv_bind): New static function.
|
||||||
|
(bind): Use _Jv_bind.
|
||||||
|
* java/net/natPlainSocketImpl.cc: Undefine bind, connect if defined.
|
||||||
|
(_Jv_bind, _Jv_connect): New static functions.
|
||||||
|
(bind): Use _Jv_bind.
|
||||||
|
(connect): Use _Jv_connect.
|
||||||
|
|
||||||
2001-07-30 Tom Tromey <tromey@redhat.com>
|
2001-07-30 Tom Tromey <tromey@redhat.com>
|
||||||
Corey Minyard <minyard@acm.org>
|
Corey Minyard <minyard@acm.org>
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,18 @@ details. */
|
||||||
#include <bstring.h>
|
#include <bstring.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Avoid macro definitions of bind from system headers, e.g. on
|
||||||
|
// Solaris 7 with _XOPEN_SOURCE. FIXME
|
||||||
|
static inline int
|
||||||
|
_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
|
||||||
|
{
|
||||||
|
return ::bind (fd, addr, addrlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef bind
|
||||||
|
#undef bind
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <gcj/cni.h>
|
#include <gcj/cni.h>
|
||||||
#include <java/io/IOException.h>
|
#include <java/io/IOException.h>
|
||||||
#include <java/io/FileDescriptor.h>
|
#include <java/io/FileDescriptor.h>
|
||||||
|
@ -210,7 +222,7 @@ java::net::PlainDatagramSocketImpl::bind (jint lport,
|
||||||
else
|
else
|
||||||
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::bind (fnum, ptr, len) == 0)
|
if (_Jv_bind (fnum, ptr, len) == 0)
|
||||||
{
|
{
|
||||||
socklen_t addrlen = sizeof(u);
|
socklen_t addrlen = sizeof(u);
|
||||||
if (lport != 0)
|
if (lport != 0)
|
||||||
|
|
|
@ -33,6 +33,28 @@ details. */
|
||||||
#include <bstring.h>
|
#include <bstring.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Avoid macro definitions of bind, connect from system headers, e.g. on
|
||||||
|
// Solaris 7 with _XOPEN_SOURCE. FIXME
|
||||||
|
static inline int
|
||||||
|
_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
|
||||||
|
{
|
||||||
|
return ::bind (fd, addr, addrlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef bind
|
||||||
|
#undef bind
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
_Jv_connect (int fd, struct sockaddr *addr, int addrlen)
|
||||||
|
{
|
||||||
|
return ::connect (fd, addr, addrlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef connect
|
||||||
|
#undef connect
|
||||||
|
#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>
|
||||||
|
@ -164,7 +186,7 @@ java::net::PlainSocketImpl::bind (java::net::InetAddress *host, jint lport)
|
||||||
// Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
|
// Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
|
||||||
::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
|
::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
|
||||||
|
|
||||||
if (::bind (fnum, ptr, len) == 0)
|
if (_Jv_bind (fnum, ptr, len) == 0)
|
||||||
{
|
{
|
||||||
address = host;
|
address = host;
|
||||||
socklen_t addrlen = sizeof(u);
|
socklen_t addrlen = sizeof(u);
|
||||||
|
@ -209,7 +231,7 @@ java::net::PlainSocketImpl::connect (java::net::InetAddress *host, jint rport)
|
||||||
else
|
else
|
||||||
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::connect (fnum, ptr, len) != 0)
|
if (_Jv_connect (fnum, ptr, len) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
address = host;
|
address = host;
|
||||||
port = rport;
|
port = rport;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue