[or-cvs] r10948: Fix warnings on platforms where rlim values can be signed. A (in tor/trunk: . src/common src/or)
nickm at seul.org
nickm at seul.org
Fri Jul 27 19:53:29 UTC 2007
Author: nickm
Date: 2007-07-27 15:53:29 -0400 (Fri, 27 Jul 2007)
New Revision: 10948
Modified:
tor/trunk/
tor/trunk/src/common/compat.c
tor/trunk/src/or/buffers.c
Log:
r13944 at catbus: nickm | 2007-07-27 15:52:35 -0400
Fix warnings on platforms where rlim values can be signed.
Add an 8k buffer freelist.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13944] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c 2007-07-27 18:33:37 UTC (rev 10947)
+++ tor/trunk/src/common/compat.c 2007-07-27 19:53:29 UTC (rev 10948)
@@ -679,14 +679,14 @@
strerror(errno));
return -1;
}
- if (rlim.rlim_max < limit) {
+ if ((unsigned long)rlim.rlim_max < limit) {
log_warn(LD_CONFIG,"We need %lu file descriptors available, and we're "
"limited to %lu. Please change your ulimit -n.",
limit, (unsigned long)rlim.rlim_max);
return -1;
}
- most = (rlim.rlim_max > cap) ? cap : (unsigned) rlim.rlim_max;
- if (most > rlim.rlim_cur) {
+ most = ((unsigned long)rlim.rlim_max > cap) ? cap : (unsigned) rlim.rlim_max;
+ if (most > (unsigned long)rlim.rlim_cur) {
log_info(LD_NET,"Raising max file descriptors from %lu to %lu.",
(unsigned long)rlim.rlim_cur, most);
}
Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c 2007-07-27 18:33:37 UTC (rev 10947)
+++ tor/trunk/src/or/buffers.c 2007-07-27 19:53:29 UTC (rev 10948)
@@ -178,10 +178,11 @@
/** Freelists to hold 4k and 16k memory chunks. This seems to be what
* we use most. */
static free_mem_list_t free_mem_list_4k = { NULL, 0, 0, 4096, 16, INT_MAX };
-static free_mem_list_t free_mem_list_16k = { NULL, 0, 0, 16384, 4, 128 };
+static free_mem_list_t free_mem_list_8k = { NULL, 0, 0, 8192 , 8, 128 };
+static free_mem_list_t free_mem_list_16k = { NULL, 0, 0, 16384, 4, 64 };
/** Macro: True iff the size is one for which we keep a freelist. */
-#define IS_FREELIST_SIZE(sz) ((sz) == 4096 || (sz) == 16384)
+#define IS_FREELIST_SIZE(sz) ((sz) == 4096 || (sz) == 8192 || (sz) == 16384)
/** Return the proper freelist for chunks of size <b>sz</b>, or fail
* with an assertion. */
@@ -190,6 +191,8 @@
{
if (sz == 4096) {
return &free_mem_list_4k;
+ } else if (sz == 8192) {
+ return &free_mem_list_8k;
} else {
tor_assert(sz == 16384);
return &free_mem_list_16k;
More information about the tor-commits
mailing list