From: Nick Mathewson Date: Sat, 14 Jun 2014 15:46:38 +0000 (-0400) Subject: Merge branch 'bug8746_v2_squashed' X-Git-Tag: tor-0.2.5.5-alpha~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7cafb1ea9307864c94ad3e019af93d09d48350e;p=thirdparty%2Ftor.git Merge branch 'bug8746_v2_squashed' Conflicts: src/common/include.am --- a7cafb1ea9307864c94ad3e019af93d09d48350e diff --cc src/common/compat.c index 111070cc10,1c460b6ae2..e25ecc462d --- a/src/common/compat.c +++ b/src/common/compat.c @@@ -3553,6 -3453,26 +3559,26 @@@ get_total_system_memory(size_t *mem_out *mem_out = mem_cached = (size_t) m; - return -1; + return 0; } + #ifdef TOR_UNIT_TESTS + /** Delay for msec milliseconds. Only used in tests. */ + void + tor_sleep_msec(int msec) + { + #ifdef _WIN32 + Sleep(msec); + #elif defined(HAVE_USLEEP) + sleep(msec / 1000); + /* Some usleep()s hate sleeping more than 1 sec */ + usleep((msec % 1000) * 1000); + #elif defined(HAVE_SYS_SELECT_H) + struct timeval tv = { msec / 1000, (msec % 1000) * 1000}; + select(0, NULL, NULL, NULL, &tv); + #else + sleep(CEIL_DIV(msec, 1000)); + #endif + } + #endif + diff --cc src/common/include.am index 61a90cd355,c9dcedd52d..68e0110c26 --- a/src/common/include.am +++ b/src/common/include.am @@@ -64,13 -56,13 +64,13 @@@ LIBOR_A_SOURCES = src/common/di_ops.c \ src/common/log.c \ src/common/memarea.c \ - src/common/procmon.c \ - src/common/mempool.c \ src/common/util.c \ src/common/util_codedigest.c \ + src/common/util_process.c \ src/common/sandbox.c \ src/ext/csiphash.c \ - $(libor_extra_source) + $(libor_extra_source) \ + $(libor_mempool_source) LIBOR_CRYPTO_A_SOURCES = \ src/common/aes.c \ @@@ -119,7 -114,7 +121,8 @@@ COMMONHEADERS = src/common/torlog.h \ src/common/tortls.h \ src/common/util.h \ - src/common/util_process.h ++ src/common/util_process.h \ + $(libor_mempool_header) noinst_HEADERS+= $(COMMONHEADERS) diff --cc src/test/test_util.c index c7fa141188,656b77b1a9..151ec69127 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@@ -12,10 -12,9 +12,11 @@@ #include "config.h" #include "control.h" #include "test.h" +#ifdef ENABLE_MEMPOOLS #include "mempool.h" +#endif /* ENABLE_MEMPOOLS */ #include "memarea.h" + #include "util_process.h" #ifdef _WIN32 #include