Skip to content

Libbpf userspace function bpf_program__set_type

0.0.1

Sets the program type of the passed BPF program.

Definition

int bpf_program__set_type(struct bpf_program *prog, enum bpf_prog_type type);

Parameters

  • prog: BPF program to set the program type for
  • type: program type to set the BPF map to have

Return

error code; or 0 if no error. An error occurs if the object is already loaded.

Usage

This must be called before the BPF object is loaded, otherwise it has no effect and an error is returned.

Example

Docs could be improved

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