tools/testing/selftests/bpf/progs/strobemeta.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/strobemeta.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/strobemeta.h- Extension
.h- Size
- 17714 bytes
- Lines
- 636
- 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
stdint.hstddef.hstdbool.hlinux/bpf.hlinux/ptrace.hlinux/sched.hlinux/types.hbpf/bpf_helpers.hbpf_compiler.h
Detected Declarations
struct task_structstruct strobe_value_headerstruct strobe_value_genericstruct strobe_value_intstruct strobe_value_strstruct strobe_value_mapstruct strobe_map_entrystruct strobe_map_rawstruct strobe_value_locstruct strobemeta_cfgstruct strobe_map_descrstruct strobemeta_payloadstruct strobelight_bpf_samplestruct tcbheadstruct tls_indexstruct read_var_ctxenum read_typefunction read_int_varfunction read_str_varfunction read_map_varfunction read_var_callbackfunction on_event
Annotated Snippet
struct task_struct {};
#define TASK_COMM_LEN 16
#define PERF_MAX_STACK_DEPTH 127
#define STROBE_TYPE_INVALID 0
#define STROBE_TYPE_INT 1
#define STROBE_TYPE_STR 2
#define STROBE_TYPE_MAP 3
#define STACK_TABLE_EPOCH_SHIFT 20
#define STROBE_MAX_STR_LEN 1
#define STROBE_MAX_CFGS 32
#define READ_MAP_VAR_PAYLOAD_CAP \
((1 + STROBE_MAX_MAP_ENTRIES * 2) * STROBE_MAX_STR_LEN)
#define STROBE_MAX_PAYLOAD \
(STROBE_MAX_STRS * STROBE_MAX_STR_LEN + \
STROBE_MAX_MAPS * READ_MAP_VAR_PAYLOAD_CAP)
struct strobe_value_header {
/*
* meaning depends on type:
* 1. int: 0, if value not set, 1 otherwise
* 2. str: 1 always, whether value is set or not is determined by ptr
* 3. map: 1 always, pointer points to additional struct with number
* of entries (up to STROBE_MAX_MAP_ENTRIES)
*/
uint16_t len;
/*
* _reserved might be used for some future fields/flags, but we always
* want to keep strobe_value_header to be 8 bytes, so BPF can read 16
* bytes in one go and get both header and value
*/
uint8_t _reserved[6];
};
/*
* strobe_value_generic is used from BPF probe only, but needs to be a union
* of strobe_value_int/strobe_value_str/strobe_value_map
*/
struct strobe_value_generic {
struct strobe_value_header header;
union {
int64_t val;
void *ptr;
};
};
struct strobe_value_int {
struct strobe_value_header header;
int64_t value;
};
struct strobe_value_str {
struct strobe_value_header header;
const char* value;
};
struct strobe_value_map {
struct strobe_value_header header;
const struct strobe_map_raw* value;
};
struct strobe_map_entry {
const char* key;
const char* val;
};
/*
* Map of C-string key/value pairs with fixed maximum capacity. Each map has
* corresponding int64 ID, which application can use (or ignore) in whatever
* way appropriate. Map is "write-only", there is no way to get data out of
* map. Map is intended to be used to provide metadata for profilers and is
* not to be used for internal in-app communication. All methods are
* thread-safe.
*/
struct strobe_map_raw {
/*
* general purpose unique ID that's up to application to decide
* whether and how to use; for request metadata use case id is unique
* request ID that's used to match metadata with stack traces on
* Strobelight backend side
*/
int64_t id;
/* number of used entries in map */
int64_t cnt;
/*
* having volatile doesn't change anything on BPF side, but clang
* emits warnings for passing `volatile const char *` into
* bpf_probe_read_user_str that expects just `const char *`
Annotation
- Immediate include surface: `stdint.h`, `stddef.h`, `stdbool.h`, `linux/bpf.h`, `linux/ptrace.h`, `linux/sched.h`, `linux/types.h`, `bpf/bpf_helpers.h`.
- Detected declarations: `struct task_struct`, `struct strobe_value_header`, `struct strobe_value_generic`, `struct strobe_value_int`, `struct strobe_value_str`, `struct strobe_value_map`, `struct strobe_map_entry`, `struct strobe_map_raw`, `struct strobe_value_loc`, `struct strobemeta_cfg`.
- 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.