tools/testing/selftests/bpf/progs/test_core_read_macros.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_core_read_macros.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_core_read_macros.c- Extension
.c- Size
- 1328 bytes
- Lines
- 51
- 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
vmlinux.hbpf/bpf_helpers.hbpf/bpf_core_read.h
Detected Declarations
struct callback_head___shuffledfunction handler
Annotated Snippet
struct callback_head___shuffled {
void (*func)(struct callback_head___shuffled *head);
struct callback_head___shuffled *next;
};
struct callback_head k_probe_in = {};
struct callback_head___shuffled k_core_in = {};
struct callback_head *u_probe_in = 0;
struct callback_head___shuffled *u_core_in = 0;
long k_probe_out = 0;
long u_probe_out = 0;
long k_core_out = 0;
long u_core_out = 0;
int my_pid = 0;
SEC("raw_tracepoint/sys_enter")
int handler(void *ctx)
{
int pid = bpf_get_current_pid_tgid() >> 32;
if (my_pid != pid)
return 0;
/* next pointers for kernel address space have to be initialized from
* BPF side, user-space mmaped addresses are still user-space addresses
*/
k_probe_in.next = &k_probe_in;
__builtin_preserve_access_index(({k_core_in.next = &k_core_in;}));
k_probe_out = (long)BPF_PROBE_READ(&k_probe_in, next, next, func);
k_core_out = (long)BPF_CORE_READ(&k_core_in, next, next, func);
u_probe_out = (long)BPF_PROBE_READ_USER(u_probe_in, next, next, func);
u_core_out = (long)BPF_CORE_READ_USER(u_core_in, next, next, func);
return 0;
}
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `bpf/bpf_core_read.h`.
- Detected declarations: `struct callback_head___shuffled`, `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.