Skip to content

Libbpf userspace function bpf_object__set_kversion

0.4.0

Set the kernel version associated with the BPF object.

Definition

int bpf_object__set_kversion(struct bpf_object *obj, __u32 kern_version);

Parameters

  • obj: The BPF object to set the kernel version for.
  • kern_version: The kernel version to set, encoded as an integer. See KERNEL_VERSION details.

Returns

  • 0 on success, or a negative error code on failure.

Usage

This function allows you to override the kernel version associated with the BPF object. This version number is used when loading the object into the kernel, see kern_version.

Note

This value was once used for cross-kernel compatibility, but is now unused. CO-RE has replaced this functionality.

Example

Docs could be improved

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