Libbpf userspace function bpf_obj_get_opts
Low level wrapper around the BPF_OBJ_GET
syscall command.
Definition
int bpf_obj_get_opts(const char *pathname, const struct bpf_obj_get_opts *opts);
Parameters
pathname
: path to the object to retrieveopts
: pointer to abpf_obj_get_opts
structure
Return
>0
, file descriptor of the object; negative error code, otherwise
struct bpf_obj_get_opts
struct bpf_obj_get_opts {
size_t sz; /* size of this struct for forward/backward compatibility */
__u32 file_flags;
int path_fd;
size_t :0;
};
file_flags
path_fd
Usage
This function should only be used if you need precise control over the object retrieval process. In most cases the bpf_object__open
or similar high level API functions should be used instead.
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome