From 4e3d171da0dd1ced9df9a37db3757e0fc0e543bd Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 8 Jul 2005 04:56:03 +0000 Subject: [PATCH] 1898. [port] sunos: non blocking i/o support. [RT #14951] --- CHANGES | 2 ++ config.h.in | 10 +++++++++- configure | 35 +++++++++++++++++++++++++++++++++-- configure.in | 18 +++++++++++++++++- lib/bind/configure | 14 +++++++++++--- lib/bind/configure.in | 11 +++++++++-- lib/bind/isc/ev_connects.c | 8 ++++---- lib/bind/isc/ev_files.c | 4 ++-- lib/bind/port_after.h.in | 4 +--- lib/isc/unix/entropy.c | 19 ++++++++++++++----- lib/isc/unix/socket.c | 17 +++++++++++++---- 11 files changed, 115 insertions(+), 27 deletions(-) diff --git a/CHANGES b/CHANGES index b66d8ec186..8e6dbcb0ac 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1898. [port] sunos: non blocking i/o support. [RT #14951] + 1896. [bug] The cache could delete expired records too fast for clients with a virtual time in the past. [RT #14991] diff --git a/config.h.in b/config.h.in index 0166414d17..7f50dd3366 100644 --- a/config.h.in +++ b/config.h.in @@ -16,7 +16,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.h.in,v 1.47.2.3.2.15 2005/06/08 02:11:21 marka Exp $ */ +/* $Id: config.h.in,v 1.47.2.3.2.16 2005/07/08 04:55:58 marka Exp $ */ /*** *** This file is not to be included by any public header files, because @@ -242,12 +242,20 @@ int sigwait(const unsigned int *set, int *sig); /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Sets which flag to pass to open/fcntl to make non-blocking + (O_NDELAY/O_NONBLOCK). */ +#undef PORT_NONBLOCK + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME +/* Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make + non-blocking. */ +#undef USE_FIONBIO_IOCTL + /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN diff --git a/configure b/configure index f1a6a0cf0a..0be9acf6d3 100755 --- a/configure +++ b/configure @@ -14,7 +14,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. # -# $Id: configure,v 1.284.2.19.2.40 2005/06/08 02:11:21 marka Exp $ +# $Id: configure,v 1.284.2.19.2.41 2005/07/08 04:55:58 marka Exp $ # # Portions Copyright (C) 1996-2001 Nominum, Inc. # @@ -29,7 +29,7 @@ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# From configure.in Revision: 1.294.2.23.2.44 . +# From configure.in Revision: 1.294.2.23.2.45 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # @@ -27262,6 +27262,37 @@ yes) esac +# +# The following sets up how non-blocking i/o is established. +# Sunos, cygwin and solaris 2.x (x<5) require special handling. +# +case "$host" in +*-sunos*) cat >>confdefs.h <<\_ACEOF +#define PORT_NONBLOCK O_NDELAY +_ACEOF +;; +*-cygwin*) cat >>confdefs.h <<\_ACEOF +#define PORT_NONBLOCK O_NDELAY +_ACEOF +;; +*-solaris2.[01234]*) + cat >>confdefs.h <<\_ACEOF +#define PORT_NONBLOCK O_NONBLOCK +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define USE_FIONBIO_IOCTL 1 +_ACEOF + + ;; +*) +cat >>confdefs.h <<\_ACEOF +#define PORT_NONBLOCK O_NONBLOCK +_ACEOF + + ;; +esac # # The following sections deal with tools used for formatting # the documentation. They are all optional, unless you are diff --git a/configure.in b/configure.in index 58abb31e75..0a2e89a4cc 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.294.2.23.2.44 $) +AC_REVISION($Revision: 1.294.2.23.2.45 $) AC_INIT(lib/dns/name.c) AC_PREREQ(2.13) @@ -1827,6 +1827,22 @@ yes) esac AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX) +# +# The following sets up how non-blocking i/o is established. +# Sunos, cygwin and solaris 2.x (x<5) require special handling. +# +case "$host" in +*-sunos*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);; +*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);; +*-solaris2.[[01234]]*) + AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK) + AC_DEFINE(USE_FIONBIO_IOCTL, 1, + [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.]) + ;; +*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK, + [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).]) + ;; +esac # # The following sections deal with tools used for formatting # the documentation. They are all optional, unless you are diff --git a/lib/bind/configure b/lib/bind/configure index f1de6f7a84..a65c295d79 100644 --- a/lib/bind/configure +++ b/lib/bind/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.83.2.5.2.13 . +# From configure.in Revision: 1.83.2.5.2.15 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # @@ -464,7 +464,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_PLATFORM_NEEDSYSSELECTH WANT_IRS_GR WANT_IRS_GR_OBJS WANT_IRS_PW WANT_IRS_PW_OBJS WANT_IRS_NIS WANT_IRS_NIS_OBJS WANT_IRS_NISGR_OBJS WANT_IRS_NISPW_OBJS WANT_IRS_DBPW_OBJS ALWAYS_DEFINES DO_PTHREADS WANT_IRS_THREADSGR_OBJS WANT_IRS_THREADSPW_OBJS WANT_IRS_THREADS_OBJS WANT_THREADS_OBJS USE_IFNAMELINKID ISC_THREAD_DIR DAEMON_OBJS NEED_DAEMON STRSEP_OBJS NEED_STRSEP NEED_STRERROR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY LN_S ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK HAS_INET6_STRUCTS ISC_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H HAS_IN_ADDR6 NEED_IN6ADDR_ANY ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C HAVE_SIN6_SCOPE_ID HAVE_SOCKADDR_STORAGE ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON HAVE_SA_LEN HAVE_MINIMUM_IFREQ BSD_COMP SOLARIS_BITTYPES USE_FIONBIO_IOCTL PORT_DIR PORT_INCLUDE ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO NEED_PSELECT NEED_GETTIMEOFDAY HAVE_STRNDUP ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS USE_SYSERROR_LIST ISC_PLATFORM_QUADFORMAT ISC_SOCKLEN_T GETGROUPLIST_ARGS NET_R_ARGS NET_R_BAD NET_R_COPY NET_R_COPY_ARGS NET_R_OK NET_R_SETANSWER NET_R_RETURN GETNETBYADDR_ADDR_T NETENT_DATA NET_R_ENT_ARGS NET_R_SET_RESULT NET_R_SET_RETURN NET_R_END_RESULT NET_R_END_RETURN GROUP_R_ARGS GROUP_R_BAD GROUP_R_OK GROUP_R_RETURN GROUP_R_END_RESULT GROUP_R_END_RETURN GROUP_R_ENT_ARGS GROUP_R_SET_RESULT GROUP_R_SET_RETURN HOST_R_ARGS HOST_R_BAD HOST_R_COPY HOST_R_COPY_ARGS HOST_R_ERRNO HOST_R_OK HOST_R_RETURN HOST_R_SETANSWER HOSTENT_DATA HOST_R_END_RESULT HOST_R_END_RETURN HOST_R_ENT_ARGS HOST_R_SET_RESULT HOST_R_SET_RETURN SETPWENT_VOID SETGRENT_VOID NGR_R_ARGS NGR_R_BAD NGR_R_COPY NGR_R_COPY_ARGS NGR_R_OK NGR_R_RETURN NGR_R_PRIVATE NGR_R_END_RESULT NGR_R_END_RETURN NGR_R_ENT_ARGS NGR_R_SET_RESULT NGR_R_SET_RETURN PROTO_R_ARGS PROTO_R_BAD PROTO_R_COPY PROTO_R_COPY_ARGS PROTO_R_OK PROTO_R_SETANSWER PROTO_R_RETURN PROTO_R_END_RESULT PROTO_R_END_RETURN PROTO_R_ENT_ARGS PROTO_R_SET_RESULT PROTO_R_SET_RETURN PASS_R_ARGS PASS_R_BAD PASS_R_COPY PASS_R_COPY_ARGS PASS_R_OK PASS_R_RETURN PASS_R_END_RESULT PASS_R_END_RETURN PASS_R_ENT_ARGS PASS_R_SET_RESULT PASS_R_SET_RETURN SERV_R_ARGS SERV_R_BAD SERV_R_COPY SERV_R_COPY_ARGS SERV_R_OK SERV_R_SETANSWER SERV_R_RETURN SERV_R_END_RESULT SERV_R_END_RETURN SERV_R_ENT_ARGS SERV_R_SET_RESULT SERV_R_SET_RETURN SETNETGRENT_ARGS INNETGR_ARGS BIND9_TOP_BUILDDIR BIND9_VERSION LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA STD_CINCLUDES STD_CDEFINES STD_CWARNINGS CCOPT AR ARFLAGS LN ETAGS PERL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP ISC_PLATFORM_NEEDSYSSELECTH WANT_IRS_GR WANT_IRS_GR_OBJS WANT_IRS_PW WANT_IRS_PW_OBJS WANT_IRS_NIS WANT_IRS_NIS_OBJS WANT_IRS_NISGR_OBJS WANT_IRS_NISPW_OBJS WANT_IRS_DBPW_OBJS ALWAYS_DEFINES DO_PTHREADS WANT_IRS_THREADSGR_OBJS WANT_IRS_THREADSPW_OBJS WANT_IRS_THREADS_OBJS WANT_THREADS_OBJS USE_IFNAMELINKID ISC_THREAD_DIR DAEMON_OBJS NEED_DAEMON STRSEP_OBJS NEED_STRSEP NEED_STRERROR MKDEPCC MKDEPCFLAGS MKDEPPROG IRIX_DNSSEC_WARNINGS_HACK purify_path PURIFY LN_S ECHO ac_ct_AR STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL O A SA LIBTOOL_MKDEP_SED LIBTOOL_MODE_COMPILE LIBTOOL_MODE_INSTALL LIBTOOL_MODE_LINK HAS_INET6_STRUCTS ISC_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINET6IN6H HAS_IN_ADDR6 NEED_IN6ADDR_ANY ISC_PLATFORM_HAVEIN6PKTINFO ISC_PLATFORM_FIXIN6ISADDR ISC_IPV6_H ISC_IPV6_O ISC_ISCIPV6_O ISC_IPV6_C HAVE_SIN6_SCOPE_ID HAVE_SOCKADDR_STORAGE ISC_PLATFORM_NEEDNTOP ISC_PLATFORM_NEEDPTON ISC_PLATFORM_NEEDATON HAVE_SA_LEN HAVE_MINIMUM_IFREQ BSD_COMP SOLARIS_BITTYPES USE_FIONBIO_IOCTL PORT_NONBLOCK PORT_DIR PORT_INCLUDE ISC_PLATFORM_MSGHDRFLAVOR ISC_PLATFORM_NEEDPORTT ISC_LWRES_ENDHOSTENTINT ISC_LWRES_SETNETENTINT ISC_LWRES_ENDNETENTINT ISC_LWRES_GETHOSTBYADDRVOID ISC_LWRES_NEEDHERRNO ISC_LWRES_GETIPNODEPROTO ISC_LWRES_GETADDRINFOPROTO ISC_LWRES_GETNAMEINFOPROTO NEED_PSELECT NEED_GETTIMEOFDAY HAVE_STRNDUP ISC_PLATFORM_NEEDSTRSEP ISC_PLATFORM_NEEDVSNPRINTF ISC_EXTRA_OBJS ISC_EXTRA_SRCS USE_SYSERROR_LIST ISC_PLATFORM_QUADFORMAT ISC_SOCKLEN_T GETGROUPLIST_ARGS NET_R_ARGS NET_R_BAD NET_R_COPY NET_R_COPY_ARGS NET_R_OK NET_R_SETANSWER NET_R_RETURN GETNETBYADDR_ADDR_T NETENT_DATA NET_R_ENT_ARGS NET_R_SET_RESULT NET_R_SET_RETURN NET_R_END_RESULT NET_R_END_RETURN GROUP_R_ARGS GROUP_R_BAD GROUP_R_OK GROUP_R_RETURN GROUP_R_END_RESULT GROUP_R_END_RETURN GROUP_R_ENT_ARGS GROUP_R_SET_RESULT GROUP_R_SET_RETURN HOST_R_ARGS HOST_R_BAD HOST_R_COPY HOST_R_COPY_ARGS HOST_R_ERRNO HOST_R_OK HOST_R_RETURN HOST_R_SETANSWER HOSTENT_DATA HOST_R_END_RESULT HOST_R_END_RETURN HOST_R_ENT_ARGS HOST_R_SET_RESULT HOST_R_SET_RETURN SETPWENT_VOID SETGRENT_VOID NGR_R_ARGS NGR_R_BAD NGR_R_COPY NGR_R_COPY_ARGS NGR_R_OK NGR_R_RETURN NGR_R_PRIVATE NGR_R_END_RESULT NGR_R_END_RETURN NGR_R_ENT_ARGS NGR_R_SET_RESULT NGR_R_SET_RETURN PROTO_R_ARGS PROTO_R_BAD PROTO_R_COPY PROTO_R_COPY_ARGS PROTO_R_OK PROTO_R_SETANSWER PROTO_R_RETURN PROTO_R_END_RESULT PROTO_R_END_RETURN PROTO_R_ENT_ARGS PROTO_R_SET_RESULT PROTO_R_SET_RETURN PASS_R_ARGS PASS_R_BAD PASS_R_COPY PASS_R_COPY_ARGS PASS_R_OK PASS_R_RETURN PASS_R_END_RESULT PASS_R_END_RETURN PASS_R_ENT_ARGS PASS_R_SET_RESULT PASS_R_SET_RETURN SERV_R_ARGS SERV_R_BAD SERV_R_COPY SERV_R_COPY_ARGS SERV_R_OK SERV_R_SETANSWER SERV_R_RETURN SERV_R_END_RESULT SERV_R_END_RETURN SERV_R_ENT_ARGS SERV_R_SET_RESULT SERV_R_SET_RETURN SETNETGRENT_ARGS INNETGR_ARGS BIND9_TOP_BUILDDIR BIND9_VERSION LIBOBJS LTLIBOBJS' ac_subst_files='BIND9_INCLUDES BIND9_MAKE_RULES LIBBIND_API' # Initialize some variables set by options. @@ -23084,6 +23084,7 @@ PORT_DIR=port/unknown SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES" BSD_COMP="#undef BSD_COMP" USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL" +PORT_NONBLOCK="#define PORT_NONBLOCK O_NONBLOCK" case "$host" in *aix3.2*) PORT_DIR="port/aix32";; *aix4*) PORT_DIR="port/aix4";; @@ -23091,7 +23092,9 @@ case "$host" in *aux3*) PORT_DIR="port/aux3";; *-bsdi2*) PORT_DIR="port/bsdos2";; *-bsdi*) PORT_DIR="port/bsdos";; - *-cygwin*) PORT_DIR="port/cygwin";; + *-cygwin*) + PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY" + PORT_DIR="port/cygwin";; *-darwin*) PORT_DIR="port/darwin";; *-osf*) PORT_DIR="port/decunix";; *-freebsd*) PORT_DIR="port/freebsd";; @@ -23107,6 +23110,9 @@ case "$host" in *-openbsd*) PORT_DIR="port/openbsd";; *-qnx*) PORT_DIR="port/qnx";; *-rhapsody*) PORT_DIR="port/rhapsody";; + *-sunos4*) + PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY" + PORT_DIR="port/sunos";; *-solaris2.[01234]*) BSD_COMP="#define BSD_COMP 1" SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1" @@ -23127,6 +23133,7 @@ esac + PORT_INCLUDE=${PORT_DIR}/include @@ -31380,6 +31387,7 @@ s,@HAVE_MINIMUM_IFREQ@,$HAVE_MINIMUM_IFREQ,;t t s,@BSD_COMP@,$BSD_COMP,;t t s,@SOLARIS_BITTYPES@,$SOLARIS_BITTYPES,;t t s,@USE_FIONBIO_IOCTL@,$USE_FIONBIO_IOCTL,;t t +s,@PORT_NONBLOCK@,$PORT_NONBLOCK,;t t s,@PORT_DIR@,$PORT_DIR,;t t s,@PORT_INCLUDE@,$PORT_INCLUDE,;t t s,@ISC_PLATFORM_MSGHDRFLAVOR@,$ISC_PLATFORM_MSGHDRFLAVOR,;t t diff --git a/lib/bind/configure.in b/lib/bind/configure.in index 56450e4b0a..7611d04528 100644 --- a/lib/bind/configure.in +++ b/lib/bind/configure.in @@ -13,7 +13,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -AC_REVISION($Revision: 1.83.2.5.2.14 $) +AC_REVISION($Revision: 1.83.2.5.2.15 $) AC_INIT(resolv/herror.c) AC_PREREQ(2.13) @@ -996,6 +996,7 @@ PORT_DIR=port/unknown SOLARIS_BITTYPES="#undef NEED_SOLARIS_BITTYPES" BSD_COMP="#undef BSD_COMP" USE_FIONBIO_IOCTL="#undef USE_FIONBIO_IOCTL" +PORT_NONBLOCK="#define PORT_NONBLOCK O_NONBLOCK" case "$host" in *aix3.2*) PORT_DIR="port/aix32";; *aix4*) PORT_DIR="port/aix4";; @@ -1003,7 +1004,9 @@ case "$host" in *aux3*) PORT_DIR="port/aux3";; *-bsdi2*) PORT_DIR="port/bsdos2";; *-bsdi*) PORT_DIR="port/bsdos";; - *-cygwin*) PORT_DIR="port/cygwin";; + *-cygwin*) + PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY" + PORT_DIR="port/cygwin";; *-darwin*) PORT_DIR="port/darwin";; *-osf*) PORT_DIR="port/decunix";; *-freebsd*) PORT_DIR="port/freebsd";; @@ -1019,6 +1022,9 @@ case "$host" in *-openbsd*) PORT_DIR="port/openbsd";; *-qnx*) PORT_DIR="port/qnx";; *-rhapsody*) PORT_DIR="port/rhapsody";; + *-sunos4*) + PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY" + PORT_DIR="port/sunos";; *-solaris2.[[01234]]*) BSD_COMP="#define BSD_COMP 1" SOLARIS_BITTYPES="#define NEED_SOLARIS_BITTYPES 1" @@ -1038,6 +1044,7 @@ esac AC_SUBST(BSD_COMP) AC_SUBST(SOLARIS_BITTYPES) AC_SUBST(USE_FIONBIO_IOCTL) +AC_SUBST(PORT_NONBLOCK) AC_SUBST(PORT_DIR) PORT_INCLUDE=${PORT_DIR}/include AC_SUBST(PORT_INCLUDE) diff --git a/lib/bind/isc/ev_connects.c b/lib/bind/isc/ev_connects.c index 043e5f497c..4b0dd2222a 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.4.206.1 2004/03/09 08:33:40 marka Exp $"; +static const char rcsid[] = "$Id: ev_connects.c,v 1.4.206.2 2005/07/08 04:52:54 marka Exp $"; #endif /* Import. */ @@ -168,10 +168,10 @@ evCancelConn(evContext opaqueCtx, evConnID id) { return (-1); } else { #ifdef USE_FIONBIO_IOCTL - int on = 1; - OK(ioctl(this->fd, FIONBIO, (char *)&on)); + int off = 0; + OK(ioctl(this->fd, FIONBIO, (char *)&off)); #else - OK(fcntl(this->fd, F_SETFL, mode | PORT_NONBLOCK)); + OK(fcntl(this->fd, F_SETFL, mode & ~PORT_NONBLOCK)); #endif } } diff --git a/lib/bind/isc/ev_files.c b/lib/bind/isc/ev_files.c index 4d5eb55ad8..7a957bc2d6 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.3.2.1.4.1 2004/03/09 08:33:42 marka Exp $"; +static const char rcsid[] = "$Id: ev_files.c,v 1.3.2.1.4.2 2005/07/08 04:52:54 marka Exp $"; #endif #include "port_before.h" @@ -204,7 +204,7 @@ evDeselectFD(evContext opaqueCtx, evFileID opaqueID) { * and (b) the caller didn't ask us anything about O_NONBLOCK. */ #ifdef USE_FIONBIO_IOCTL - int off = 1; + int off = 0; (void) ioctl(del->fd, FIONBIO, (char *)&off); #else (void) fcntl(del->fd, F_SETFL, mode & ~PORT_NONBLOCK); diff --git a/lib/bind/port_after.h.in b/lib/bind/port_after.h.in index c043561b16..3a763ce22b 100644 --- a/lib/bind/port_after.h.in +++ b/lib/bind/port_after.h.in @@ -27,9 +27,7 @@ @INNETGR_ARGS@ @SETNETGRENT_ARGS@ @USE_IFNAMELINKID@ - -/* XXX sunos and cygwin needs O_NDELAY */ -#define PORT_NONBLOCK O_NONBLOCK +@PORT_NONBLOCK@ /* * We need to know the IPv6 address family number even on IPv4-only systems. diff --git a/lib/isc/unix/entropy.c b/lib/isc/unix/entropy.c index a2cbb3c6e9..e16f9081d1 100644 --- a/lib/isc/unix/entropy.c +++ b/lib/isc/unix/entropy.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: entropy.c,v 1.60.2.3.8.9 2004/03/16 05:02:31 marka Exp $ */ +/* $Id: entropy.c,v 1.60.2.3.8.10 2005/07/08 04:52:54 marka Exp $ */ /* * This is the system depenedent part of the ISC entropy API. @@ -446,16 +446,25 @@ make_nonblock(int fd) { int ret; int flags; char strbuf[ISC_STRERRORSIZE]; +#ifdef USE_FIONBIO_IOCTL + int on = 1; + ret = ioctl(fd, FIONBIO, (char *)&on); +#else flags = fcntl(fd, F_GETFL, 0); - flags |= O_NONBLOCK; + flags |= PORT_NONBLOCK; ret = fcntl(fd, F_SETFL, flags); +#endif if (ret == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "fcntl(%d, F_SETFL, %d): %s", - fd, flags, strbuf); +#ifdef USE_FIONBIO_IOCTL + "ioctl(%d, FIONBIO, &on): %s", fd, +#else + "fcntl(%d, F_SETFL, %d): %s", fd, flags, +#endif + strbuf); return (ISC_R_UNEXPECTED); } @@ -501,7 +510,7 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) { if (is_usocket) fd = socket(PF_UNIX, SOCK_STREAM, 0); else - fd = open(fname, O_RDONLY | O_NONBLOCK, 0); + fd = open(fname, O_RDONLY | PORT_NONBLOCK, 0); if (fd < 0) { ret = isc__errno2result(errno); diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 71bc19992b..77f0978569 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.207.2.19.2.19 2005/05/19 02:41:23 marka Exp $ */ +/* $Id: socket.c,v 1.207.2.19.2.20 2005/07/08 04:52:54 marka Exp $ */ #include @@ -429,16 +429,25 @@ make_nonblock(int fd) { int ret; int flags; char strbuf[ISC_STRERRORSIZE]; +#ifdef USE_FIONBIO_IOCTL + int on = 1; + ret = ioctl(fd, FIONBIO, (char *)&on); +#else flags = fcntl(fd, F_GETFL, 0); - flags |= O_NONBLOCK; + flags |= PORT_NONBLOCK; ret = fcntl(fd, F_SETFL, flags); +#endif if (ret == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, - "fcntl(%d, F_SETFL, %d): %s", - fd, flags, strbuf); +#ifdef USE_FIONBIO_IOCTL + "ioctl(%d, FIONBIO, &on): %s", fd, +#else + "fcntl(%d, F_SETFL, %d): %s", fd, flags, +#endif + strbuf); return (ISC_R_UNEXPECTED); }