tools/testing/selftests/bpf/progs/test_skeleton.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_skeleton.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_skeleton.c- Extension
.c- Size
- 1906 bytes
- Lines
- 99
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hlinux/bpf.hbpf/bpf_helpers.h
Detected Declarations
struct sstruct my_valuefunction handler
Annotated Snippet
struct s {
int a;
long long b;
} __attribute__((packed));
/* .data section */
int in1 = -1;
long long in2 = -1;
/* .bss section */
char in3 = '\0';
long long in4 __attribute__((aligned(64))) = 0;
struct s in5 = {};
/* .rodata section */
const volatile struct {
const int in6;
} in = {};
/* .data section */
int out1 = -1;
long long out2 = -1;
/* .bss section */
char out3 = 0;
long long out4 = 0;
int out6 = 0;
extern bool CONFIG_BPF_SYSCALL __kconfig;
extern int LINUX_KERNEL_VERSION __kconfig;
bool bpf_syscall = 0;
int kern_ver = 0;
struct s out5 = {};
const volatile int in_dynarr_sz SEC(".rodata.dyn");
const volatile int in_dynarr[4] SEC(".rodata.dyn") = { -1, -2, -3, -4 };
int out_dynarr[4] SEC(".data.dyn") = { 1, 2, 3, 4 };
int read_mostly_var __read_mostly;
int out_mostly_var;
char huge_arr[16 * 1024 * 1024];
/* non-mmapable custom .data section */
struct my_value { int x, y, z; };
__hidden int zero_key SEC(".data.non_mmapable");
static struct my_value zero_value SEC(".data.non_mmapable");
struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__type(key, int);
__type(value, struct my_value);
__uint(max_entries, 1);
} my_map SEC(".maps");
SEC("raw_tp/sys_enter")
int handler(const void *ctx)
{
int i;
out1 = in1;
out2 = in2;
out3 = in3;
out4 = in4;
out5 = in5;
out6 = in.in6;
bpf_syscall = CONFIG_BPF_SYSCALL;
kern_ver = LINUX_KERNEL_VERSION;
for (i = 0; i < in_dynarr_sz; i++)
out_dynarr[i] = in_dynarr[i];
out_mostly_var = read_mostly_var;
huge_arr[sizeof(huge_arr) - 1] = 123;
/* make sure zero_key and zero_value are not optimized out */
bpf_map_update_elem(&my_map, &zero_key, &zero_value, BPF_ANY);
return 0;
}
char _license[] SEC("license") = "GPL";
Annotation
- Immediate include surface: `stdbool.h`, `linux/bpf.h`, `bpf/bpf_helpers.h`.
- Detected declarations: `struct s`, `struct my_value`, `function handler`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.