Commit b2f160f2 authored by Mark Andrews's avatar Mark Andrews

1898. [port] sunos: non blocking i/o support. [RT #14951]

parent 0bb7c66e
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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
}
}
......
......@@ -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);
......
......@@ -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.
......
......@@ -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);
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment