diff options
author | Jiri Olsa <jolsa@kernel.org> | 2023-08-09 10:34:21 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-08-21 15:51:26 -0700 |
commit | f90eb70d4489ea6fa6f3a7638aa614e15ad7181f (patch) | |
tree | 4dd7da37dc4c91fe115c076b8cd7d4882e1c2b7a /tools/lib/bpf/libbpf_internal.h | |
parent | 5c742725045ae9c15b7ae2041d1fbd1f2180ab86 (diff) |
libbpf: Add elf_open/elf_close functions
Adding elf_open/elf_close functions and using it in
elf_find_func_offset_from_file function. It will be
used in following changes to save some common code.
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20230809083440.3209381-10-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/libbpf_internal.h')
-rw-r--r-- | tools/lib/bpf/libbpf_internal.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index 44eb63541507..0bbcd8e6fdc5 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -581,4 +581,12 @@ int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size, int attempts); long elf_find_func_offset(Elf *elf, const char *binary_path, const char *name); long elf_find_func_offset_from_file(const char *binary_path, const char *name); +struct elf_fd { + Elf *elf; + int fd; +}; + +int elf_open(const char *binary_path, struct elf_fd *elf_fd); +void elf_close(struct elf_fd *elf_fd); + #endif /* __LIBBPF_LIBBPF_INTERNAL_H */ |