File Index
Files and directories
Sign in
FILE

cgroup_preorder.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/progs/cgroup_preorder.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
 3#include <vmlinux.h>
 4#include <bpf/bpf_helpers.h>
 5
 6char _license[] SEC("license") = "GPL";
 7
 8unsigned int idx;
 9__u8 result[4];
10
11SEC("cgroup/getsockopt")
12int child(struct bpf_sockopt *ctx)
13{
14	if (idx < 4)
15		result[idx++] = 1;
16	return 1;
17}
18
19SEC("cgroup/getsockopt")
20int child_2(struct bpf_sockopt *ctx)
21{
22	if (idx < 4)
23		result[idx++] = 2;
24	return 1;
25}
26
27SEC("cgroup/getsockopt")
28int parent(struct bpf_sockopt *ctx)
29{
30	if (idx < 4)
31		result[idx++] = 3;
32	return 1;
33}
34
35SEC("cgroup/getsockopt")
36int parent_2(struct bpf_sockopt *ctx)
37{
38	if (idx < 4)
39		result[idx++] = 4;
40	return 1;
41}
~/ Read-only file preview.