Remove configure probe for sys/uio.h.
authorThomas Munro <tmunro@postgresql.org>
Sat, 13 Aug 2022 11:24:42 +0000 (23:24 +1200)
committerThomas Munro <tmunro@postgresql.org>
Sat, 13 Aug 2022 12:07:17 +0000 (00:07 +1200)
<sys/uio.h> is in SUSv2, and all targeted Unix system have it, so we
might as well drop the probe (in fact we never really needed this one).
It's where struct iovec is defined, and as a common extension, it's also
where non-standard preadv() and pwritev() are declared on systems that
have them.

We should also be able to assume that IOV_MAX is defined on Unix.

To spell out what our pg_iovec.h header does for the OSes in the build
farm as of today:

  Windows: our own struct and functions
  Solaris, Cygwin: <sys/uio.h>'s struct, our own functions
  Every other Unix: <sys/uio.h>'s struct and functions

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com

configure
configure.ac
src/include/pg_config.h.in
src/include/port/pg_iovec.h
src/tools/msvc/Solution.pm

index cf2c4b85fe2ad2a8bc5f78db05bee07e939c533e..ef5334a12d43796ea17957bb03ddb85b844dead0 100755 (executable)
--- a/configure
+++ b/configure
@@ -13874,7 +13874,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
 fi
 
 
-for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h net/if.h netinet/tcp.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/ucred.h sys/uio.h sys/un.h termios.h ucred.h
+for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h net/if.h netinet/tcp.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/ucred.h sys/un.h termios.h ucred.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
index b5798bcb0a11e94ce9682b2e937687f7be54f687..c1b75e0f344b72bcff8669baa4bfafb8d8353fee 100644 (file)
@@ -1467,7 +1467,6 @@ AC_CHECK_HEADERS(m4_normalize([
    sys/signalfd.h
    sys/sockio.h
    sys/ucred.h
-   sys/uio.h
    sys/un.h
    termios.h
    ucred.h
index fc5ad5fd658ca6a92538119ca313b04c63b341cb..ed6185343e295c709fabbe46215765b8f90748f6 100644 (file)
 /* Define to 1 if you have the <sys/ucred.h> header file. */
 #undef HAVE_SYS_UCRED_H
 
-/* Define to 1 if you have the <sys/uio.h> header file. */
-#undef HAVE_SYS_UIO_H
-
 /* Define to 1 if you have the <sys/un.h> header file. */
 #undef HAVE_SYS_UN_H
 
index f0a50c0e015797c4888e804ac1e9de0ce2597c6a..ecdddba7fcb8f10da20c5b8e3f405517e05ff4b9 100644 (file)
 #ifndef PG_IOVEC_H
 #define PG_IOVEC_H
 
-#include <limits.h>
+#ifndef WIN32
 
-#ifdef HAVE_SYS_UIO_H
+#include <limits.h>
 #include <sys/uio.h>
-#endif
 
-/* If <sys/uio.h> is missing, define our own POSIX-compatible iovec struct. */
-#ifndef HAVE_SYS_UIO_H
+#else
+
+/* POSIX requires at least 16 as a maximum iovcnt. */
+#define IOV_MAX 16
+
+/* Define our own POSIX-compatible iovec struct. */
 struct iovec
 {
    void       *iov_base;
    size_t      iov_len;
 };
-#endif
 
-/*
- * If <limits.h> didn't define IOV_MAX, define our own.  POSIX requires at
- * least 16.
- */
-#ifndef IOV_MAX
-#define IOV_MAX 16
 #endif
 
 /* Define a reasonable maximum that is safe to use on the stack. */
index cc82668457ff0410f8cf6007450f652021683354..741998a1037157623b185dbfe6cf0922dc6636f1 100644 (file)
@@ -375,7 +375,6 @@ sub GenerateFiles
        HAVE_SYS_STAT_H                          => 1,
        HAVE_SYS_TYPES_H                         => 1,
        HAVE_SYS_UCRED_H                         => undef,
-       HAVE_SYS_UIO_H                           => undef,
        HAVE_SYS_UN_H                            => undef,
        HAVE_TERMIOS_H                           => undef,
        HAVE_TYPEOF                              => undef,