Skip to content

SCX eBPF macro scx_bpf_bstr_preamble

v6.12

The scx_bpf_bstr_preamble macro initializes the fmt and variadic argument inputs to scx_bpf_dump_bstr, scx_bpf_error_bstr and scx_bpf_exit_bstr kfuncs. Callers to this function should use ___fmt and ___param to refer to the initialized list of inputs to the bstr kfunc.

Note

Note that __param[] must have at least one element to keep the verifier happy.

Definition

#define scx_bpf_bstr_preamble(fmt, args...)                         \
    static char ___fmt[] = fmt;                                     \
    unsigned long long ___param[___bpf_narg(args) ?: 1] = {};       \
                                                                    \
    _Pragma("GCC diagnostic push")                                  \
    _Pragma("GCC diagnostic ignored \"-Wint-conversion\"")          \
    ___bpf_fill(___param, args);                                    \
    _Pragma("GCC diagnostic pop")

Usage

This macro is used internally in scx_bpf_exit, scx_bpf_error and scx_bpf_dump. These prepare the parameters and call the kfuncs. But you could use this macro manually if you wish.

Example

Docs could be improved

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