Skip to content

Libbpf eBPF macro bpf_core_read_str

v0.0.6

The bpf_core_read_str macro abstracts away bpf_probe_read_kernel_str call and captures offset relocation.

Definition

#define bpf_core_read_str(dst, sz, src)                     \
    bpf_probe_read_kernel_str(dst, sz, (const void *)__builtin_preserve_access_index(src))

Usage

bpf_core_read_str is the string variant of the bpf_core_read macro. It is better suited for reading NUL-terminated strings from kernel memory.

See the bpf_core_read documentation for more details on usage of it and its variants like this macros.

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome