File Index
Files and directories
Sign in
FILE

bpf_sockopt_helpers.h

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/bpf_sockopt_helpers.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2
 3#include <sys/socket.h>
 4#include <bpf/bpf_helpers.h>
 5
 6int get_set_sk_priority(void *ctx)
 7{
 8	int prio;
 9
10	/* Verify that context allows calling bpf_getsockopt and
11	 * bpf_setsockopt by reading and writing back socket
12	 * priority.
13	 */
14
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;
19
20	return 1;
21}
~/ Read-only file preview.