compat: add new macro definition

Signed-off-by: Tonghao Zhang <tonghao@bamaicloud.com>
This commit is contained in:
Tonghao Zhang 2025-07-06 09:12:19 -04:00
parent 43964c0387
commit 67aa0490de
2 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,9 @@
#define PERF_MAX_STACK_DEPTH 127
#define PERF_MIN_STACK_DEPTH 16
/* flags for both BPF_FUNC_get_stackid and BPF_FUNC_get_stack. */
#define COMPAT_BPF_F_USER_STACK 256
/* flags for BPF_MAP_UPDATE_ELEM command */
#define COMPAT_BPF_ANY 0 /* create new element or update existing */
#define COMPAT_BPF_NOEXIST 1 /* create new element if it didn't exist */

View File

@ -105,7 +105,7 @@ bpf_ratelimited_core_in_map(void *ctx, void *map, void *perf_map,
// the threshold/max_burst is exceeded, notify once in a cycle
if (old_nmissed == 0 || (rate->max_burst > 0 &&
rate->nmissed > rate->max_burst - rate->burst))
bpf_perf_event_output(ctx, perf_map, BPF_F_CURRENT_CPU, rate,
bpf_perf_event_output(ctx, perf_map, COMPAT_BPF_F_CURRENT_CPU, rate,
sizeof(struct bpf_ratelimit));
return true;
}