tools/testing/selftests/bpf/progs/test_core_reloc_enum64val.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_core_reloc_enum64val.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_core_reloc_enum64val.c- Extension
.c- Size
- 2152 bytes
- Lines
- 71
- 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 core_reloc_enum64val_outputenum named_unsigned_enum64enum named_signed_enum64function test_core_enum64val
Annotated Snippet
struct core_reloc_enum64val_output {
bool unsigned_val1_exists;
bool unsigned_val2_exists;
bool unsigned_val3_exists;
bool signed_val1_exists;
bool signed_val2_exists;
bool signed_val3_exists;
long unsigned_val1;
long unsigned_val2;
long signed_val1;
long signed_val2;
};
SEC("raw_tracepoint/sys_enter")
int test_core_enum64val(void *ctx)
{
#if __clang_major__ >= 15
struct core_reloc_enum64val_output *out = (void *)&data.out;
enum named_unsigned_enum64 named_unsigned = 0;
enum named_signed_enum64 named_signed = 0;
out->unsigned_val1_exists = bpf_core_enum_value_exists(named_unsigned, UNSIGNED_ENUM64_VAL1);
out->unsigned_val2_exists = bpf_core_enum_value_exists(enum named_unsigned_enum64, UNSIGNED_ENUM64_VAL2);
out->unsigned_val3_exists = bpf_core_enum_value_exists(enum named_unsigned_enum64, UNSIGNED_ENUM64_VAL3);
out->signed_val1_exists = bpf_core_enum_value_exists(named_signed, SIGNED_ENUM64_VAL1);
out->signed_val2_exists = bpf_core_enum_value_exists(enum named_signed_enum64, SIGNED_ENUM64_VAL2);
out->signed_val3_exists = bpf_core_enum_value_exists(enum named_signed_enum64, SIGNED_ENUM64_VAL3);
out->unsigned_val1 = bpf_core_enum_value(named_unsigned, UNSIGNED_ENUM64_VAL1);
out->unsigned_val2 = bpf_core_enum_value(named_unsigned, UNSIGNED_ENUM64_VAL2);
out->signed_val1 = bpf_core_enum_value(named_signed, SIGNED_ENUM64_VAL1);
out->signed_val2 = bpf_core_enum_value(named_signed, SIGNED_ENUM64_VAL2);
/* NAMED_ENUM64_VAL3 value is optional */
#else
data.skip = true;
#endif
return 0;
}
Annotation
- Immediate include surface: `linux/bpf.h`, `stdint.h`, `stdbool.h`, `bpf/bpf_helpers.h`, `bpf/bpf_core_read.h`.
- Detected declarations: `struct core_reloc_enum64val_output`, `enum named_unsigned_enum64`, `enum named_signed_enum64`, `function test_core_enum64val`.
- 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.