Test honestly for <sys/signalfd.h>.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 9 Feb 2022 19:24:54 +0000 (14:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 9 Feb 2022 19:24:54 +0000 (14:24 -0500)
Commit 6a2a70a02 supposed that any platform having <sys/epoll.h>
would also have <sys/signalfd.h>.  It turns out there are still a
few people using platforms where that's not so, so we'd better make
a separate configure probe for it.  But since it took this long to
notice, I'm content with the decision to not have a separate code
path for epoll-only machines; we'll just fall back to using poll()
for these stragglers.

Per gripe from Gabriela Serventi.  Back-patch to v14 where this
code came in.

Discussion: https://postgr.es/m/CAHOHWE-JjJDfcYuLAAEO7Jk07atFAU47z8TzHzg71gbC0aMy=g@mail.gmail.com

configure
configure.ac
src/backend/storage/ipc/latch.c
src/include/pg_config.h.in
src/tools/msvc/Solution.pm

index 879f92202f31d2d838c0571a3c4331d0f3176639..0d52af552939488d0c6759f94c5d604b659c9f82 100755 (executable)
--- a/configure
+++ b/configure
@@ -13596,7 +13596,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 poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/uio.h sys/un.h termios.h ucred.h wctype.h
+for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/personality.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/signalfd.h sys/sockio.h sys/tas.h sys/uio.h sys/un.h termios.h ucred.h wctype.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 95287705f6b5583f5b4d6278d5647e0da2786acb..2afc822b12815dfc2366d02484bdc8d5decfa772 100644 (file)
@@ -1412,6 +1412,7 @@ AC_CHECK_HEADERS(m4_normalize([
    sys/select.h
    sys/sem.h
    sys/shm.h
+   sys/signalfd.h
    sys/sockio.h
    sys/tas.h
    sys/uio.h
index 61c876beff0832d20046feffacf4b320093d5bf0..5bb609b368d5751ccf8af88416b8a92295787fd0 100644 (file)
@@ -43,6 +43,9 @@
 #ifdef HAVE_SYS_EVENT_H
 #include <sys/event.h>
 #endif
+#ifdef HAVE_SYS_SIGNALFD_H
+#include <sys/signalfd.h>
+#endif
 #ifdef HAVE_POLL_H
 #include <poll.h>
 #endif
@@ -69,7 +72,7 @@
 #if defined(WAIT_USE_EPOLL) || defined(WAIT_USE_POLL) || \
    defined(WAIT_USE_KQUEUE) || defined(WAIT_USE_WIN32)
 /* don't overwrite manual choice */
-#elif defined(HAVE_SYS_EPOLL_H)
+#elif defined(HAVE_SYS_EPOLL_H) && defined(HAVE_SYS_SIGNALFD_H)
 #define WAIT_USE_EPOLL
 #elif defined(HAVE_KQUEUE)
 #define WAIT_USE_KQUEUE
 #error "no wait set implementation available"
 #endif
 
-#ifdef WAIT_USE_EPOLL
-#include <sys/signalfd.h>
-#endif
-
 /* typedef in latch.h */
 struct WaitEventSet
 {
index 912efdbbd12e66d961834a68275577397ddf46c2..28a1f0e9f0fb69935487e64fc84122e6c376cedf 100644 (file)
 /* Define to 1 if you have the <sys/shm.h> header file. */
 #undef HAVE_SYS_SHM_H
 
+/* Define to 1 if you have the <sys/signalfd.h> header file. */
+#undef HAVE_SYS_SIGNALFD_H
+
 /* Define to 1 if you have the <sys/sockio.h> header file. */
 #undef HAVE_SYS_SOCKIO_H
 
index ed1c53000ff0c016b198557c9851c95d6d0e2848..e6f20679dce2bc5dec1218ca342ec776f0f8a4be 100644 (file)
@@ -404,6 +404,7 @@ sub GenerateFiles
        HAVE_SYS_SELECT_H                        => undef,
        HAVE_SYS_SEM_H                           => undef,
        HAVE_SYS_SHM_H                           => undef,
+       HAVE_SYS_SIGNALFD_H                      => undef,
        HAVE_SYS_SOCKIO_H                        => undef,
        HAVE_SYS_STAT_H                          => 1,
        HAVE_SYS_TAS_H                           => undef,