Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / testing / selftests / bpf / bpf_sockopt_helpers.h
blob11f3a09761745dfe9587a7a0b1078194000e05ea
1 /* SPDX-License-Identifier: GPL-2.0 */
3 #include <sys/socket.h>
4 #include <bpf/bpf_helpers.h>
6 int get_set_sk_priority(void *ctx)
8 int prio;
10 /* Verify that context allows calling bpf_getsockopt and
11 * bpf_setsockopt by reading and writing back socket
12 * priority.
15 if (bpf_getsockopt(ctx, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
16 return 0;
17 if (bpf_setsockopt(ctx, SOL_SOCKET, SO_PRIORITY, &prio, sizeof(prio)))
18 return 0;
20 return 1;