|
41 | 41 | program = """ |
42 | 42 | #include <uapi/linux/ptrace.h> |
43 | 43 |
|
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; }) |
45 | 46 |
|
46 | 47 | // Maximum possible allocation size |
47 | 48 | // from include/linux/percpu.h in the Linux kernel |
|
88 | 89 | bpf_usdt_readarg_p(3, ctx, &msg->peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH); |
89 | 90 | bpf_usdt_readarg_p(4, ctx, &msg->msg_type, MAX_MSG_TYPE_LENGTH); |
90 | 91 | 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)); |
92 | 93 |
|
93 | 94 | inbound_messages.perf_submit(ctx, msg, sizeof(*msg)); |
94 | 95 | return 0; |
|
108 | 109 | bpf_usdt_readarg_p(3, ctx, &msg->peer_conn_type, MAX_PEER_CONN_TYPE_LENGTH); |
109 | 110 | bpf_usdt_readarg_p(4, ctx, &msg->msg_type, MAX_MSG_TYPE_LENGTH); |
110 | 111 | 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)); |
112 | 113 |
|
113 | 114 | outbound_messages.perf_submit(ctx, msg, sizeof(*msg)); |
114 | 115 | return 0; |
|
0 commit comments