Skip to main content Module compat Copy item path Source use anyhow::Context ; π use anyhow::Result ; π use anyhow::anyhow ; π use anyhow::bail ; π use libbpf_rs::AsRawLibbpf; π use libbpf_rs::OpenObject; π use libbpf_rs::OpenProgramImpl; π use libbpf_rs::ProgramImpl; π use log::debug ; π use log::error ; π use log::info ; π use log::warn ; π use std::env ; π use std::env ; π use std::ffi::CStr ; π use std::ffi::CString ; π use std::ffi::OsStr ; π use std::ffi::c_void ; π use std::io ; π use std::io::BufRead ; π use std::io::BufReader ; π use std::mem::size_of ; π use std::os::fd::AsFd ; π use std::os::fd::AsRawFd ; π use std::os::fd::BorrowedFd ; π use std::os::fd::FromRawFd ; π use std::os::fd::OwnedFd ; π use std::slice::from_raw_parts ; π use libbpf_rs::libbpf_sys::*; π enums_abi π ARENA_FETCH_BITOPS The JIT lowers fetching AND, OR and XOR on arena pointers. BPF_PROG_STREAM_OPEN π LIB_FEATURES Every probed kernel feature: its name, its bit in the scx_lib_features
rodata word or zero when only userspace consults it, and whether the
running kernel has it. PROG_STREAM_OPEN_SUPPORTED prog_stream_open() works, so BPF streams can be polled. ProbeInsn π A raw BPF instruction for the load probes below, laid out as the kernel
reads it: the two register nibbles follow the hostβs bitfield order. ProgStreamOpenAttr π ROOT_PREFIX SCX_OPS_ALLOW_QUEUED_WAKEUP SCX_OPS_ALWAYS_ENQ_IMMED SCX_OPS_BUILTIN_IDLE_PER_NODE SCX_OPS_ENQ_BLOCKED SCX_OPS_ENQ_EXITING SCX_OPS_ENQ_LAST SCX_OPS_ENQ_MIGRATION_DISABLED SCX_OPS_KEEP_BUILTIN_IDLE SCX_OPS_SWITCH_PARTIAL SCX_OPS_TID_TO_TASK SCX_PICK_IDLE_CORE SCX_PICK_IDLE_IN_NODE VMLINUX_BTF π BPF_F_ARENA_SCALAR BPF_PROG_LOAD flag under which a load or store through a plain scalar is an
arena access, from 4c651a91bdfc in bpf-next. Not yet in the uapi header
libbpf-sys 1.7 ships. BPF_F_STREAM_NONBLOCK π DEBUGFS π PROBE_ADDR_SPACE_CAST π PROBE_ATOMIC_DW π PROBE_ATOMIC_OR_FETCH π PROBE_EXIT π PROBE_LD_IMM64 π PROBE_MOV64_IMM π PROBE_MOV64_REG π PROCFS_MOUNTS π SCX_LIB_FEAT_ARENA_FETCH_BITOPS TRACEFS π btf_enum π btf_enum64 π btf_kflag π btf_kind π btf_members π btf_name_str_by_offset π btf_params π btf_type_plus_1 π btf_vlen π check_min_requirements cond_kprobe_attach cond_kprobe_enable cond_kprobe_load cond_kprobes_enable cond_tracepoint_enable cond_tracepoints_enable debugfs_mount Returns the debugfs mount point. function_tracer_available Whether the kernel supports function tracing (CONFIG_FUNCTION_TRACER),
needed for fentry/fexit BPF programs to load or attach.
/proc/sys/kernel/ftrace_enabled only exists when itβs compiled in,
so its presence is a cheap proxy. get_fs_mount Returns the mount point for a filesystem type. has_rodata_var Whether an open object has the rodata variable name. in_kallsyms is_sched_ext_enabled ksym_exists load_vmlinux_btf π malformed_scx_kfuncs Scan the running kernelβs vmlinux BTF for scx kfuncs whose public-facing
prototype still carries the implicit aux (struct bpf_prog_aux *) argument. probe_arena_fetch_bitops π A fetching OR on arena memory, which the verifier rejects where the JIT has
no lowering for it. The JITs accept the fetching AND, OR and XOR as a
group, so one probe covers all three. The arena has to be mapped before
the load because the verifier requires its user address to be known. probe_insn π probe_prog_load π Load insns as a GPL program of prog_type with the BPF_F_* flags. probe_prog_stream_open π prog_stream_open Open a read-only descriptor on one of progβs streams, stream_id being
BPF_STREAM_STDOUT or BPF_STREAM_STDERR. Reads block unless nonblock.
poll(2) reports POLLIN for data and POLLHUP once the program is freed, with
buffered data still readable. A kernel without the command fails with
EINVAL. read_enum read_enum_any Read an enum value from the first BTF enum type that contains it. recover_truncated_enum64 π recover_truncated_enum64_from π Recover the true value of a 64-bit enum enumerator whose kernel BTF entry
was truncated to its low 32 bits. rodata_var π Offset and size of the rodata variable name in an open objectβs BTF,
None when the object has no such variable. set_lib_features Hand the probed features to the BPF side of an open object and log them,
at info when the kernel lacks any of them and at debug otherwise. set_rodata_var Write value over the rodata variable name of an open object. Returns
false when the object has no such variable. struct_has_field tracefs_mount Returns the tracefs mount point. tracepoint_exists tracer_available