From 9e80f632c86dc8c087992cdc5866a8fdeb4e446b Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 2 Jul 2001 02:02:27 +0000 Subject: [PATCH] pullup BIND 8: Solaris 2.4 (and earlier) USE_FIONBIO_IOCTL support. --- lib/bind/configure.in | 13 ++++++++++--- lib/bind/isc/ev_connects.c | 16 ++++++++++++++-- lib/bind/isc/ev_files.c | 13 ++++++++++++- lib/bind/port_after.h.in | 1 + 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/lib/bind/configure.in b/lib/bind/configure.in index 6f397199ac..496c243dae 100644 --- a/lib/bind/configure.in +++ b/lib/bind/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.59 $) +AC_REVISION($Revision: 1.60 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -1079,6 +1079,7 @@ AC_SUBST(HAVE_MINIMUM_IFREQ) PORT_INCLUDE= SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES" BSD_COMP="#undef BSD_COMP" +USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL" case "$host" in *aix3.2*) PORT_INCLUDE="port/aix32/include";; *aix4*) PORT_INCLUDE="port/aix4/include";; @@ -1101,9 +1102,14 @@ case "$host" in *-openbsd*) PORT_INCLUDE="port/openbsd/include";; *-qnx*) PORT_INCLUDE="port/qnx/include";; *-rhapsody*) PORT_INCLUDE="port/rhapsody/include";; - *-solaris2.[[012345]]*) + *-solaris2.[[01234]]*) BSD_COMP="#define BSD_COMP 1" - SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1"; + SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1" + USE_FIONBIO_IOCTL="#define USE_FIONBIO_IOCTL 1" + PORT_INCLUDE="port/solaris/include";; + *-solaris2.5*) + BSD_COMP="#define BSD_COMP 1" + SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1" PORT_INCLUDE="port/solaris/include";; *-solaris2*) BSD_COMP="#define BSD_COMP 1" PORT_INCLUDE="port/solaris/include";; @@ -1111,6 +1117,7 @@ case "$host" in esac AC_SUBST(BSD_COMP) AC_SUBST(SOLARIS_BITTYPES) +AC_SUBST(USE_FIONBIO_IOCTL) AC_SUBST(PORT_INCLUDE) diff --git a/lib/bind/isc/ev_connects.c b/lib/bind/isc/ev_connects.c index dbb417ed5b..ab563b2166 100644 --- a/lib/bind/isc/ev_connects.c +++ b/lib/bind/isc/ev_connects.c @@ -20,7 +20,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: ev_connects.c,v 1.1 2001/03/29 06:31:53 marka Exp $"; +static const char rcsid[] = "$Id: ev_connects.c,v 1.2 2001/07/02 02:02:26 marka Exp $"; #endif /* Import. */ @@ -30,6 +30,7 @@ static const char rcsid[] = "$Id: ev_connects.c,v 1.1 2001/03/29 06:31:53 marka #include #include +#include #include @@ -77,7 +78,12 @@ evListen(evContext opaqueCtx, int fd, int maxconn, * incorrectly. */ if ((mode & PORT_NONBLOCK) == 0) { +#ifdef USE_FIONBIO_IOCTL + int on = 1; + OK(ioctl(fd, FIONBIO, (char *)&on)); +#else OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK)); +#endif new->flags |= EV_CONN_BLOCK; } OK(listen(fd, maxconn)); @@ -160,8 +166,14 @@ evCancelConn(evContext opaqueCtx, evConnID id) { if (mode == -1) { if (errno != EBADF) return (-1); - } else + } else { +#ifdef USE_FIONBIO_IOCTL + int on = 1; + OK(ioctl(this->fd, FIONBIO, (char *)&on)); +#else OK(fcntl(this->fd, F_SETFL, mode | PORT_NONBLOCK)); +#endif + } } /* Unlink from ctx->conns. */ diff --git a/lib/bind/isc/ev_files.c b/lib/bind/isc/ev_files.c index 26f9205f2e..5280264970 100644 --- a/lib/bind/isc/ev_files.c +++ b/lib/bind/isc/ev_files.c @@ -20,7 +20,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: ev_files.c,v 1.2 2001/06/27 03:55:45 marka Exp $"; +static const char rcsid[] = "$Id: ev_files.c,v 1.3 2001/07/02 02:02:27 marka Exp $"; #endif #include "port_before.h" @@ -28,6 +28,7 @@ static const char rcsid[] = "$Id: ev_files.c,v 1.2 2001/06/27 03:55:45 marka Exp #include #include +#include #include #include @@ -72,7 +73,12 @@ evSelectFD(evContext opaqueCtx, if (mode & PORT_NONBLOCK) FD_SET(fd, &ctx->nonblockBefore); else { +#ifdef USE_FIONBIO_IOCTL + int on = 1; + OK(ioctl(fd, FIONBIO, (char *)&on)); +#else OK(fcntl(fd, F_SETFL, mode | PORT_NONBLOCK)); +#endif FD_CLR(fd, &ctx->nonblockBefore); } } @@ -197,7 +203,12 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) { * this fcntl() fails since (a) we've already done the work * and (b) the caller didn't ask us anything about O_NONBLOCK. */ +#ifdef USE_FIONBIO_IOCTL + int off = 1; + (void) ioctl(del->fd, FIONBIO, (char *)&off); +#else (void) fcntl(del->fd, F_SETFL, mode & ~PORT_NONBLOCK); +#endif } /* diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in index ace2683004..f238bba8f4 100644 --- a/lib/bind/port_after.h.in +++ b/lib/bind/port_after.h.in @@ -22,6 +22,7 @@ @HAVE_SOCKADDR_STORAGE@ @NEED_GETTIMEOFDAY@ @HAVE_STRNDUP@ +@USE_FIONBIO_IOCTL@ /* XXX sunos and cygwin needs O_NDELAY */ #define PORT_NONBLOCK O_NONBLOCK