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