tools/testing/selftests/bpf/progs/test_core_reloc_type_based.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_core_reloc_type_based.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_core_reloc_type_based.c- Extension
.c- Size
- 5088 bytes
- Lines
- 158
- 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
linux/bpf.hstdint.hstdbool.hbpf/bpf_helpers.hbpf/bpf_core_read.h
Detected Declarations
struct a_structstruct a_complex_structstruct core_reloc_type_based_outputenum an_enumfunction test_core_type_based
Annotated Snippet
struct a_struct {
int x;
};
struct a_complex_struct {
union {
struct a_struct *a;
void *b;
} x;
volatile long y;
};
union a_union {
int y;
int z;
};
typedef struct a_struct named_struct_typedef;
typedef struct { int x, y, z; } anon_struct_typedef;
typedef struct {
int a, b, c;
} *struct_ptr_typedef;
enum an_enum {
AN_ENUM_VAL1 = 1,
AN_ENUM_VAL2 = 2,
AN_ENUM_VAL3 = 3,
};
typedef int int_typedef;
typedef enum { TYPEDEF_ENUM_VAL1, TYPEDEF_ENUM_VAL2 } enum_typedef;
typedef void *void_ptr_typedef;
typedef int *restrict restrict_ptr_typedef;
typedef int (*func_proto_typedef)(long);
typedef char arr_typedef[20];
struct core_reloc_type_based_output {
bool struct_exists;
bool complex_struct_exists;
bool union_exists;
bool enum_exists;
bool typedef_named_struct_exists;
bool typedef_anon_struct_exists;
bool typedef_struct_ptr_exists;
bool typedef_int_exists;
bool typedef_enum_exists;
bool typedef_void_ptr_exists;
bool typedef_restrict_ptr_exists;
bool typedef_func_proto_exists;
bool typedef_arr_exists;
bool struct_matches;
bool complex_struct_matches;
bool union_matches;
bool enum_matches;
bool typedef_named_struct_matches;
bool typedef_anon_struct_matches;
bool typedef_struct_ptr_matches;
bool typedef_int_matches;
bool typedef_enum_matches;
bool typedef_void_ptr_matches;
bool typedef_restrict_ptr_matches;
bool typedef_func_proto_matches;
bool typedef_arr_matches;
int struct_sz;
int union_sz;
int enum_sz;
int typedef_named_struct_sz;
int typedef_anon_struct_sz;
int typedef_struct_ptr_sz;
int typedef_int_sz;
int typedef_enum_sz;
int typedef_void_ptr_sz;
int typedef_func_proto_sz;
int typedef_arr_sz;
};
SEC("raw_tracepoint/sys_enter")
int test_core_type_based(void *ctx)
{
/* Support for the BPF_TYPE_MATCHES argument to the
* __builtin_preserve_type_info builtin was added at some point during
* development of clang 15 and it's what we require for this test. Part of it
Annotation
- Immediate include surface: `linux/bpf.h`, `stdint.h`, `stdbool.h`, `bpf/bpf_helpers.h`, `bpf/bpf_core_read.h`.
- Detected declarations: `struct a_struct`, `struct a_complex_struct`, `struct core_reloc_type_based_output`, `enum an_enum`, `function test_core_type_based`.
- 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.