Add a check for broken poll on Mac OS X.

2006-12-12  Matthias Clasen  <mclasen@redhat.com>

        * configure.in: Add a check for broken poll on Mac OS X.

        * glib/gmain.c: Use poll emulation on OS X.  (#302672, Toby Peterson,
        patch by Dave Vasilevsky)
This commit is contained in:
Matthias Clasen 2006-12-12 20:04:45 +00:00 committed by Matthias Clasen
parent dc6f720c59
commit caecf2dda0
3 changed files with 34 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2006-12-12 Matthias Clasen <mclasen@redhat.com>
* configure.in: Add a check for broken poll on Mac OS X.
* glib/gmain.c: Use poll emulation on OS X. (#302672, Toby Peterson,
patch by Dave Vasilevsky)
2006-12-11 Matthias Clasen <mclasen@redhat.com> 2006-12-11 Matthias Clasen <mclasen@redhat.com>
* glib/gatomic.c: Don't use local numeric labels in * glib/gatomic.c: Don't use local numeric labels in

View File

@ -2117,6 +2117,32 @@ else
glib_cv_value_POLLNVAL=32 glib_cv_value_POLLNVAL=32
fi fi
# Check for Mac OS X's broken poll
if test $cross_compiling != yes ; then
AC_MSG_CHECKING(for broken poll)
AC_TRY_RUN([[
#include <stdlib.h>
#include <fcntl.h>
#include <poll.h>
int main(void) {
struct pollfd fds[1];
int fd;
fd = open("/dev/null", 1);
fds[0].fd = fd;
fds[0].events = POLLIN;
fds[0].revents = 0;
if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
exit(1); /* Does not work for devices -- fail */
}
exit(0);
}]],
broken_poll=no,
broken_poll=yes
AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])
)
AC_MSG_RESULT($broken_poll)
fi
dnl ********************** dnl **********************
dnl *** Win32 API libs *** dnl *** Win32 API libs ***
dnl ********************** dnl **********************

View File

@ -53,7 +53,7 @@
/* The poll() emulation on OS/X doesn't handle fds=NULL, nfds=0, /* The poll() emulation on OS/X doesn't handle fds=NULL, nfds=0,
* so we prefer our own poll emulation. * so we prefer our own poll emulation.
*/ */
#ifdef _POLL_EMUL_H_ #if defined(_POLL_EMUL_H_) || defined(BROKEN_POLL)
#undef HAVE_POLL #undef HAVE_POLL
#endif #endif