Browse Source

Disable KQUEUE from inside Tor if the OSX version is prior to 10.4.0

svn:r18450
Nick Mathewson 15 years ago
parent
commit
c7315e65ae
2 changed files with 21 additions and 1 deletions
  1. 7 0
      ChangeLog
  2. 14 1
      src/or/config.c

+ 7 - 0
ChangeLog

@@ -1,4 +1,11 @@
 Changes in version 0.2.1.13-????? - 2009-0?-??
+  o Minor bugfixes:
+    - Automatically detect MacOSX versions earlier than 10.4.0, and
+      disable kqueue from inside Tor when running with these versions.
+      We previously did this from the startup script, but that was no
+      help to people who didn't use the startup script.  Resolves
+      bug 863.
+
   o Minor features:
     - On Linux, use the prctl call to re-enable core dumps when the user
       is option is set.

+ 14 - 1
src/or/config.c

@@ -4735,6 +4735,18 @@ config_parse_interval(const char *s, int *ok)
   return (int)r;
 }
 
+/* This is what passes for version detection on OSX.  We set
+ * MACOSX_KQUEUE_IS_BROKEN to true iff we're on a version of OSX before
+ * 10.4.0 (aka 1040). */
+#ifdef __APPLE__
+#ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+#define MACOSX_KQUEUE_IS_BROKEN \
+  (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1040)
+#else
+#define MACOSX_KQUEUE_IS_BROKEN 0
+#endif
+#endif
+
 /**
  * Initialize the libevent library.
  */
@@ -4747,7 +4759,8 @@ init_libevent(void)
    */
   suppress_libevent_log_msg("Function not implemented");
 #ifdef __APPLE__
-  if (decode_libevent_version(event_get_version(), NULL) < LE_11B) {
+  if (MACOSX_KQUEUE_IS_BROKEN ||
+      decode_libevent_version(event_get_version(), NULL) < LE_11B) {
     setenv("EVENT_NOKQUEUE","1",1);
   }
 #endif