summaryrefslogtreecommitdiff
path: root/src/or/hibernate.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-03 12:52:43 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-03 12:52:43 -0400
commitdf98582851a92d514c04061a5e0ec762c17a0cfb (patch)
treeb52518169d65be6773a5abb606f3f56b5b8c9d25 /src/or/hibernate.c
parentfe8f7748202816a9b90e04db542e449145283a66 (diff)
parent02a4442524d84ea7edf6e3f136017faa73452d92 (diff)
downloadtor-df98582851a92d514c04061a5e0ec762c17a0cfb.tar.gz
tor-df98582851a92d514c04061a5e0ec762c17a0cfb.zip
Merge remote-tracking branch 'github/ticket26626'
Diffstat (limited to 'src/or/hibernate.c')
-rw-r--r--src/or/hibernate.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index c44e974fc1..1024c03546 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -767,13 +767,13 @@ read_bandwidth_usage(void)
"Successfully read bandwidth accounting info from state written at %s "
"for interval starting at %s. We have been active for %lu seconds in "
"this interval. At the start of the interval, we expected to use "
- "about %lu KB per second. ("U64_FORMAT" bytes read so far, "
- U64_FORMAT" bytes written so far)",
+ "about %lu KB per second. (%"PRIu64" bytes read so far, "
+ "%"PRIu64" bytes written so far)",
tbuf1, tbuf2,
(unsigned long)n_seconds_active_in_interval,
(unsigned long)(expected_bandwidth_usage*1024/60),
- U64_PRINTF_ARG(n_bytes_read_in_interval),
- U64_PRINTF_ARG(n_bytes_written_in_interval));
+ (n_bytes_read_in_interval),
+ (n_bytes_written_in_interval));
}
return 0;
@@ -805,7 +805,7 @@ hibernate_soft_limit_reached(void)
* - We have used up 95% of our bytes.
* - We have less than 500MB of bytes left.
*/
- uint64_t soft_limit = DBL_TO_U64(U64_TO_DBL(acct_max) * SOFT_LIM_PCT);
+ uint64_t soft_limit = (uint64_t) (acct_max * SOFT_LIM_PCT);
if (acct_max > SOFT_LIM_BYTES && acct_max - SOFT_LIM_BYTES > soft_limit) {
soft_limit = acct_max - SOFT_LIM_BYTES;
}
@@ -1140,9 +1140,9 @@ getinfo_helper_accounting(control_connection_t *conn,
*answer = tor_strdup(hibernate_state_to_string(hibernate_state));
tor_strlower(*answer);
} else if (!strcmp(question, "accounting/bytes")) {
- tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
- U64_PRINTF_ARG(n_bytes_read_in_interval),
- U64_PRINTF_ARG(n_bytes_written_in_interval));
+ tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+ (n_bytes_read_in_interval),
+ (n_bytes_written_in_interval));
} else if (!strcmp(question, "accounting/bytes-left")) {
uint64_t limit = get_options()->AccountingMax;
if (get_options()->AccountingRule == ACCT_SUM) {
@@ -1150,28 +1150,28 @@ getinfo_helper_accounting(control_connection_t *conn,
uint64_t total_bytes = get_accounting_bytes();
if (total_bytes < limit)
total_left = limit - total_bytes;
- tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
- U64_PRINTF_ARG(total_left), U64_PRINTF_ARG(total_left));
+ tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+ (total_left), (total_left));
} else if (get_options()->AccountingRule == ACCT_IN) {
uint64_t read_left = 0;
if (n_bytes_read_in_interval < limit)
read_left = limit - n_bytes_read_in_interval;
- tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
- U64_PRINTF_ARG(read_left), U64_PRINTF_ARG(limit));
+ tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+ (read_left), (limit));
} else if (get_options()->AccountingRule == ACCT_OUT) {
uint64_t write_left = 0;
if (n_bytes_written_in_interval < limit)
write_left = limit - n_bytes_written_in_interval;
- tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
- U64_PRINTF_ARG(limit), U64_PRINTF_ARG(write_left));
+ tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+ (limit), (write_left));
} else {
uint64_t read_left = 0, write_left = 0;
if (n_bytes_read_in_interval < limit)
read_left = limit - n_bytes_read_in_interval;
if (n_bytes_written_in_interval < limit)
write_left = limit - n_bytes_written_in_interval;
- tor_asprintf(answer, U64_FORMAT" "U64_FORMAT,
- U64_PRINTF_ARG(read_left), U64_PRINTF_ARG(write_left));
+ tor_asprintf(answer, "%"PRIu64" %"PRIu64,
+ (read_left), (write_left));
}
} else if (!strcmp(question, "accounting/interval-start")) {
*answer = tor_malloc(ISO_TIME_LEN+1);