| .. | .. |
|---|
| 6 | 6 | /* glibc 2.20 deprecates _BSD_SOURCE in favour of _DEFAULT_SOURCE */ |
|---|
| 7 | 7 | #define _DEFAULT_SOURCE 1 |
|---|
| 8 | 8 | |
|---|
| 9 | +#include <fcntl.h> |
|---|
| 9 | 10 | #include <stdbool.h> |
|---|
| 10 | 11 | #include <stddef.h> |
|---|
| 11 | | -#include <stdlib.h> |
|---|
| 12 | | -#include <stdarg.h> |
|---|
| 13 | 12 | #include <linux/compiler.h> |
|---|
| 14 | 13 | #include <sys/types.h> |
|---|
| 15 | 14 | |
|---|
| .. | .. |
|---|
| 17 | 16 | void usage(const char *err) __noreturn; |
|---|
| 18 | 17 | void die(const char *err, ...) __noreturn __printf(1, 2); |
|---|
| 19 | 18 | |
|---|
| 20 | | -static inline void *zalloc(size_t size) |
|---|
| 21 | | -{ |
|---|
| 22 | | - return calloc(1, size); |
|---|
| 23 | | -} |
|---|
| 24 | | - |
|---|
| 25 | | -#define zfree(ptr) ({ free((void *)*ptr); *ptr = NULL; }) |
|---|
| 26 | | - |
|---|
| 27 | 19 | struct dirent; |
|---|
| 28 | | -struct nsinfo; |
|---|
| 29 | 20 | struct strlist; |
|---|
| 30 | 21 | |
|---|
| 31 | 22 | int mkdir_p(char *path, mode_t mode); |
|---|
| 32 | 23 | int rm_rf(const char *path); |
|---|
| 24 | +int rm_rf_perf_data(const char *path); |
|---|
| 33 | 25 | struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *)); |
|---|
| 34 | 26 | bool lsdir_no_dot_filter(const char *name, struct dirent *d); |
|---|
| 35 | | -int copyfile(const char *from, const char *to); |
|---|
| 36 | | -int copyfile_mode(const char *from, const char *to, mode_t mode); |
|---|
| 37 | | -int copyfile_ns(const char *from, const char *to, struct nsinfo *nsi); |
|---|
| 38 | | - |
|---|
| 39 | | -ssize_t readn(int fd, void *buf, size_t n); |
|---|
| 40 | | -ssize_t writen(int fd, const void *buf, size_t n); |
|---|
| 41 | 27 | |
|---|
| 42 | 28 | size_t hex_width(u64 v); |
|---|
| 43 | | -int hex2u64(const char *ptr, u64 *val); |
|---|
| 44 | | - |
|---|
| 45 | | -extern unsigned int page_size; |
|---|
| 46 | | -int __pure cacheline_size(void); |
|---|
| 47 | 29 | |
|---|
| 48 | 30 | int sysctl__max_stack(void); |
|---|
| 31 | + |
|---|
| 32 | +bool sysctl__nmi_watchdog_enabled(void); |
|---|
| 49 | 33 | |
|---|
| 50 | 34 | int fetch_kernel_version(unsigned int *puint, |
|---|
| 51 | 35 | char *str, size_t str_sz); |
|---|
| .. | .. |
|---|
| 55 | 39 | #define KVER_FMT "%d.%d.%d" |
|---|
| 56 | 40 | #define KVER_PARAM(x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x) |
|---|
| 57 | 41 | |
|---|
| 58 | | -const char *perf_tip(const char *dirpath); |
|---|
| 59 | | - |
|---|
| 60 | | -#ifndef HAVE_GET_CURRENT_DIR_NAME |
|---|
| 61 | | -char *get_current_dir_name(void); |
|---|
| 62 | | -#endif |
|---|
| 42 | +int perf_tip(char **strp, const char *dirpath); |
|---|
| 63 | 43 | |
|---|
| 64 | 44 | #ifndef HAVE_SCHED_GETCPU_SUPPORT |
|---|
| 65 | 45 | int sched_getcpu(void); |
|---|
| 66 | | -#endif |
|---|
| 67 | | - |
|---|
| 68 | | -#ifndef HAVE_SETNS_SUPPORT |
|---|
| 69 | | -int setns(int fd, int nstype); |
|---|
| 70 | 46 | #endif |
|---|
| 71 | 47 | |
|---|
| 72 | 48 | extern bool perf_singlethreaded; |
|---|
| 73 | 49 | |
|---|
| 74 | 50 | void perf_set_singlethreaded(void); |
|---|
| 75 | 51 | void perf_set_multithreaded(void); |
|---|
| 52 | + |
|---|
| 53 | +char *perf_exe(char *buf, int len); |
|---|
| 76 | 54 | |
|---|
| 77 | 55 | #ifndef O_CLOEXEC |
|---|
| 78 | 56 | #ifdef __sparc__ |
|---|
| .. | .. |
|---|
| 84 | 62 | #endif |
|---|
| 85 | 63 | #endif |
|---|
| 86 | 64 | |
|---|
| 65 | +extern bool test_attr__enabled; |
|---|
| 66 | +void test_attr__ready(void); |
|---|
| 67 | +void test_attr__init(void); |
|---|
| 68 | +struct perf_event_attr; |
|---|
| 69 | +void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu, |
|---|
| 70 | + int fd, int group_fd, unsigned long flags); |
|---|
| 87 | 71 | #endif /* GIT_COMPAT_UTIL_H */ |
|---|