Use POSIX-specified <poll.h> over <sys/poll.h>
authorRyan Lortie <desrt@desrt.ca>
Sun, 22 Dec 2013 16:33:07 +0000 (11:33 -0500)
committerRyan Lortie <desrt@desrt.ca>
Sun, 22 Dec 2013 16:33:07 +0000 (11:33 -0500)
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
configure.ac
docs/reference/glib/glib-sections.txt
gio/gunixmounts.c
glib/gpoll.c
tests/timeloop-basic.c

index 62e3085..0b272d3 100644 (file)
 /* #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 */
 
index 9fb40d3..603e377 100644 (file)
@@ -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
index e8b6bfe..48f4115 100644 (file)
@@ -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
index 41565be..a6cf826 100644 (file)
 #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>
index 66c5f0e..5d1e632 100644 (file)
@@ -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.
index 56861f3..2c11bc5 100644 (file)
@@ -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