From 72c1fa0c900196f43fe41b8bbdd938983b9c8c86 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 3 Apr 2011 18:04:14 +0200 Subject: [PATCH] Don't use poll() on Mac OS Congratulations, Apple. Your OS is really great. In some versions (according to google, it used to work in older releases), poll() can only handle sockets. If you give it a pipe (as e.g. the shell module does), it will fail with POLLNVAL which Csocket handles by going into an endless loop. Signed-off-by: Uli Schlachter --- configure.ac | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e63e6845..8206f3d2 100644 --- a/configure.ac +++ b/configure.ac @@ -160,7 +160,24 @@ if test "x$GXX" = "xyes"; then fi if test "$POLL" = "yes"; then - AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()]) + # poll() is broken on Mac OS, it fails with POLLNVAL for pipe()s. + if test -n "$ISDARWIN" + then + # Did they give us --enable-poll? + if test -n "$enable_poll" + then + # Yes, they asked for this. + AC_MSG_WARN([poll() is known to be broken on Mac OS X. You have been warned.]) + else + # No, our default value of "yes" got applied. + AC_MSG_WARN([poll() is known to be broken on Mac OS X. Using select() instead.]) + AC_MSG_WARN([Use --enable-poll for forcing poll() to be used.]) + POLL=no + fi + fi + if test "$POLL" = "yes"; then + AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()]) + fi fi AC_CHECK_LIB( gnugetopt, getopt_long,)