Skip to content

Libbpf userspace function bpf_linker__new_fd

1.6.0

Create a new struct bpf_linker object from a file.

Definition

struct bpf_linker *bpf_linker__new_fd(int fd, struct bpf_linker_opts *opts);

Parameters

  • fd: The file descriptor of the first file to load the BPF object from.
  • opts: A pointer to a struct bpf_linker_opts object that contains options for the linker.

Return

A pointer to a new struct bpf_linker object. On error, NULL is returned and errno is set.

struct bpf_linker_opts

struct bpf_linker_opts {
    /* size of this struct, for forward/backward compatibility */
    size_t sz;
};

Usage

This function creates a new BPF linker. The linker is used to link statically link multiple BPF objects together into a single ELF file.

Example

Docs could be improved

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