diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-07-27 19:53:29 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-07-27 19:53:29 +0000 |
commit | a5477c7bb9a9ae43bcdea6cdcf4a3335a78c3810 (patch) | |
tree | f3e96b26d1de7f4024bab49b143c52a1da089fda /src | |
parent | bc9a7be9432c779a4e47c8a58a33b5cfbc23e58e (diff) | |
download | tor-a5477c7bb9a9ae43bcdea6cdcf4a3335a78c3810.tar.gz tor-a5477c7bb9a9ae43bcdea6cdcf4a3335a78c3810.zip |
r13944@catbus: nickm | 2007-07-27 15:52:35 -0400
Fix warnings on platforms where rlim values can be signed.
Add an 8k buffer freelist.
svn:r10948
Diffstat (limited to 'src')
-rw-r--r-- | src/common/compat.c | 6 | ||||
-rw-r--r-- | src/or/buffers.c | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 0aa7909c0a..eee9b87b09 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -679,14 +679,14 @@ set_max_file_descriptors(unsigned long limit, unsigned long cap) 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); } diff --git a/src/or/buffers.c b/src/or/buffers.c index 1087a7a6fa..05132fa196 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -178,10 +178,11 @@ typedef struct free_mem_list_t { /** 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 @@ get_free_mem_list(size_t sz) { 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; |