]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
sysdeps: use POSIX poll.h instead of sys/poll.h
authorNatanael Copa <ncopa@alpinelinux.org>
Tue, 24 Mar 2020 11:04:24 +0000 (12:04 +0100)
committerNatanael Copa <ncopa@alpinelinux.org>
Thu, 26 Mar 2020 17:17:22 +0000 (18:17 +0100)
POSIX.1-2001 and POSIX.1-2008 specifies include <poll.h> so use that
rather than the non-standard/legacy include <sys/poll.h>.

This fixes the following warnings when building with musl libc:

    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
cmake/ConfigureChecks.cmake
cmake/config.h.cmake
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps.h

index 3a1165f00f6505e322388e400bd731d21733e9e0..a25166782db83324e8a5b30d41e430b92cf5243a 100644 (file)
@@ -32,7 +32,6 @@ check_include_file(sys/resource.h     HAVE_SYS_RESOURCE_H)
 check_include_file(sys/stat.h     HAVE_SYS_STAT_H)
 check_include_file(sys/types.h     HAVE_SYS_TYPES_H)
 check_include_file(sys/uio.h     HAVE_SYS_UIO_H)
-check_include_file(sys/poll.h   HAVE_POLL)      # dbus-sysdeps.c, dbus-sysdeps-win.c
 check_include_file(sys/prctl.h  HAVE_SYS_PRCTL_H)
 check_include_file(sys/syslimits.h    HAVE_SYS_SYSLIMITS_H)   # dbus-sysdeps-unix.c
 check_include_file(sys/time.h   HAVE_SYS_TIME_H)# dbus-sysdeps-win.c
@@ -55,6 +54,7 @@ check_symbol_exists(setrlimit    "sys/resource.h"   HAVE_SETRLIMIT)          #
 check_symbol_exists(socketpair   "sys/socket.h"     HAVE_SOCKETPAIR)         #  dbus-sysdeps.c
 check_symbol_exists(setlocale    "locale.h"         HAVE_SETLOCALE)          #  dbus-test-main.c
 check_symbol_exists(localeconv   "locale.h"         HAVE_LOCALECONV)         #  dbus-sysdeps.c
+check_symbol_exists(poll         "poll.h"           HAVE_POLL)               #  dbus-sysdeps-unix.c
 check_symbol_exists(strtoll      "stdlib.h"         HAVE_STRTOLL)            #  dbus-send.c
 check_symbol_exists(strtoull     "stdlib.h"         HAVE_STRTOULL)           #  dbus-send.c
 set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
index 2f9f5413e2f7de4cc9a761502045335cc7e11f77..bd1c0dbf50b881e13ca875df0ea3e38a7f3e0e4f 100644 (file)
 
 #cmakedefine HAVE_MEMORY_H 1
 
-/* Define to 1 if you have sys/poll.h */
+/* Define to 1 if you have poll */
 #cmakedefine    HAVE_POLL 1
 
 /* Define to 1 if you have signal.h */
index 71e5d86dc1aa77b84ff1e58c3520b08f9fc5992a..8350ac27add8237270701599eef978586bac8ef5 100644 (file)
@@ -68,9 +68,6 @@
 #ifdef HAVE_WRITEV
 #include <sys/uio.h>
 #endif
-#ifdef HAVE_POLL
-#include <sys/poll.h>
-#endif
 #ifdef HAVE_BACKTRACE
 #include <execinfo.h>
 #endif
index 60091026a7f6cca4ed69fafccaf6e65479f96613..a91c61e33be5999daa995f117a9afa963402c4b0 100644 (file)
 # define BROKEN_POLL
 #endif
 
-/* AIX sys/poll.h does #define events reqevents, and other
- * wonderousness, so must include sys/poll before declaring
- * DBusPollFD
- */ 
+/* Normally we'd only include this in dbus-sysdeps-unix.c.
+ * However, the member names in DBusPollFD are (deliberately) the same as
+ * in POSIX struct pollfd, and AIX's poll() implementation is known to
+ * do things like "#define events reqevents", which would break that approach.
+ * Defend against that by ensuring that if it's renamed anywhere, it's renamed
+ * everywhere.
+ */
 #ifdef HAVE_POLL
-#include <sys/poll.h>
+#include <poll.h>
 #endif
 
 #ifdef DBUS_WINCE