xref: /linux/tools/testing/selftests/bpf/progs/cgroup_getset_retval_hooks.c (revision ae22a94997b8a03dcb3c922857c203246711f9d4)
1 // SPDX-License-Identifier: GPL-2.0-only
2 
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 #define BPF_RETVAL_HOOK(name, section, ctx, expected_err) \
7 	__attribute__((__section__("?" section))) \
8 	int name(struct ctx *_ctx) \
9 	{ \
10 		bpf_set_retval(bpf_get_retval()); \
11 		return 1; \
12 	}
13 
14 #include "cgroup_getset_retval_hooks.h"
15 
16 #undef BPF_RETVAL_HOOK
17