Skip to content
Browse files

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 <psychon@znc.in>
  • Loading branch information...
1 parent e51b7da commit 72c1fa0c900196f43fe41b8bbdd938983b9c8c86 @psychon psychon committed Apr 3, 2011
Showing with 18 additions and 1 deletion.
  1. +18 −1 configure.ac
View
19 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,)

0 comments on commit 72c1fa0

Please sign in to comment.
Something went wrong with that request. Please try again.