[or-cvs] [tor/master] Fix build on Solaris by disabling support for DisableAllSwap

arma at torproject.org arma at torproject.org
Tue Jan 19 04:28:00 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Tue, 19 Jan 2010 04:59:24 +0100
Subject: Fix build on Solaris by disabling support for DisableAllSwap
Commit: 4728bd904f2b64fe183a068e5fb1be00ee5e6008

Fixes bug 1198. Solaris doesn't have RLIMIT_MEMLOCK for get/setrlimit,
so disable support because we don't know if all memory can be locked.
---
 ChangeLog           |    3 +++
 src/common/compat.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d121f22..6257260 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -71,6 +71,9 @@ Changes in version 0.2.2.7-alpha - 2010-01-??
       but there is non-exit bandwidth, or no guard bandwidth but there
       is non-guard bandwidth, don't crash during path selection. Bugfix
       on 0.2.0.3-alpha.
+    - Fix compilation on Solaris by removing support for the
+      DisableAllSwap config option. Solaris doesn't have an rlimit for
+      mlockall, so we cannot use it safely. Bugfix on 0.2.2.6-alpha.
 
   o Removed features:
     - Remove the HSAuthorityRecordStats option that version 0 hidden
diff --git a/src/common/compat.c b/src/common/compat.c
index b221e4e..d45fda0 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2176,7 +2176,7 @@ tor_threads_init(void)
 }
 #endif
 
-#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL
+#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)
 /** Attempt to raise the current and max rlimit to infinity for our process.
  * This only needs to be done once and can probably only be done when we have
  * not already dropped privileges.
@@ -2244,7 +2244,7 @@ tor_mlockall(void)
    * http://msdn.microsoft.com/en-us/library/aa366895(VS.85).aspx
    */
 
-#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL
+#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)
   if (tor_set_max_memlock() == 0) {
     /* Perhaps we only want to log this if we're in a verbose mode? */
     log_notice(LD_GENERAL, "RLIMIT_MEMLOCK is now set to RLIM_INFINITY.");
-- 
1.6.5



More information about the tor-commits mailing list