[or-cvs] r13059: Backport r12339 with fix in r12931: Work on platforms where (in tor/branches/tor-0_1_2-patches: . doc src/common)

nickm at seul.org nickm at seul.org
Mon Jan 7 19:51:42 UTC 2008


Author: nickm
Date: 2008-01-07 14:51:42 -0500 (Mon, 07 Jan 2008)
New Revision: 13059

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/configure.in
   tor/branches/tor-0_1_2-patches/doc/TODO.012
   tor/branches/tor-0_1_2-patches/src/common/compat.c
Log:
 r17505 at catbus:  nickm | 2008-01-07 14:51:37 -0500
 Backport r12339 with fix in r12931: Work on platforms where rlim_t is wider than unsigned long.



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r17505] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/configure.in
===================================================================
--- tor/branches/tor-0_1_2-patches/configure.in	2008-01-07 19:15:34 UTC (rev 13058)
+++ tor/branches/tor-0_1_2-patches/configure.in	2008-01-07 19:51:42 UTC (rev 13059)
@@ -589,6 +589,18 @@
 #include <sys/socket.h>
 #endif])
 
+AC_CHECK_TYPES([rlim_t], , ,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+])
+
 if test -z "$CROSS_COMPILE"; then
 AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [
 AC_TRY_RUN([

Modified: tor/branches/tor-0_1_2-patches/doc/TODO.012
===================================================================
--- tor/branches/tor-0_1_2-patches/doc/TODO.012	2008-01-07 19:15:34 UTC (rev 13058)
+++ tor/branches/tor-0_1_2-patches/doc/TODO.012	2008-01-07 19:51:42 UTC (rev 13059)
@@ -9,7 +9,7 @@
   - backport the osx privoxy.config changes
   X no need to backport the windows privoxy.config changes because they're
     not in SVN??
-  - r12339: rlim_t may be wider than unsigned long.
+  o r12339: rlim_t may be wider than unsigned long.
   - r12341: Work if the real open-file limit is OPEN_FILES.
   o r12459: Exit policies reject public IP address too
 

Modified: tor/branches/tor-0_1_2-patches/src/common/compat.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/common/compat.c	2008-01-07 19:15:34 UTC (rev 13058)
+++ tor/branches/tor-0_1_2-patches/src/common/compat.c	2008-01-07 19:51:42 UTC (rev 13059)
@@ -606,6 +606,10 @@
 
 #define ULIMIT_BUFFER 32 /* keep 32 extra fd's beyond _ConnLimit */
 
+#if defined(HAVE_GETRLIMIT) && !defined(HAVE_RLIM_T)
+typedef unsigned long rlim_t;
+#endif
+
 /** Learn the maximum allowed number of file descriptors. (Some systems
  * have a low soft limit.
  *
@@ -627,7 +631,7 @@
   }
 #else
   struct rlimit rlim;
-  unsigned long most;
+  rlim_t most;
   tor_assert(limit > 0);
   tor_assert(cap > 0);
 
@@ -642,10 +646,10 @@
              limit, (unsigned long)rlim.rlim_max);
     return -1;
   }
-  most = (rlim.rlim_max > cap) ? cap : (unsigned) rlim.rlim_max;
+  most = (rlim.rlim_max > (rlim_t)cap) ? (rlim_t)cap : rlim.rlim_max;
   if (most > rlim.rlim_cur) {
     log_info(LD_NET,"Raising max file descriptors from %lu to %lu.",
-             (unsigned long)rlim.rlim_cur, most);
+             (unsigned long)rlim.rlim_cur, (unsigned long)most);
   }
   rlim.rlim_cur = most;
   if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) {



More information about the tor-commits mailing list