Libbpf userspace function bpf_prog_attach
Low level wrapper around the BPF_PROG_ATTACH syscall command.
Definition
int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type, unsigned int flags);
Parameters
- prog_fd: file descriptor of the program to attach
- attachable_fd: file descriptor of the attachable object
- type: type of the attachment
- flags: flags for the attachment
Return
0, on success; negative error code, otherwise
Usage
This function should only be used for specific program types that need to be attached via the BPF_PROG_ATTACH syscall command and you need specific control over this process. In most cases, the bpf_program__attach or specific bpf_program__attach_* functions should be used instead.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome