hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/perf/util/util.h
....@@ -6,10 +6,9 @@
66 /* glibc 2.20 deprecates _BSD_SOURCE in favour of _DEFAULT_SOURCE */
77 #define _DEFAULT_SOURCE 1
88
9
+#include <fcntl.h>
910 #include <stdbool.h>
1011 #include <stddef.h>
11
-#include <stdlib.h>
12
-#include <stdarg.h>
1312 #include <linux/compiler.h>
1413 #include <sys/types.h>
1514
....@@ -17,35 +16,20 @@
1716 void usage(const char *err) __noreturn;
1817 void die(const char *err, ...) __noreturn __printf(1, 2);
1918
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
-
2719 struct dirent;
28
-struct nsinfo;
2920 struct strlist;
3021
3122 int mkdir_p(char *path, mode_t mode);
3223 int rm_rf(const char *path);
24
+int rm_rf_perf_data(const char *path);
3325 struct strlist *lsdir(const char *name, bool (*filter)(const char *, struct dirent *));
3426 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);
4127
4228 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);
4729
4830 int sysctl__max_stack(void);
31
+
32
+bool sysctl__nmi_watchdog_enabled(void);
4933
5034 int fetch_kernel_version(unsigned int *puint,
5135 char *str, size_t str_sz);
....@@ -55,24 +39,18 @@
5539 #define KVER_FMT "%d.%d.%d"
5640 #define KVER_PARAM(x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)
5741
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);
6343
6444 #ifndef HAVE_SCHED_GETCPU_SUPPORT
6545 int sched_getcpu(void);
66
-#endif
67
-
68
-#ifndef HAVE_SETNS_SUPPORT
69
-int setns(int fd, int nstype);
7046 #endif
7147
7248 extern bool perf_singlethreaded;
7349
7450 void perf_set_singlethreaded(void);
7551 void perf_set_multithreaded(void);
52
+
53
+char *perf_exe(char *buf, int len);
7654
7755 #ifndef O_CLOEXEC
7856 #ifdef __sparc__
....@@ -84,4 +62,10 @@
8462 #endif
8563 #endif
8664
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);
8771 #endif /* GIT_COMPAT_UTIL_H */