and TLS policies. Viktor Dukhovni. Files: src/dns/Makefile.in,
src/dns/dns.h, src/dns/dns_lookup.c, src/dns/dns_rr.c,
src/dns/dns_strtype.c, src/dns/test_dns_lookup.c.
+
+20130325
+
+ Portability: on MacOS X, use kqueue() for event handling
+ but use select() instead of poll() for read/write timeouts
+ (with a workaround to handle file decriptors >=FD_SETSIZE).
+ Files: util/sys_defs.h, util/readable.c, util/writable.c,
+ util/read_wait.c, util/write_wait.c.
+
+ Portability: support for NetBSD 5.x, NetBSD 6.x and DragonFly
+ BSD. Viktor Dukhovni. Files: makedefs, src/util/sys_defs.h.
;;
FreeBSD.9*) SYSTYPE=FREEBSD9
;;
+ DragonFly.*) SYSTYPE=DRAGONFLY
+ ;;
OpenBSD.2*) SYSTYPE=OPENBSD2
;;
OpenBSD.3*) SYSTYPE=OPENBSD3
;;
NetBSD.4*) SYSTYPE=NETBSD4
;;
+ NetBSD.5*) SYSTYPE=NETBSD5
+ ;;
+ NetBSD.6*) SYSTYPE=NETBSD6
+ ;;
BSD/OS.2*) SYSTYPE=BSDI2
;;
BSD/OS.3*) SYSTYPE=BSDI3
*) CCARGS="$CCARGS -DRESOLVE_H_NEEDS_ARPA_NAMESER_COMPAT_H";;
esac
# kqueue and/or poll are broken in MacOS X 10.5 (Darwin 9).
- # kqueue and poll work in Mac OS X 10.8 (Darwin 12).
+ # kqueue works in Mac OS X 10.8 (Darwin 12).
case $RELEASE in
?.*|1[0-1].*) CCARGS="$CCARGS -DNO_KQUEUE";;
esac
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20130324"
+#define MAIL_RELEASE_DATE "20130325"
#define MAIL_VERSION_NUMBER "2.11"
#ifdef SNAPSHOT
/*
/* Arguments:
/* .IP fd
-/* File descriptor in the range 0..FD_SETSIZE (on systems that
-/* need to use select(2)).
+/* File descriptor. With implementations based on select(),
+/* a best effort is made to handle descriptors >=FD_SETSIZE.
/* .IP timeout
/* If positive, deadline in seconds. A zero value effects a poll.
/* A negative value means wait until something happens.
int read_wait(int fd, int timeout)
{
-#ifndef USE_SYSV_POLL
+#if defined(NO_SYSV_POLL)
fd_set read_fds;
fd_set except_fds;
struct timeval tv;
struct timeval *tp;
+ int temp_fd = -1;
/*
* Sanity checks.
*/
- if (FD_SETSIZE <= fd)
- msg_panic("descriptor %d does not fit FD_SETSIZE %d", fd, FD_SETSIZE);
+ if (FD_SETSIZE <= fd) {
+ if ((temp_fd = dup(fd)) < 0 || temp_fd >= FD_SETSIZE)
+ msg_fatal("descriptor %d does not fit FD_SETSIZE %d", fd, FD_SETSIZE);
+ fd = temp_fd;
+ }
/*
* Use select() so we do not depend on alarm() and on signal() handlers.
msg_fatal("select: %m");
continue;
case 0:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
errno = ETIMEDOUT;
return (-1);
default:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
return (0);
}
}
-#else
+#elif defined(USE_SYSV_POLL)
/*
* System-V poll() is optimal for polling a few descriptors.
return (0);
}
}
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
#endif
}
/*
/* Arguments:
/* .IP fd
-/* File descriptor in the range 0..FD_SETSIZE.
+/* File descriptor. With implementations based on select(),
+/* a best effort is made to handle descriptors >=FD_SETSIZE.
/* DIAGNOSTICS
/* All system call errors are fatal.
/* LICENSE
int readable(int fd)
{
-#ifndef USE_SYSV_POLL
+#if defined(NO_SYSV_POLL)
struct timeval tv;
fd_set read_fds;
fd_set except_fds;
+ int temp_fd = -1;
/*
* Sanity checks.
*/
- if (fd >= FD_SETSIZE)
- msg_fatal("fd %d does not fit in FD_SETSIZE", fd);
+ if (fd >= FD_SETSIZE) {
+ if ((temp_fd = dup(fd)) < 0 || temp_fd >= FD_SETSIZE)
+ msg_fatal("fd %d does not fit in FD_SETSIZE", fd);
+ fd = temp_fd;
+ }
/*
* Initialize.
msg_fatal("select: %m");
continue;
default:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
return (FD_ISSET(fd, &read_fds));
case 0:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
return (0);
}
}
-#else
+#elif defined(USE_SYSV_POLL)
/*
* System-V poll() is optimal for polling a few descriptors.
return (1);
}
}
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
#endif
}
|| defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
|| defined(OPENBSD5) \
|| defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
- || defined(NETBSD4) \
- || defined(EKKOBSD1)
+ || defined(NETBSD4) || defined(NETBSD5) || defined(NETBSD6) \
+ || defined(EKKOBSD1) || defined(DRAGONFLY)
#define SUPPORTED
#include <sys/types.h>
#include <sys/param.h>
#define HAS_FUTIMES
#endif
+#if defined(__DragonFly__)
+#define HAS_DEV_URANDOM
+#define HAS_ISSETUGID
+#define HAS_FUTIMES
+#define SOCKADDR_SIZE socklen_t
+#define SOCKOPT_SIZE socklen_t
+#define HAS_DUPLEX_PIPE
+#endif
+
#if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) \
|| (defined(__FreeBSD__) && __FreeBSD__ >= 4) \
|| (defined(OpenBSD) && OpenBSD >= 200003) \
+ || defined(__DragonFly__) \
|| defined(USAGI_LIBINET6)
#ifndef NO_IPV6
# define HAS_IPV6
#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300000) \
|| (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 103000000) \
- || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */
+ || (defined(OpenBSD) && OpenBSD >= 199700) /* OpenBSD 2.0?? */ \
+ || defined(__DragonFly__)
# define USE_SYSV_POLL
#endif
#ifndef NO_KQUEUE
# if (defined(__FreeBSD_version) && __FreeBSD_version >= 410000) \
|| (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000) \
- || (defined(OpenBSD) && OpenBSD >= 200105) /* OpenBSD 2.9 */
+ || (defined(OpenBSD) && OpenBSD >= 200105) /* OpenBSD 2.9 */ \
+ || defined(__DragonFly__)
# define EVENTS_STYLE EVENTS_STYLE_KQUEUE
# endif
#endif
#define SOCKOPT_SIZE socklen_t
#ifndef NO_KQUEUE
# define EVENTS_STYLE EVENTS_STYLE_KQUEUE
-# define USE_SYSV_POLL
+# define NO_SYSV_POLL
#endif
#ifndef NO_POSIX_GETPW_R
# define HAVE_POSIX_GETPW_R
#define EVENTS_STYLE_DEVPOLL 3 /* Solaris /dev/poll */
#define EVENTS_STYLE_EPOLL 4 /* Linux epoll */
-#if !defined(USE_SYSV_POLL) && (EVENTS_STYLE != EVENTS_STYLE_SELECT)
-#error "need USE_SYSV_POLL with EVENTS_STYLE != EVENTS_STYLE_SELECT"
+#if !defined(USE_SYSV_POLL) && !defined(NO_SYSV_POLL) && (EVENTS_STYLE != EVENTS_STYLE_SELECT)
+#error "need USE_SYSV_POLL or NO_SYSV_POLL with EVENTS_STYLE != EVENTS_STYLE_SELECT"
#endif
/*
/*
/* Arguments:
/* .IP fd
-/* File descriptor in the range 0..FD_SETSIZE.
+/* File descriptor. With implementations based on select(),
+/* a best effort is made to handle descriptors >=FD_SETSIZE.
/* DIAGNOSTICS
/* All system call errors are fatal.
/* LICENSE
int writable(int fd)
{
-#ifndef USE_SYSV_POLL
+#if defined(NO_SYSV_POLL)
struct timeval tv;
fd_set write_fds;
fd_set except_fds;
+ int temp_fd = -1;
/*
* Sanity checks.
*/
- if (fd >= FD_SETSIZE)
- msg_fatal("fd %d does not fit in FD_SETSIZE", fd);
+ if (fd >= FD_SETSIZE) {
+ if ((temp_fd = dup(fd)) < 0 || temp_fd >= FD_SETSIZE)
+ msg_fatal("fd %d does not fit in FD_SETSIZE", fd);
+ fd = temp_fd;
+ }
/*
* Initialize.
msg_fatal("select: %m");
continue;
default:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
return (FD_ISSET(fd, &write_fds));
case 0:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
return (0);
}
}
-#else
+#elif defined(USE_SYSV_POLL)
/*
* System-V poll() is optimal for polling a few descriptors.
return (1);
}
}
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
#endif
}
/*
/* Arguments:
/* .IP fd
-/* File descriptor in the range 0..FD_SETSIZE.
+/* File descriptor. With implementations based on select(),
+/* a best effort is made to handle descriptors >=FD_SETSIZE.
/* .IP timeout
/* If positive, deadline in seconds. A zero value effects a poll.
/* A negative value means wait until something happens.
int write_wait(int fd, int timeout)
{
-#ifndef USE_SYSV_POLL
+#if defined(NO_SYSV_POLL)
fd_set write_fds;
fd_set except_fds;
struct timeval tv;
struct timeval *tp;
+ int temp_fd = -1;
/*
* Sanity checks.
*/
- if (FD_SETSIZE <= fd)
- msg_panic("descriptor %d does not fit FD_SETSIZE %d", fd, FD_SETSIZE);
+ if (FD_SETSIZE <= fd) {
+ if ((temp_fd = dup(fd)) < 0 || temp_fd >= FD_SETSIZE)
+ msg_fatal("descriptor %d does not fit FD_SETSIZE %d", fd, FD_SETSIZE);
+ fd = temp_fd;
+ }
/*
* Guard the write() with select() so we do not depend on alarm() and on
msg_fatal("select: %m");
continue;
case 0:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
errno = ETIMEDOUT;
return (-1);
default:
+ if (temp_fd != -1)
+ (void) close(temp_fd);
return (0);
}
}
-#else
+#elif defined(USE_SYSV_POLL)
/*
* System-V poll() is optimal for polling a few descriptors.
return (0);
}
}
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
#endif
}