aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-07-12 19:17:35 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-07-12 19:17:35 -0400
commitf014b1b9bb8eda4e82c1805969dbae2b07b7d54d (patch)
tree80a22f024a04430db95263846f34f3d57ee0f5b6 /src
parentf10f0ae420ee62400876ab34dca2c09c20dcd030 (diff)
downloadpostgresql-f014b1b9bb8eda4e82c1805969dbae2b07b7d54d.tar.gz
postgresql-f014b1b9bb8eda4e82c1805969dbae2b07b7d54d.zip
Probe for preadv/pwritev in a more macOS-friendly way.
Apple's mechanism for dealing with functions that are available in only some OS versions confuses AC_CHECK_FUNCS, and therefore AC_REPLACE_FUNCS. We can use AC_CHECK_DECLS instead, so long as we enable -Werror=unguarded-availability-new. This allows people compiling for macOS to control whether or not preadv/pwritev are used by setting MACOSX_DEPLOYMENT_TARGET, rather than supplying a back-rev SDK. (Of course, the latter still works, too.) James Hilliard Discussion: https://postgr.es/m/20210122193230.25295-1-james.hilliard1@gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/include/pg_config.h.in14
-rw-r--r--src/include/port/pg_iovec.h4
-rw-r--r--src/tools/msvc/Solution.pm4
3 files changed, 12 insertions, 10 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 479c8fe0be7..d69d461ff2c 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -142,6 +142,14 @@
don't. */
#undef HAVE_DECL_POSIX_FADVISE
+/* Define to 1 if you have the declaration of `preadv', and to 0 if you don't.
+ */
+#undef HAVE_DECL_PREADV
+
+/* Define to 1 if you have the declaration of `pwritev', and to 0 if you
+ don't. */
+#undef HAVE_DECL_PWRITEV
+
/* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you
don't. */
#undef HAVE_DECL_RTLD_GLOBAL
@@ -421,9 +429,6 @@
/* Define to 1 if you have the `pread' function. */
#undef HAVE_PREAD
-/* Define to 1 if you have the `preadv' function. */
-#undef HAVE_PREADV
-
/* Define to 1 if you have the `pstat' function. */
#undef HAVE_PSTAT
@@ -445,9 +450,6 @@
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
-/* Define to 1 if you have the `pwritev' function. */
-#undef HAVE_PWRITEV
-
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
diff --git a/src/include/port/pg_iovec.h b/src/include/port/pg_iovec.h
index 05d59e99fb6..88f6615dbc6 100644
--- a/src/include/port/pg_iovec.h
+++ b/src/include/port/pg_iovec.h
@@ -39,13 +39,13 @@ struct iovec
/* Define a reasonable maximum that is safe to use on the stack. */
#define PG_IOV_MAX Min(IOV_MAX, 32)
-#ifdef HAVE_PREADV
+#if HAVE_DECL_PREADV
#define pg_preadv preadv
#else
extern ssize_t pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset);
#endif
-#ifdef HAVE_PWRITEV
+#if HAVE_DECL_PWRITEV
#define pg_pwritev pwritev
#else
extern ssize_t pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset);
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index b529f78a601..294b968dcdb 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -245,6 +245,8 @@ sub GenerateFiles
HAVE_DECL_LLVMGETHOSTCPUFEATURES => 0,
HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN => 0,
HAVE_DECL_POSIX_FADVISE => undef,
+ HAVE_DECL_PREADV => 0,
+ HAVE_DECL_PWRITEV => 0,
HAVE_DECL_RTLD_GLOBAL => 0,
HAVE_DECL_RTLD_NOW => 0,
HAVE_DECL_STRLCAT => undef,
@@ -335,7 +337,6 @@ sub GenerateFiles
HAVE_PPC_LWARX_MUTEX_HINT => undef,
HAVE_PPOLL => undef,
HAVE_PREAD => undef,
- HAVE_PREADV => undef,
HAVE_PSTAT => undef,
HAVE_PS_STRINGS => undef,
HAVE_PTHREAD => undef,
@@ -343,7 +344,6 @@ sub GenerateFiles
HAVE_PTHREAD_IS_THREADED_NP => undef,
HAVE_PTHREAD_PRIO_INHERIT => undef,
HAVE_PWRITE => undef,
- HAVE_PWRITEV => undef,
HAVE_RANDOM => undef,
HAVE_READLINE_H => undef,
HAVE_READLINE_HISTORY_H => undef,