Skip to content

Commit f93f0c9

Browse files
0xB10Cluke-jr
authored andcommitted
tracing: Rename the MIN macro to _TRACEPOINT_TEST_MIN in log_raw_p2p_msgs
Inspired by: 00c1dbd (bitcoin#31419)
1 parent 30308cc commit f93f0c9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/tracing/log_raw_p2p_msgs.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
program = """
4242
#include <uapi/linux/ptrace.h>
4343
44-
#define MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
44+
// A min() macro. Prefixed with _TRACEPOINT_TEST to avoid collision with other MIN macros.
45+
#define _TRACEPOINT_TEST_MIN(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
4546
4647
// Maximum possible allocation size
4748
// from include/linux/percpu.h in the Linux kernel
@@ -88,7 +89,7 @@
8889
bpf_usdt_readarg_p(3, ctx, &msg->peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH);
8990
bpf_usdt_readarg_p(4, ctx, &msg->msg_type, MAX_MSG_TYPE_LENGTH);
9091
bpf_usdt_readarg(5, ctx, &msg->msg_size);
91-
bpf_usdt_readarg_p(6, ctx, &msg->msg, MIN(msg->msg_size, MAX_MSG_DATA_LENGTH));
92+
bpf_usdt_readarg_p(6, ctx, &msg->msg, _TRACEPOINT_TEST_MIN(msg->msg_size, MAX_MSG_DATA_LENGTH));
9293
9394
inbound_messages.perf_submit(ctx, msg, sizeof(*msg));
9495
return 0;
@@ -108,7 +109,7 @@
108109
bpf_usdt_readarg_p(3, ctx, &msg->peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH);
109110
bpf_usdt_readarg_p(4, ctx, &msg->msg_type, MAX_MSG_TYPE_LENGTH);
110111
bpf_usdt_readarg(5, ctx, &msg->msg_size);
111-
bpf_usdt_readarg_p(6, ctx, &msg->msg, MIN(msg->msg_size, MAX_MSG_DATA_LENGTH));
112+
bpf_usdt_readarg_p(6, ctx, &msg->msg, _TRACEPOINT_TEST_MIN(msg->msg_size, MAX_MSG_DATA_LENGTH));
112113
113114
outbound_messages.perf_submit(ctx, msg, sizeof(*msg));
114115
return 0;

0 commit comments

Comments
 (0)