[glib] Use POSIX-specified <poll.h> over <sys/poll.h>



commit 3f41e492851b3e69ceb050986766fe3137cbb1fe
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Dec 22 11:33:07 2013 -0500

    Use POSIX-specified <poll.h> over <sys/poll.h>
    
    POSIX specifies that <poll.h> is the correct header to include for
    poll(), so let's do that instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=141251

 config.h.win32.in                     |    3 ---
 configure.ac                          |   16 +++-------------
 docs/reference/glib/glib-sections.txt |    1 -
 gio/gunixmounts.c                     |    5 +----
 glib/gpoll.c                          |    4 ++--
 tests/timeloop-basic.c                |    2 +-
 6 files changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/config.h.win32.in b/config.h.win32.in
index 62e3085..0b272d3 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -584,9 +584,6 @@
 /* #undef HAVE_SYS_PARAM_H */
 #endif /* _MSC_VER or __DMC__ */
 
-/* Define to 1 if you have the <sys/poll.h> header file. */
-/* #undef HAVE_SYS_POLL_H */
-
 /* Define to 1 if you have the <sys/prctl.h> header file. */
 /* #undef HAVE_SYS_PRCTL_H */
 
diff --git a/configure.ac b/configure.ac
index 9fb40d3..603e377 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,7 +771,7 @@ fi
 
 
 # check for header files
-AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h])
+AC_CHECK_HEADERS([sys/param.h sys/resource.h])
 AC_CHECK_HEADERS([sys/select.h stdint.h inttypes.h sched.h malloc.h])
 AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
 AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
@@ -2429,11 +2429,11 @@ dnl ****************************************
 
 glib_poll_includes=["
 #include <sys/types.h>
-#include <sys/poll.h>
+#include <poll.h>
 "]
 
 AS_IF([ test $ac_cv_header_sys_types_h = yes &&
-   test $ac_cv_header_sys_poll_h = yes ], [
+   test $ac_cv_func_poll = yes ], [
   glib_failed=false
   GLIB_CHECK_VALUE(POLLIN, $glib_poll_includes, glib_failed=true)
   GLIB_CHECK_VALUE(POLLOUT, $glib_poll_includes, glib_failed=true)
@@ -2458,9 +2458,6 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
        #include <stdlib.h>
        #include <fcntl.h>
        #include <poll.h>
-       #ifdef HAVE_SYS_POLL_H
-       #include <sys/poll.h>
-       #endif
        int main(void) {
          struct pollfd fds[1];
          int fd;
@@ -2803,9 +2800,6 @@ _______EOF
        if test "$glib_header_alloca_h" = "yes"; then
          echo '#define GLIB_HAVE_ALLOCA_H' >> $outfile
        fi
-       if test x$glib_sys_poll_h = xyes; then
-         echo '#define GLIB_HAVE_SYS_POLL_H' >> $outfile
-       fi
        if test x$glib_included_printf != xyes; then
           echo "
 /* Specifies that GLib's g_print*() functions wrap the
@@ -3124,10 +3118,6 @@ else
   glib_header_alloca_h="$ac_cv_header_alloca_h"
 fi
 
-if test x$ac_cv_header_sys_poll_h = xyes ; then
-  glib_sys_poll_h=yes
-fi
-
 if test x$enable_included_printf = xyes ; then
   glib_included_printf=yes
 fi
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index e8b6bfe..48f4115 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -544,7 +544,6 @@ g_source_remove_by_funcs_user_data
 g_source_remove_by_user_data
 
 <SUBSECTION Private>
-GLIB_HAVE_SYS_POLL_H
 GLIB_HAVE_ALLOCA_H
 alloca
 GLIB_USING_SYSTEM_PRINTF
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 41565be..a6cf826 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -31,11 +31,8 @@
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
 #endif
-#endif
-#ifdef HAVE_POLL_H
+#ifdef HAVE_POLL
 #include <poll.h>
 #endif
 #include <stdio.h>
diff --git a/glib/gpoll.c b/glib/gpoll.c
index 66c5f0e..5d1e632 100644
--- a/glib/gpoll.c
+++ b/glib/gpoll.c
@@ -55,8 +55,8 @@
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif /* HAVE_SYS_TIME_H */
-#ifdef GLIB_HAVE_SYS_POLL_H
-#  include <sys/poll.h>
+#ifdef HAVE_POLL
+#  include <poll.h>
 
 /* The poll() emulation on OS/X doesn't handle fds=NULL, nfds=0,
  * so we prefer our own poll emulation.
diff --git a/tests/timeloop-basic.c b/tests/timeloop-basic.c
index 56861f3..2c11bc5 100644
--- a/tests/timeloop-basic.c
+++ b/tests/timeloop-basic.c
@@ -8,7 +8,7 @@
 #include <unistd.h>
 #include <sys/resource.h>
 #include <sys/time.h>
-#include <sys/poll.h>
+#include <poll.h>
 
 #define TRUE 1
 #define FALSE 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]