From 1e5da68b88c48af5054b1982de11a95070c20280 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 6 Jan 2016 07:34:18 -0700 Subject: [PATCH] OS X: avoid getdtablesize() by switching frmo select() to poll() The getdtablesize() result appears not to be constant on OS X. Creating some combination of CFStream objects, threads, and CFRunLoop objects can cause the value to be increased by a factor of 10. Avoid the need for getdtablesize() by switching from select() to poll(). --- racket/src/configure | 5 +++++ racket/src/racket/configure.ac | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/racket/src/configure b/racket/src/configure index 6e6360cb35..86e48fb970 100755 --- a/racket/src/configure +++ b/racket/src/configure @@ -4792,6 +4792,11 @@ fi PREFLAGS="$PREFLAGS -DOS_X -D_DARWIN_UNLIMITED_SELECT" try_kqueue_syscall=yes + # Although select() generally works as well as poll() on OS X, + # getdtablesize() appears not to be constant within a process, + # and that breaks static allocation of fd_sets + try_poll_syscall=yes + # ".a" is typically not useful, since we always build a ".dylib": if test "${enable_libs}" == "" ; then INSTALL_LIBS_ENABLE=no-install diff --git a/racket/src/racket/configure.ac b/racket/src/racket/configure.ac index 579b400c39..e37b39ec5a 100644 --- a/racket/src/racket/configure.ac +++ b/racket/src/racket/configure.ac @@ -873,6 +873,11 @@ case "$host_os" in PREFLAGS="$PREFLAGS -DOS_X -D_DARWIN_UNLIMITED_SELECT" try_kqueue_syscall=yes + # Although select() generally works as well as poll() on OS X, + # getdtablesize() appears not to be constant within a process, + # and that breaks static allocation of fd_sets + try_poll_syscall=yes + # ".a" is typically not useful, since we always build a ".dylib": if test "${enable_libs}" == "" ; then INSTALL_LIBS_ENABLE=no-install