Le mardi 19 décembre 2006 à 09:38 +0100, Paolo Bonzini a écrit : > > I have been experiencing several problem with the poll module, > > especially under MacOS X. > > I was about to submit a patch for poll to fix some of these issues, but > I prefer yours much more if it works. In fact, the FIONREAD ioctl is a > hack and my patch added yet another hack instead of using the trick of > having a length of zero. > > > The module make the following assumption (quoting from the source): "An > > hung up descriptor does not increase the return value". > > The original code did not have this assumption, and in fact I had to > write my code around this behavior of gnulib's poll, when I ported GNU > Smalltalk to Mac OS X. > > I don't remember if it was Paul or Bruno who suggested that POLLHUP does > not increase the return value. What do you think? If this was a > previous mistake, I think that we should apply Yoann's patch, though > with some cosmetic (coding standards) fixes.
Additionally, it should be noted that poll() is available on OSX through Fink libpoll. Prelude used to check it, until GnuLib implemented the poll module. It would be interesting to implement the detection of libpoll in poll.m4. Enclosed is the old detection code we used in Prelude, if that is of any interest (I'm not good at writing autoconf stuff, so I'll leave the implementation to someone else). AC_CHECK_LIB(c, poll, libc_poll=yes) if test x$libc_poll != xyes; then dnl SG: Special test for macosx, poll() is provided if libpoll dnl is installed by the Fink Package Manager http://fink.sf.net/ if test $host_cpu = "powerpc" && test $host_vendor = "apple"; then dnl save vars CFLAGS_SAVE=$CFLAGS LDFLAGS_SAVE=$LDFLAGS CPPFLAGS_SAVE=$CPPFLAGS dnl set specific macosx paths (fink) LDFLAGS="-L/sw/lib" CFLAGS="-I/sw/include" CPPFLAGS="-I/sw/include" AC_CHECK_LIB(poll, poll, COMMON_LIBS="$COMMON_LIBS -L/sw/lib -lpoll", AC_MSG_ERROR("Could not find libpoll. Try installing libpoll via the Fink Package Manager http://fink.sourceforge.net/")) AC_CHECK_HEADER(sys/poll.h, libprelude_cflags="$libprelude_cflags -I/sw/include", AC_MSG_ERROR("Could not find sys/poll.h.")) dnl restore vars CFLAGS=$CFLAGS_SAVE LDFLAGS=$LDFLAGS_SAVE CPPFLAGS=$CPPFLAGS_SAVE dnl poll() not found in libc, let's check in libpoll else AC_SEARCH_LIBS(poll, poll, COMMON_LIBS="$COMMON_LIBS -lpoll") fi fi -- Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies Tel: +33 (0)8 70 70 21 58 Fax: +33(0)4 78 42 21 58 http://www.prelude-ids.com