summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/api/fs/tracing_path.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 251b7c342a87..3e606b9c443e 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -86,9 +86,13 @@ void put_tracing_file(char *file)
86 free(file); 86 free(file);
87} 87}
88 88
89static int strerror_open(int err, char *buf, size_t size, const char *filename) 89int tracing_path__strerror_open_tp(int err, char *buf, size_t size,
90 const char *sys, const char *name)
90{ 91{
91 char sbuf[128]; 92 char sbuf[128];
93 char filename[PATH_MAX];
94
95 snprintf(filename, PATH_MAX, "%s/%s", sys, name ?: "*");
92 96
93 switch (err) { 97 switch (err) {
94 case ENOENT: 98 case ENOENT:
@@ -99,10 +103,19 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
99 * - jirka 103 * - jirka
100 */ 104 */
101 if (debugfs__configured() || tracefs__configured()) { 105 if (debugfs__configured() || tracefs__configured()) {
102 snprintf(buf, size, 106 /* sdt markers */
103 "Error:\tFile %s/%s not found.\n" 107 if (!strncmp(filename, "sdt_", 4)) {
104 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", 108 snprintf(buf, size,
105 tracing_events_path, filename); 109 "Error:\tFile %s/%s not found.\n"
110 "Hint:\tSDT event cannot be directly recorded on.\n"
111 "\tPlease first use 'perf probe %s:%s' before recording it.\n",
112 tracing_events_path, filename, sys, name);
113 } else {
114 snprintf(buf, size,
115 "Error:\tFile %s/%s not found.\n"
116 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
117 tracing_events_path, filename);
118 }
106 break; 119 break;
107 } 120 }
108 snprintf(buf, size, "%s", 121 snprintf(buf, size, "%s",
@@ -125,12 +138,3 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
125 138
126 return 0; 139 return 0;
127} 140}
128
129int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
130{
131 char path[PATH_MAX];
132
133 snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
134
135 return strerror_open(err, buf, size, path);
136}