Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
9568c0ce
Commit
9568c0ce
authored
Jul 03, 2018
by
Nick Mathewson
⛰
Browse files
Return U64_PRINTF_ARG and U64_FORMAT
The standard is printf("%"PRIu64, x);
parent
52884f56
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
src/lib/cc/compat_compiler.h
View file @
9568c0ce
...
...
@@ -188,11 +188,6 @@
#define MINGW_ANY
#endif
#define U64_PRINTF_ARG(a) ((uint64_t)a)
#define I64_PRINTF_ARG(a) ((int64_t)a)
#define U64_FORMAT "%"PRIu64
#define I64_FORMAT "%"PRId64
/** Macro: yield a pointer to the field at position <b>off</b> within the
* structure <b>st</b>. Example:
* <pre>
...
...
src/lib/time/tvdiff.c
View file @
9568c0ce
...
...
@@ -51,15 +51,15 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
/* Sanity check tv_usec */
if
(
start
->
tv_usec
>
TOR_USEC_PER_SEC
||
start
->
tv_usec
<
0
)
{
log_warn
(
LD_GENERAL
,
"comparing times on microsecond detail with bad "
"start tv_usec:
"
I64_FORMAT
" microseconds"
,
I64_PRINTF_ARG
(
start
->
tv_usec
));
"start tv_usec:
%"
PRId64
" microseconds"
,
(
start
->
tv_usec
));
return
LONG_MAX
;
}
if
(
end
->
tv_usec
>
TOR_USEC_PER_SEC
||
end
->
tv_usec
<
0
)
{
log_warn
(
LD_GENERAL
,
"comparing times on microsecond detail with bad "
"end tv_usec:
"
I64_FORMAT
" microseconds"
,
I64_PRINTF_ARG
(
end
->
tv_usec
));
"end tv_usec:
%"
PRId64
" microseconds"
,
(
end
->
tv_usec
));
return
LONG_MAX
;
}
...
...
@@ -72,7 +72,7 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
if
(
secdiff
>
(
int64_t
)(
LONG_MAX
/
1000000
-
1
)
||
secdiff
<
(
int64_t
)(
LONG_MIN
/
1000000
+
1
))
{
log_warn
(
LD_GENERAL
,
"comparing times on microsecond detail too far "
"apart:
"
I64_FORMAT
" seconds"
,
I64_PRINTF_ARG
(
secdiff
));
"apart:
%"
PRId64
" seconds"
,
(
secdiff
));
return
LONG_MAX
;
}
...
...
@@ -100,15 +100,15 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
/* Sanity check tv_usec */
if
(
start
->
tv_usec
>
TOR_USEC_PER_SEC
||
start
->
tv_usec
<
0
)
{
log_warn
(
LD_GENERAL
,
"comparing times on millisecond detail with bad "
"start tv_usec:
"
I64_FORMAT
" microseconds"
,
I64_PRINTF_ARG
(
start
->
tv_usec
));
"start tv_usec:
%"
PRId64
" microseconds"
,
(
start
->
tv_usec
));
return
LONG_MAX
;
}
if
(
end
->
tv_usec
>
TOR_USEC_PER_SEC
||
end
->
tv_usec
<
0
)
{
log_warn
(
LD_GENERAL
,
"comparing times on millisecond detail with bad "
"end tv_usec:
"
I64_FORMAT
" microseconds"
,
I64_PRINTF_ARG
(
end
->
tv_usec
));
"end tv_usec:
%"
PRId64
" microseconds"
,
(
end
->
tv_usec
));
return
LONG_MAX
;
}
...
...
@@ -124,7 +124,7 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
if
(
secdiff
>
(
int64_t
)(
LONG_MAX
/
1000
-
2
)
||
secdiff
<
(
int64_t
)(
LONG_MIN
/
1000
+
1
))
{
log_warn
(
LD_GENERAL
,
"comparing times on millisecond detail too far "
"apart:
"
I64_FORMAT
" seconds"
,
I64_PRINTF_ARG
(
secdiff
));
"apart:
%"
PRId64
" seconds"
,
(
secdiff
));
return
LONG_MAX
;
}
...
...
src/lib/wallclock/tm_cvt.c
View file @
9568c0ce
...
...
@@ -100,9 +100,9 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
/* LCOV_EXCL_STOP */
done:
if
(
err_out
)
{
tor_asprintf
(
err_out
,
"%s(
"
I64_FORMAT
") failed with error %s: %s"
,
tor_asprintf
(
err_out
,
"%s(
%"
PRId64
") failed with error %s: %s"
,
islocal
?
"localtime"
:
"gmtime"
,
timep
?
I64_PRINTF_ARG
(
*
timep
)
:
0
,
timep
?
(
*
timep
)
:
0
,
strerror
(
errno
),
outcome
);
}
...
...
src/or/channel.c
View file @
9568c0ce
This diff is collapsed.
Click to expand it.
src/or/channelpadding.c
View file @
9568c0ce
...
...
@@ -282,10 +282,10 @@ channelpadding_update_padding_for_channel(channel_t *chan,
pad_vars
->
ito_high_ms
);
log_fn
(
LOG_INFO
,
LD_OR
,
"Negotiated padding=%d, lo=%d, hi=%d on
"
U64_FORMAT
,
"Negotiated padding=%d, lo=%d, hi=%d on
%"
PRIu64
,
chan
->
padding_enabled
,
chan
->
padding_timeout_low_ms
,
chan
->
padding_timeout_high_ms
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
(
chan
->
global_identifier
));
return
1
;
}
...
...
@@ -393,13 +393,13 @@ channelpadding_send_padding_cell_for_callback(channel_t *chan)
monotime_coarse_get
(
&
now
);
log_fn
(
LOG_INFO
,
LD_OR
,
"Sending netflow keepalive on
"
U64_FORMAT
" to %s (%s) after "
I64_FORMAT
" ms. Delta
"
I64_FORMAT
"ms"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
"Sending netflow keepalive on
%"
PRIu64
" to %s (%s) after "
"%"
PRId64
" ms. Delta
%"
PRId64
"ms"
,
(
chan
->
global_identifier
),
safe_str_client
(
chan
->
get_remote_descr
(
chan
,
0
)),
safe_str_client
(
hex_str
(
chan
->
identity_digest
,
DIGEST_LEN
)),
I64_PRINTF_ARG
(
monotime_coarse_diff_msec
(
&
chan
->
timestamp_xfer
,
&
now
)),
I64_PRINTF_ARG
(
(
monotime_coarse_diff_msec
(
&
chan
->
timestamp_xfer
,
&
now
)),
(
monotime_coarse_diff_msec
(
&
chan
->
next_padding_time
,
&
now
)));
}
...
...
@@ -539,9 +539,9 @@ channelpadding_compute_time_until_pad_for_netflow(channel_t *chan)
if
(
ms_till_pad
>
DFLT_NETFLOW_INACTIVE_KEEPALIVE_MAX
)
{
tor_fragile_assert
();
log_warn
(
LD_BUG
,
"Channel padding timeout scheduled
"
I64_FORMAT
"ms in the future. "
"Channel padding timeout scheduled
%"
PRId64
"ms in the future. "
"Did the monotonic clock just jump?"
,
I64_PRINTF_ARG
(
ms_till_pad
));
(
ms_till_pad
));
return
0
;
/* Clock jumped: Send padding now */
}
...
...
@@ -565,8 +565,8 @@ channelpadding_compute_time_until_pad_for_netflow(channel_t *chan)
int
severity
=
(
ms_till_pad
<
-
NETFLOW_MISSED_WINDOW
)
?
LOG_NOTICE
:
LOG_INFO
;
log_fn
(
severity
,
LD_OR
,
"Channel padding timeout scheduled
"
I64_FORMAT
"ms in the past. "
,
I64_PRINTF_ARG
(
-
ms_till_pad
));
"Channel padding timeout scheduled
%"
PRId64
"ms in the past. "
,
(
-
ms_till_pad
));
return
0
;
/* Clock jumped: Send padding now */
}
...
...
@@ -697,8 +697,8 @@ channelpadding_reduce_padding_on_channel(channel_t *chan)
chan
->
padding_timeout_high_ms
=
consensus_nf_ito_high_reduced
;
log_fn
(
LOG_INFO
,
LD_OR
,
"Reduced padding on channel
"
U64_FORMAT
": lo=%d, hi=%d"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
"Reduced padding on channel
%"
PRIu64
": lo=%d, hi=%d"
,
(
chan
->
global_identifier
),
chan
->
padding_timeout_low_ms
,
chan
->
padding_timeout_high_ms
);
}
...
...
src/or/channeltls.c
View file @
9568c0ce
...
...
@@ -192,19 +192,19 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
log_debug
(
LD_CHANNEL
,
"In channel_tls_connect() for channel %p "
"(global id
"
U64_FORMAT
")"
,
"(global id
%"
PRIu64
")"
,
tlschan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
(
chan
->
global_identifier
));
if
(
is_local_addr
(
addr
))
{
log_debug
(
LD_CHANNEL
,
"Marking new outgoing channel
"
U64_FORMAT
" at %p as local"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
"Marking new outgoing channel
%"
PRIu64
" at %p as local"
,
(
chan
->
global_identifier
),
chan
);
channel_mark_local
(
chan
);
}
else
{
log_debug
(
LD_CHANNEL
,
"Marking new outgoing channel
"
U64_FORMAT
" at %p as remote"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
"Marking new outgoing channel
%"
PRIu64
" at %p as remote"
,
(
chan
->
global_identifier
),
chan
);
channel_mark_remote
(
chan
);
}
...
...
@@ -220,8 +220,8 @@ channel_tls_connect(const tor_addr_t *addr, uint16_t port,
}
log_debug
(
LD_CHANNEL
,
"Got orconn %p for channel with global id
"
U64_FORMAT
,
tlschan
->
conn
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"Got orconn %p for channel with global id
%"
PRIu64
,
tlschan
->
conn
,
(
chan
->
global_identifier
));
goto
done
;
...
...
@@ -271,8 +271,8 @@ channel_tls_start_listener(void)
channel_tls_listener
=
listener
;
log_debug
(
LD_CHANNEL
,
"Starting TLS channel listener %p with global id
"
U64_FORMAT
,
listener
,
U64_PRINTF_ARG
(
listener
->
global_identifier
));
"Starting TLS channel listener %p with global id
%"
PRIu64
,
listener
,
(
listener
->
global_identifier
));
channel_listener_register
(
listener
);
}
else
listener
=
channel_tls_listener
;
...
...
@@ -301,9 +301,9 @@ channel_tls_free_all(void)
*/
old_listener
=
channel_tls_listener
;
log_debug
(
LD_CHANNEL
,
"Closing channel_tls_listener with ID
"
U64_FORMAT
"Closing channel_tls_listener with ID
%"
PRIu64
" at %p."
,
U64_PRINTF_ARG
(
old_listener
->
global_identifier
),
(
old_listener
->
global_identifier
),
old_listener
);
channel_listener_unregister
(
old_listener
);
channel_listener_mark_for_close
(
old_listener
);
...
...
@@ -335,13 +335,13 @@ channel_tls_handle_incoming(or_connection_t *orconn)
if
(
is_local_addr
(
&
(
TO_CONN
(
orconn
)
->
addr
)))
{
log_debug
(
LD_CHANNEL
,
"Marking new incoming channel
"
U64_FORMAT
" at %p as local"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
"Marking new incoming channel
%"
PRIu64
" at %p as local"
,
(
chan
->
global_identifier
),
chan
);
channel_mark_local
(
chan
);
}
else
{
log_debug
(
LD_CHANNEL
,
"Marking new incoming channel
"
U64_FORMAT
" at %p as remote"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
"Marking new incoming channel
%"
PRIu64
" at %p as remote"
,
(
chan
->
global_identifier
),
chan
);
channel_mark_remote
(
chan
);
}
...
...
@@ -431,8 +431,8 @@ channel_tls_describe_transport_method(channel_t *chan)
if
(
buf
)
tor_free
(
buf
);
tor_asprintf
(
&
buf
,
"TLS channel (connection
"
U64_FORMAT
")"
,
U64_PRINTF_ARG
(
id
));
"TLS channel (connection
%"
PRIu64
")"
,
(
id
));
rv
=
buf
;
}
else
{
...
...
@@ -493,8 +493,8 @@ channel_tls_get_overhead_estimate_method(channel_t *chan)
}
log_debug
(
LD_CHANNEL
,
"Estimated overhead ratio for TLS chan
"
U64_FORMAT
" is %f"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
overhead
);
"Estimated overhead ratio for TLS chan
%"
PRIu64
" is %f"
,
(
chan
->
global_identifier
),
overhead
);
return
overhead
;
}
...
...
@@ -625,8 +625,8 @@ channel_tls_has_queued_writes_method(channel_t *chan)
if
(
!
(
tlschan
->
conn
))
{
log_info
(
LD_CHANNEL
,
"something called has_queued_writes on a tlschan "
"(%p with ID
"
U64_FORMAT
" but no conn"
,
chan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"(%p with ID
%"
PRIu64
" but no conn"
,
chan
,
(
chan
->
global_identifier
));
}
outbuf_len
=
(
tlschan
->
conn
!=
NULL
)
?
...
...
@@ -693,8 +693,8 @@ channel_tls_matches_extend_info_method(channel_t *chan,
if
(
!
(
tlschan
->
conn
))
{
log_info
(
LD_CHANNEL
,
"something called matches_extend_info on a tlschan "
"(%p with ID
"
U64_FORMAT
" but no conn"
,
chan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"(%p with ID
%"
PRIu64
" but no conn"
,
chan
,
(
chan
->
global_identifier
));
return
0
;
}
...
...
@@ -723,8 +723,8 @@ channel_tls_matches_target_method(channel_t *chan,
if
(
!
(
tlschan
->
conn
))
{
log_info
(
LD_CHANNEL
,
"something called matches_target on a tlschan "
"(%p with ID
"
U64_FORMAT
" but no conn"
,
chan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"(%p with ID
%"
PRIu64
" but no conn"
,
chan
,
(
chan
->
global_identifier
));
return
0
;
}
...
...
@@ -806,8 +806,8 @@ channel_tls_write_cell_method(channel_t *chan, cell_t *cell)
}
else
{
log_info
(
LD_CHANNEL
,
"something called write_cell on a tlschan "
"(%p with ID
"
U64_FORMAT
" but no conn"
,
chan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"(%p with ID
%"
PRIu64
" but no conn"
,
chan
,
(
chan
->
global_identifier
));
}
return
written
;
...
...
@@ -839,8 +839,8 @@ channel_tls_write_packed_cell_method(channel_t *chan,
}
else
{
log_info
(
LD_CHANNEL
,
"something called write_packed_cell on a tlschan "
"(%p with ID
"
U64_FORMAT
" but no conn"
,
chan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"(%p with ID
%"
PRIu64
" but no conn"
,
chan
,
(
chan
->
global_identifier
));
return
-
1
;
}
...
...
@@ -868,8 +868,8 @@ channel_tls_write_var_cell_method(channel_t *chan, var_cell_t *var_cell)
}
else
{
log_info
(
LD_CHANNEL
,
"something called write_var_cell on a tlschan "
"(%p with ID
"
U64_FORMAT
" but no conn"
,
chan
,
U64_PRINTF_ARG
(
chan
->
global_identifier
));
"(%p with ID
%"
PRIu64
" but no conn"
,
chan
,
(
chan
->
global_identifier
));
}
return
written
;
...
...
@@ -1341,15 +1341,15 @@ channel_tls_update_marks(or_connection_t *conn)
if
(
is_local_addr
(
&
(
TO_CONN
(
conn
)
->
addr
)))
{
if
(
!
channel_is_local
(
chan
))
{
log_debug
(
LD_CHANNEL
,
"Marking channel
"
U64_FORMAT
" at %p as local"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
"Marking channel
%"
PRIu64
" at %p as local"
,
(
chan
->
global_identifier
),
chan
);
channel_mark_local
(
chan
);
}
}
else
{
if
(
channel_is_local
(
chan
))
{
log_debug
(
LD_CHANNEL
,
"Marking channel
"
U64_FORMAT
" at %p as remote"
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
"Marking channel
%"
PRIu64
" at %p as remote"
,
(
chan
->
global_identifier
),
chan
);
channel_mark_remote
(
chan
);
}
}
...
...
src/or/circuitbuild.c
View file @
9568c0ce
...
...
@@ -202,11 +202,11 @@ get_unique_circ_id_by_chan(channel_t *chan)
chan
->
cmux
);
log_warn
(
LD_CIRC
,
" Circuitmux on this channel has %u circuits, "
"of which %u are active. It says it has
"
I64_FORMAT
"of which %u are active. It says it has
%"
PRId64
" destroy cells queued."
,
circuitmux_num_circuits
(
chan
->
cmux
),
circuitmux_num_active_circuits
(
chan
->
cmux
),
I64_PRINTF_ARG
(
queued_destroys
));
(
queued_destroys
));
/* Change this into "if (1)" in order to get more information about
* possible failure modes here. You'll need to know how to use gdb with
...
...
@@ -1150,20 +1150,20 @@ circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle)
{
int
severity
=
server_mode
(
get_options
())
?
LOG_WARN
:
LOG_NOTICE
;
if
(
was_idle
)
{
tor_log
(
severity
,
LD_GENERAL
,
"Tor has been idle for
"
I64_FORMAT
tor_log
(
severity
,
LD_GENERAL
,
"Tor has been idle for
%"
PRId64
" seconds; assuming established circuits no longer work."
,
I64_PRINTF_ARG
(
seconds_elapsed
));
(
seconds_elapsed
));
}
else
{
tor_log
(
severity
,
LD_GENERAL
,
"Your system clock just jumped
"
I64_FORMAT
" seconds %s; "
"Your system clock just jumped
%"
PRId64
" seconds %s; "
"assuming established circuits no longer work."
,
I64_PRINTF_ARG
(
(
seconds_elapsed
>=
0
?
seconds_elapsed
:
-
seconds_elapsed
),
seconds_elapsed
>=
0
?
"forward"
:
"backward"
);
}
control_event_general_status
(
LOG_WARN
,
"CLOCK_JUMPED TIME=
"
I64_FORMAT
control_event_general_status
(
LOG_WARN
,
"CLOCK_JUMPED TIME=
%"
PRId64
" IDLE=%d"
,
I64_PRINTF_ARG
(
seconds_elapsed
),
was_idle
?
1
:
0
);
(
seconds_elapsed
),
was_idle
?
1
:
0
);
/* so we log when it works again */
note_that_we_maybe_cant_complete_circuits
();
control_event_client_status
(
severity
,
"CIRCUIT_NOT_ESTABLISHED REASON=%s"
,
...
...
src/or/circuitlist.c
View file @
9568c0ce
...
...
@@ -1000,9 +1000,9 @@ origin_circuit_new(void)
}
log_info
(
LD_CIRC
,
"Circuit
"
U64_FORMAT
" chose an idle timeout of %d based on "
"Circuit
%"
PRIu32
" chose an idle timeout of %d based on "
"%d seconds of predictive building remaining."
,
U64_PRINTF_ARG
(
circ
->
global_identifier
),
(
circ
->
global_identifier
),
circ
->
circuit_idle_timeout
,
prediction_time_remaining
);
}
...
...
@@ -1389,9 +1389,9 @@ circuit_get_by_circid_channel_impl(circid_t circ_id, channel_t *chan,
if
(
found
&&
found
->
circuit
)
{
log_debug
(
LD_CIRC
,
"circuit_get_by_circid_channel_impl() returning circuit %p for"
" circ_id %u, channel ID
"
U64_FORMAT
" (%p)"
,
" circ_id %u, channel ID
%"
PRIu64
" (%p)"
,
found
->
circuit
,
(
unsigned
)
circ_id
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
(
chan
->
global_identifier
),
chan
);
if
(
found_entry_out
)
*
found_entry_out
=
1
;
return
found
->
circuit
;
...
...
@@ -1399,10 +1399,10 @@ circuit_get_by_circid_channel_impl(circid_t circ_id, channel_t *chan,
log_debug
(
LD_CIRC
,
"circuit_get_by_circid_channel_impl() found %s for"
" circ_id %u, channel ID
"
U64_FORMAT
" (%p)"
,
" circ_id %u, channel ID
%"
PRIu64
" (%p)"
,
found
?
"placeholder"
:
"nothing"
,
(
unsigned
)
circ_id
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
(
chan
->
global_identifier
),
chan
);
if
(
found_entry_out
)
*
found_entry_out
=
found
?
1
:
0
;
...
...
@@ -2601,10 +2601,10 @@ circuits_handle_oom(size_t current_allocation)
done_recovering_mem:
log_notice
(
LD_GENERAL
,
"Removed
"
U64_FORMAT
" bytes by killing %d circuits; "
log_notice
(
LD_GENERAL
,
"Removed
%"
PRIu64
" bytes by killing %d circuits; "
"%d circuits remain alive. Also killed %d non-linked directory "
"connections."
,
U64_PRINTF_ARG
(
mem_recovered
),
(
mem_recovered
),
n_circuits_killed
,
smartlist_len
(
circlist
)
-
n_circuits_killed
,
n_dirconns_killed
);
...
...
@@ -2737,4 +2737,3 @@ assert_circuit_ok,(const circuit_t *c))
tor_assert
(
!
or_circ
||
!
or_circ
->
rend_splice
);
}
}
src/or/circuitmux.c
View file @
9568c0ce
...
...
@@ -320,10 +320,10 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
}
else
{
/* Complain and move on */
log_warn
(
LD_CIRC
,
"Circuit %u/channel
"
U64_FORMAT
" had direction == "
"Circuit %u/channel
%"
PRIu64
" had direction == "
"CELL_DIRECTION_IN, but isn't an or_circuit_t"
,
(
unsigned
)
to_remove
->
circ_id
,
U64_PRINTF_ARG
(
to_remove
->
chan_id
));
(
to_remove
->
chan_id
));
}
/* Free policy-specific data if we have it */
...
...
@@ -344,15 +344,15 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux, smartlist_t *detached_out)
}
else
{
/* Complain and move on */
log_warn
(
LD_CIRC
,
"Couldn't find circuit %u (for channel
"
U64_FORMAT
")"
,
"Couldn't find circuit %u (for channel
%"
PRIu64
")"
,
(
unsigned
)
to_remove
->
circ_id
,
U64_PRINTF_ARG
(
to_remove
->
chan_id
));
(
to_remove
->
chan_id
));
}
}
else
{
/* Complain and move on */
log_warn
(
LD_CIRC
,
"Couldn't find channel
"
U64_FORMAT
" (for circuit id %u)"
,
U64_PRINTF_ARG
(
to_remove
->
chan_id
),
"Couldn't find channel
%"
PRIu64
" (for circuit id %u)"
,
(
to_remove
->
chan_id
),
(
unsigned
)
to_remove
->
circ_id
);
}
...
...
@@ -428,17 +428,17 @@ circuitmux_free_(circuitmux_t *cmux)
global_destroy_ctr
-=
cmux
->
destroy_cell_queue
.
n
;
log_debug
(
LD_CIRC
,
"Freeing cmux at %p with %u queued destroys; the last cmux "
"destroy balance was
"
I64_FORMAT
", global is
"
I64_FORMAT
,
"destroy balance was
%"
PRId64
", global is
%"
PRId64
,
cmux
,
cmux
->
destroy_cell_queue
.
n
,
I64_PRINTF_ARG
(
cmux
->
destroy_ctr
),
I64_PRINTF_ARG
(
global_destroy_ctr
));
(
cmux
->
destroy_ctr
),
(
global_destroy_ctr
));
}
else
{
log_debug
(
LD_CIRC
,
"Freeing cmux at %p with no queued destroys, the cmux destroy "
"balance was
"
I64_FORMAT
", global is
"
I64_FORMAT
,
"balance was
%"
PRId64
", global is
%"
PRId64
,
cmux
,
I64_PRINTF_ARG
(
cmux
->
destroy_ctr
),
I64_PRINTF_ARG
(
global_destroy_ctr
));
(
cmux
->
destroy_ctr
),
(
global_destroy_ctr
));
}
destroy_cell_queue_clear
(
&
cmux
->
destroy_cell_queue
);
...
...
@@ -835,9 +835,9 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
* directions match and update the cell count and active circuit count.
*/
log_info
(
LD_CIRC
,
"Circuit %u on channel
"
U64_FORMAT
" was already attached to "
"Circuit %u on channel
%"
PRIu64
" was already attached to "
"cmux %p (trying to attach to %p)"
,
(
unsigned
)
circ_id
,
U64_PRINTF_ARG
(
channel_id
),
(
unsigned
)
circ_id
,
(
channel_id
),
((
direction
==
CELL_DIRECTION_OUT
)
?
circ
->
n_mux
:
TO_OR_CIRCUIT
(
circ
)
->
p_mux
),
cmux
);
...
...
@@ -869,8 +869,8 @@ circuitmux_attach_circuit,(circuitmux_t *cmux, circuit_t *circ,
* counts.
*/
log_debug
(
LD_CIRC
,
"Attaching circuit %u on channel
"
U64_FORMAT
" to cmux %p"
,
(
unsigned
)
circ_id
,
U64_PRINTF_ARG
(
channel_id
),
cmux
);
"Attaching circuit %u on channel
%"
PRIu64
" to cmux %p"
,
(
unsigned
)
circ_id
,
(
channel_id
),
cmux
);
/*
* Assert that the circuit doesn't already have a mux for this
...
...
@@ -1241,11 +1241,11 @@ circuitmux_notify_xmit_destroy(circuitmux_t *cmux)
--
(
cmux
->
destroy_ctr
);
--
(
global_destroy_ctr
);
log_debug
(
LD_CIRC
,
"Cmux at %p sent a destroy, cmux counter is now
"
I64_FORMAT
", "
"global counter is now
"
I64_FORMAT
,
"Cmux at %p sent a destroy, cmux counter is now
%"
PRId64
", "
"global counter is now
%"
PRId64
,
cmux
,
I64_PRINTF_ARG
(
cmux
->
destroy_ctr
),
I64_PRINTF_ARG
(
global_destroy_ctr
));
(
cmux
->
destroy_ctr
),
(
global_destroy_ctr
));
}
/*DOCDOC */
...
...
@@ -1262,10 +1262,10 @@ circuitmux_append_destroy_cell(channel_t *chan,
++
global_destroy_ctr
;
log_debug
(
LD_CIRC
,
"Cmux at %p queued a destroy for circ %u, cmux counter is now "
I64_FORMAT
", global counter is now
"
I64_FORMAT
,
"%"
PRId64
", global counter is now
%"
PRId64
,
cmux
,
circ_id
,
I64_PRINTF_ARG
(
cmux
->
destroy_ctr
),
I64_PRINTF_ARG
(
global_destroy_ctr
));
(
cmux
->
destroy_ctr
),
(
global_destroy_ctr
));
/* XXXX Duplicate code from append_cell_to_circuit_queue */
if
(
!
channel_has_queued_writes
(
chan
))
{
...
...
@@ -1303,12 +1303,12 @@ circuitmux_count_queued_destroy_cells(const channel_t *chan,
n_destroy_cells
!=
manual_total
||
n_destroy_cells
!=
manual_total_in_map
)
{
log_warn
(
LD_BUG
,
" Discrepancy in counts for queued destroy cells on "
"circuitmux. n=
"
I64_FORMAT
". queue_size=
"
I64_FORMAT
". "
"manual_total=
"
I64_FORMAT
". manual_total_in_map=
"
I64_FORMAT
"."
,
I64_PRINTF_ARG
(
n_destroy_cells
),
I64_PRINTF_ARG
(
destroy_queue_size
),
I64_PRINTF_ARG
(
manual_total
),
I64_PRINTF_ARG
(
manual_total_in_map
));
"circuitmux. n=
%"
PRId64
". queue_size=
%"
PRId64
". "
"manual_total=
%"
PRId64
". manual_total_in_map=
%"
PRId64
"."
,
(
n_destroy_cells
),
(
destroy_queue_size
),
(
manual_total
),
(
manual_total_in_map
));
}
return
n_destroy_cells
;
...
...
src/or/circuitstats.c
View file @
9568c0ce
...
...
@@ -711,8 +711,8 @@ circuit_build_times_handle_completed_hop(origin_circuit_t *circ)
* Switch their purpose and wait. */
if
(
circ
->
base_
.
purpose
!=
CIRCUIT_PURPOSE_C_MEASURE_TIMEOUT
)
{
log_info
(
LD_CIRC
,
"Deciding to timeout circuit
"
U64_FORMAT
"
\n
"
,
U64_PRINTF_ARG
(
circ
->
global_identifier
));
"Deciding to timeout circuit
%"
PRIu32
"
\n
"
,
(
circ
->
global_identifier
));
circuit_build_times_mark_circ_as_measurement_only
(
circ
);
}
}
...
...
src/or/circuituse.c
View file @
9568c0ce
...
...
@@ -719,9 +719,8 @@ circuit_expire_building(void)
circuit_build_times_enough_to_compute
(
get_circuit_build_times
()))
{
log_info
(
LD_CIRC
,
"Deciding to count the timeout for circuit "
U64_FORMAT
"
\n
"
,
U64_PRINTF_ARG
(
TO_ORIGIN_CIRCUIT
(
victim
)
->
global_identifier
));
"Deciding to count the timeout for circuit %"
PRIu32
"
\n
"
,
TO_ORIGIN_CIRCUIT
(
victim
)
->
global_identifier
);
/* Circuits are allowed to last longer for measurement.
* Switch their purpose and wait. */
...
...
@@ -1510,10 +1509,10 @@ circuit_expire_old_circuits_clientside(void)
circ
->
purpose
<=
CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED
)
||
circ
->
purpose
==
CIRCUIT_PURPOSE_S_CONNECT_REND
)
{
log_info
(
LD_CIRC
,
"Closing circuit
"
U64_FORMAT
"Closing circuit
%"
PRIu32
" that has been unused for %ld msec."
,
U64_PRINTF_ARG
(
TO_ORIGIN_CIRCUIT
(
circ
)
->
global_identifier
)
,
tv_mdiff
(
&
circ
->
timestamp_began
,
&
now
));
TO_ORIGIN_CIRCUIT
(
circ
)
->
global_identifier
,
tv_mdiff
(
&
circ
->
timestamp_began
,
&
now
));
circuit_mark_for_close
(
circ
,
END_CIRC_REASON_FINISHED
);
}
else
if
(
!
TO_ORIGIN_CIRCUIT
(
circ
)
->
is_ancient
)
{
/* Server-side rend joined circuits can end up really old, because
...
...
src/or/command.c
View file @
9568c0ce
...
...
@@ -249,10 +249,10 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
tor_assert
(
chan
);
log_debug
(
LD_OR
,
"Got a CREATE cell for circ_id %u on channel
"
U64_FORMAT
"Got a CREATE cell for circ_id %u on channel
%"
PRIu64
" (%p)"
,
(
unsigned
)
cell
->
circ_id
,
U64_PRINTF_ARG
(
chan
->
global_identifier
),
chan
);
(
chan
->
global_identifier
),
chan
);
/* First thing we do, even though the cell might be invalid, is inform the
* DoS mitigation subsystem layer of this event. Validation is done by this
...
...
src/or/config.c
View file @
9568c0ce
...
...
@@ -3047,8 +3047,8 @@ ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
--*
value
;
}
if
(
*
value
>
ROUTER_MAX_DECLARED_BANDWIDTH
)
{
tor_asprintf
(
msg
,
"%s (
"
U64_FORMAT
") must be at most %d"
,
desc
,
U64_PRINTF_ARG
(
*
value
),
tor_asprintf
(
msg
,
"%s (
%"
PRIu64
") must be at most %d"
,
desc
,
(
*
value
),
ROUTER_MAX_DECLARED_BANDWIDTH
);
return
-
1
;
}
...
...
@@ -4636,10 +4636,10 @@ compute_real_max_mem_in_queues(const uint64_t val, int log_guess)
}
}
if
(
log_guess
&&
!
notice_sent
)
{
log_notice
(
LD_CONFIG
,
"%sMaxMemInQueues is set to
"
U64_FORMAT
" MB. "
log_notice
(
LD_CONFIG
,
"%sMaxMemInQueues is set to
%"
PRIu64
" MB. "
"You can override this by setting MaxMemInQue