]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.11-20130325
authorWietse Venema <wietse@porcupine.org>
Mon, 25 Mar 2013 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sat, 6 Apr 2013 03:31:41 +0000 (23:31 -0400)
postfix/HISTORY
postfix/makedefs
postfix/src/global/mail_version.h
postfix/src/util/read_wait.c
postfix/src/util/readable.c
postfix/src/util/sys_defs.h
postfix/src/util/writable.c
postfix/src/util/write_wait.c

index 0c17de0bf7ec5a6b7d6b0de11643d80eff4141ea..9194cb2b603b242b4274fcb64b36a28561b393a7 100644 (file)
@@ -18346,3 +18346,14 @@ Apologies for any names omitted.
        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.
index 71f5008d18eea343cfcb1fc884391f7726ca5b7d..169a054c6049c2b64a96387243adcac3df7182fb 100644 (file)
@@ -155,6 +155,8 @@ case "$SYSTEM.$RELEASE" in
                ;;
   FreeBSD.9*)  SYSTYPE=FREEBSD9
                ;;
+ DragonFly.*)  SYSTYPE=DRAGONFLY
+               ;;
   OpenBSD.2*)  SYSTYPE=OPENBSD2
                ;;
   OpenBSD.3*)  SYSTYPE=OPENBSD3
@@ -173,6 +175,10 @@ case "$SYSTEM.$RELEASE" in
                ;;
    NetBSD.4*)  SYSTYPE=NETBSD4
                ;;
+   NetBSD.5*)  SYSTYPE=NETBSD5
+               ;;
+   NetBSD.6*)  SYSTYPE=NETBSD6
+               ;;
    BSD/OS.2*)  SYSTYPE=BSDI2
                ;;
    BSD/OS.3*)  SYSTYPE=BSDI3
@@ -476,7 +482,7 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
                       *) 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
index 5409efba0910d0fa4615a1663652f0de1f371769..f519f386dcc33ea4fbaecbf38797938559153e39 100644 (file)
@@ -20,7 +20,7 @@
   * 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
index ff2102f98d3317fc51283fe151f57f24dfb1652f..096b38a51f95d3fb16786a88d593ac1d953a2e49 100644 (file)
@@ -15,8 +15,8 @@
 /*
 /*     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.
@@ -99,13 +103,17 @@ int     read_wait(int fd, int timeout)
                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.
@@ -132,5 +140,7 @@ int     read_wait(int fd, int timeout)
            return (0);
        }
     }
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
 #endif
 }
index 7d297403b03a363f998cb5d5bb350fcec8aac5b9..00756cc78c15b6d0b654cd98c7d66be241160b10 100644 (file)
@@ -14,7 +14,8 @@
 /*
 /*     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.
@@ -85,12 +90,16 @@ int     readable(int fd)
                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.
@@ -115,5 +124,7 @@ int     readable(int fd)
            return (1);
        }
     }
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
 #endif
 }
index 00cbdc2e139f45e115389a2535e861da27db36a1..a32c351be4cbf64ab39e3e2e70ca47f92b5d1751 100644 (file)
@@ -30,8 +30,8 @@
     || 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
@@ -1368,8 +1380,8 @@ extern int inet_pton(int, const char *, void *);
 #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
 
  /*
index f37eb22296c4033542dffe2b6011d03f01b955f1..a388dcbda14110d5f2a69d92be2d5d2005472917 100644 (file)
@@ -14,7 +14,8 @@
 /*
 /*     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.
@@ -85,12 +90,16 @@ int     writable(int fd)
                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.
@@ -115,5 +124,7 @@ int     writable(int fd)
            return (1);
        }
     }
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
 #endif
 }
index 1a42c126ef7d0428e28fedee8245f69386f6ae6e..cf6dde15bb19ff1760b81a81149d9d92ef62dac6 100644 (file)
@@ -15,7 +15,8 @@
 /*
 /*     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
@@ -98,13 +103,17 @@ int     write_wait(int fd, int timeout)
                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.
@@ -131,5 +140,7 @@ int     write_wait(int fd, int timeout)
            return (0);
        }
     }
+#else
+#error "define USE_SYSV_POLL or NO_SYSV_POLL"
 #endif
 }