summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-07 16:27:26 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-07 16:27:26 -0500
commitd4724f1414d23cda7ae9a27f45cef9faf7e89544 (patch)
treeb1c0c120701bd286425e6b3ddc944895999ec3fb
parent0162463667edd85b0973a6cc182b66288585be92 (diff)
parent212bd9778b5c249f02f8fbdc1e8ccbe4c108f03a (diff)
downloadtor-d4724f1414d23cda7ae9a27f45cef9faf7e89544.tar.gz
tor-d4724f1414d23cda7ae9a27f45cef9faf7e89544.zip
Merge branch 'maint-0.3.5' into release-0.3.5
-rw-r--r--src/feature/hibernate/hibernate.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/feature/hibernate/hibernate.c b/src/feature/hibernate/hibernate.c
index 4c46c4fe2a..6f8795cecc 100644
--- a/src/feature/hibernate/hibernate.c
+++ b/src/feature/hibernate/hibernate.c
@@ -50,6 +50,16 @@ hibernating, phase 2:
#include <unistd.h>
#endif
+#ifdef HAVE_SYSTEMD
+# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
+/* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse
+ * Coverity. Here's a kludge to unconfuse it.
+ */
+# define __INCLUDE_LEVEL__ 2
+# endif /* defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) */
+#include <systemd/sd-daemon.h>
+#endif /* defined(HAVE_SYSTEMD) */
+
/** Are we currently awake, asleep, running out of bandwidth, or shutting
* down? */
static hibernate_state_t hibernate_state = HIBERNATE_STATE_INITIAL;
@@ -821,6 +831,8 @@ hibernate_soft_limit_reached(void)
return get_accounting_bytes() >= soft_limit;
}
+#define TOR_USEC_PER_SEC (1000000)
+
/** Called when we get a SIGINT, or when bandwidth soft limit is
* reached. Puts us into "loose hibernation": we don't accept new
* connections, but we continue handling old ones. */