From: Matthias Clasen Date: Tue, 12 Dec 2006 20:04:45 +0000 (+0000) Subject: Add a check for broken poll on Mac OS X. X-Git-Tag: GLIB_2_13_0~192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=caecf2dda082e9c46c4157cdc10763deb8dcfc27;p=platform%2Fupstream%2Fglib.git Add a check for broken poll on Mac OS X. 2006-12-12 Matthias Clasen * 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) --- diff --git a/ChangeLog b/ChangeLog index 7b31eee..dd08a46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-12-12 Matthias Clasen + + * 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 * glib/gatomic.c: Don't use local numeric labels in diff --git a/configure.in b/configure.in index bada706..6c0a1bb 100644 --- a/configure.in +++ b/configure.in @@ -2117,6 +2117,32 @@ else glib_cv_value_POLLNVAL=32 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 + #include + #include + 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 *** Win32 API libs *** dnl ********************** diff --git a/glib/gmain.c b/glib/gmain.c index 547ab20..bbbf8aa 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -53,7 +53,7 @@ /* The poll() emulation on OS/X doesn't handle fds=NULL, nfds=0, * so we prefer our own poll emulation. */ -#ifdef _POLL_EMUL_H_ +#if defined(_POLL_EMUL_H_) || defined(BROKEN_POLL) #undef HAVE_POLL #endif