# HG changeset patch # User Paul Eggert # Date 1169281953 0 # Node ID d41d48e822b4c53bf4510ea0e1391803899650a1 # Parent 1be30ef548f519bc627c8aac434a4ce49a8e90bf * lib/poll.c: Include sys/time.h and time.h unconditionally, since we now assume the sys_time module. * m4/poll.m4 (gl_PREREQ_POLL): Don't require AC_HEADER_TIME or check for sys/time.h; no longer needed. * modules/poll (Depends-on): Depend on sys_time. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-19 Paul Eggert + + * lib/poll.c: Include sys/time.h and time.h unconditionally, + since we now assume the sys_time module. + * m4/poll.m4 (gl_PREREQ_POLL): Don't require AC_HEADER_TIME or + check for sys/time.h; no longer needed. + * modules/poll (Depends-on): Depend on sys_time. + 2007-01-18 Bruno Haible * m4/mktime.m4 (AC_FUNC_MKTIME): Remove test for . diff --git a/lib/poll.c b/lib/poll.c --- a/lib/poll.c +++ b/lib/poll.c @@ -36,16 +36,8 @@ #include #endif -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif +#include +#include #ifndef INFTIM #define INFTIM (-1) @@ -157,7 +149,7 @@ if (FD_ISSET (pfd[i].fd, &rfds)) { int r; - + #if defined __MACH__ && defined __APPLE__ /* There is a bug in Mac OS X that causes it to ignore MSG_PEEK for some kinds of descriptors. Detect if this descriptor is a @@ -172,27 +164,27 @@ #endif if (r == 0) happened |= POLLHUP; - + /* If the event happened on an unconnected server socket, that's fine. */ else if (r > 0 || ( /* (r == -1) && */ errno == ENOTCONN)) happened |= (POLLIN | POLLRDNORM) & sought; - + /* Distinguish hung-up sockets from other errors. */ else if (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET) happened |= POLLHUP; - + else happened |= POLLERR; } - + if (FD_ISSET (pfd[i].fd, &wfds)) happened |= (POLLOUT | POLLWRNORM | POLLWRBAND) & sought; - + if (FD_ISSET (pfd[i].fd, &efds)) happened |= (POLLPRI | POLLRDBAND) & sought; - + if (happened) { pfd[i].revents = happened; diff --git a/m4/poll.m4 b/m4/poll.m4 --- a/m4/poll.m4 +++ b/m4/poll.m4 @@ -1,5 +1,5 @@ -# poll.m4 serial 6 -dnl Copyright (c) 2003, 2005, 2006 Free Software Foundation, Inc. +# poll.m4 serial 7 +dnl Copyright (c) 2003, 2005, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -67,6 +67,5 @@ # Prerequisites of lib/poll.c. AC_DEFUN([gl_PREREQ_POLL], [ - AC_REQUIRE([AC_HEADER_TIME]) - AC_CHECK_HEADERS_ONCE(sys/time.h sys/ioctl.h sys/filio.h) + AC_CHECK_HEADERS_ONCE(sys/ioctl.h sys/filio.h) ]) diff --git a/modules/poll b/modules/poll --- a/modules/poll +++ b/modules/poll @@ -8,6 +8,7 @@ Depends-on: sys_select +sys_time configure.ac: gl_FUNC_POLL