diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-12 12:24:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-12 12:25:09 -0400 |
commit | 4aaa4215e7e11f318c5a50124e29dc0b50ce21e1 (patch) | |
tree | 882f99f04e779aa6f29f562d482a1e05faafbe00 /src/or/config.c | |
parent | 31508a0abccfee1cda0869a9a7d22df74d6b67b7 (diff) | |
download | tor-4aaa4215e7e11f318c5a50124e29dc0b50ce21e1.tar.gz tor-4aaa4215e7e11f318c5a50124e29dc0b50ce21e1.zip |
Attempt to fix 32-bit builds, which broke with 31508a0abccfee1cd
When size_t is 32 bits, doing "size_t ram; if (ram > 8GB) { ... }"
produces a compile-time warning.
Bug caused by #24782 fix; not in any released Tor.
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/config.c b/src/or/config.c index 6b8885521a..986794cec5 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -4545,7 +4545,15 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess) /* We detected the amount of memory available. */ uint64_t avail = 0; - if (ram >= (8 * ONE_GIGABYTE)) { +#if SIZEOF_SIZE_T > 4 +/* On a 64-bit platform, we consider 8GB "very large". */ +#define RAM_IS_VERY_LARGE(x) ((x) >= (8 * ONE_GIGABYTE)) +#else +/* On a 32-bit platform, we can't have 8GB of ram. */ +#define RAM_IS_VERY_LARGE(x) (0) +#endif + + if (RAM_IS_VERY_LARGE(ram)) { /* If we have 8 GB, or more, RAM available, we set the MaxMemInQueues * to 0.4 * RAM. The idea behind this value is that the amount of RAM * is more than enough for a single relay and should allow the relay |