1 /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ 2 /* Copyright (c) 2021 Google LLC. */ 3 #ifndef __UPROBE_HELPERS_H 4 #define __UPROBE_HELPERS_H 5 6 #include <sys/types.h> 7 #include <unistd.h> 8 #include <gelf.h> 9 10 int get_pid_binary_path(pid_t pid, char *path, size_t path_sz); 11 int get_pid_lib_path(pid_t pid, const char *lib, char *path, size_t path_sz); 12 int resolve_binary_path(const char *binary, pid_t pid, char *path, size_t path_sz); 13 off_t get_elf_func_offset(const char *path, const char *func); 14 Elf *open_elf(const char *path, int *fd_close); 15 Elf *open_elf_by_fd(int fd); 16 void close_elf(Elf *e, int fd_close); 17 18 #endif /* __UPROBE_HELPERS_H */ 19