]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1898. [port] sunos: non blocking i/o support. [RT #14951]
authorMark Andrews <marka@isc.org>
Fri, 8 Jul 2005 04:30:22 +0000 (04:30 +0000)
committerMark Andrews <marka@isc.org>
Fri, 8 Jul 2005 04:30:22 +0000 (04:30 +0000)
CHANGES
configure.in
lib/bind/configure.in
lib/bind/isc/ev_connects.c
lib/bind/isc/ev_files.c
lib/bind/port_after.h.in
lib/isc/unix/entropy.c
lib/isc/unix/socket.c

diff --git a/CHANGES b/CHANGES
index 58dcf3bc9d65e95f92a8846d60ef92f82d3bb19e..62c53b5cd8418280e3cd5af0785a2b3f2778c35d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+1898.  [port]          sunos: non blocking i/o support. [RT #14951]
+
 1897.  [func]          Support for IPSECKEY rdata type. [RT #14967]
 
 1896.  [bug]           The cache could delete expired records too fast for
index 7044194321d404a34704c45dff7aa420b383b511..177e3d6f4086d2c0ff1bc504dc7ff48c123ea823 100644 (file)
@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
 esyscmd([sed "s/^/# /" COPYRIGHT])dnl
 AC_DIVERT_POP()dnl
 
-AC_REVISION($Revision: 1.381 $)
+AC_REVISION($Revision: 1.382 $)
 
 AC_INIT(lib/dns/name.c)
 AC_PREREQ(2.13)
@@ -1960,6 +1960,22 @@ AC_SUBST(ISC_PLATFORM_USESTDASM)
 ISC_ARCH_DIR=$arch
 AC_SUBST(ISC_ARCH_DIR)
 
+#
+#  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
index 493910b4753c793a430324448538987d7b7df96b..8899fbd63e9b7d07b77efe28f04ea1c1e522eb13 100644 (file)
@@ -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.103 $)
+AC_REVISION($Revision: 1.104 $)
 
 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)
index 6baf22a2dc821d7e29d9bfdd966f86967526876b..013dd5cb848394aeb41cfa809bd131c777d92fcb 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_connects.c,v 1.6 2005/04/27 04:56:35 sra Exp $";
+static const char rcsid[] = "$Id: ev_connects.c,v 1.7 2005/07/08 04:30:21 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
                }
        }
index bb36cccb5b5714ce570875ec46a435250267e00c..9db59a90dfd9aa6b416bd7e74df28d735d2fc2f3 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_files.c,v 1.6 2005/04/27 04:56:35 sra Exp $";
+static const char rcsid[] = "$Id: ev_files.c,v 1.7 2005/07/08 04:30:21 marka Exp $";
 #endif
 
 #include "port_before.h"
@@ -203,7 +203,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);
index a6608450ee3a4828a45d4fbee813efb66a0e92ad..2622061bf855197cafa4c9f8578a788214ba8532 100644 (file)
@@ -27,9 +27,7 @@
 @INNETGR_ARGS@
 @SETNETGRENT_ARGS@
 @USE_IFNAMELINKID@
-
-/* XXX sunos and cygwin needs O_NDELAY */
-#define PORT_NONBLOCK O_NONBLOCK
+@PORT_NONBLOCK@
 
 /*! \brief
  * We need to know the IPv6 address family number even on IPv4-only systems.
index b4a5a950f1614cfa1f09f7abb461c1391b90a3b4..c63d5fd0ff02f3fe4556c7309ed41da6ff8c6da8 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: entropy.c,v 1.73 2005/04/29 00:23:49 marka Exp $ */
+/* $Id: entropy.c,v 1.74 2005/07/08 04:30:22 marka Exp $ */
 
 /* \file unix/entropy.c
  * \brief
@@ -447,16 +447,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);
        }
@@ -502,7 +511,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);
index e8bee8c046cd13919d907fa1fcee469fe0058e10..26e34b9cd5b8165431d27d6924aeef467fc25409 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: socket.c,v 1.250 2005/05/19 02:42:42 marka Exp $ */
+/* $Id: socket.c,v 1.251 2005/07/08 04:30:22 marka Exp $ */
 
 /*! \file */
 
@@ -435,16 +435,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);
        }