Skip to content

SCX eBPF macro __COMPAT_scx_bpf_task_cgroup

v6.12

The __COMPAT_scx_bpf_task_cgroup macro executes scx_bpf_task_cgroup or returns NULL if the function is not available.

Definition

#define __COMPAT_scx_bpf_task_cgroup(p)                     \
    (bpf_ksym_exists(scx_bpf_task_cgroup) ?                    \
     scx_bpf_task_cgroup((p)) : NULL)

Usage

This macro handles checking for the existence of scx_bpf_task_cgroup at runtime, and calling it if it exists. If you were to have a program that called scx_bpf_task_cgroup directly, without this check, it would refuse to load on kernels before the kfunc was added.

Example

Docs could be improved

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