diff options
-rw-r--r-- | trace-cmd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index 1365a73..be1241c 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -267,6 +267,7 @@ static void reset_max_latency(void) | |||
267 | static void update_ftrace_pid(const char *pid) | 267 | static void update_ftrace_pid(const char *pid) |
268 | { | 268 | { |
269 | char *path; | 269 | char *path; |
270 | int ret; | ||
270 | int fd; | 271 | int fd; |
271 | 272 | ||
272 | path = get_tracing_file("set_ftrace_pid"); | 273 | path = get_tracing_file("set_ftrace_pid"); |
@@ -277,7 +278,15 @@ static void update_ftrace_pid(const char *pid) | |||
277 | if (fd < 0) | 278 | if (fd < 0) |
278 | return; | 279 | return; |
279 | 280 | ||
280 | if (write(fd, pid, strlen(pid)) < 0) | 281 | ret = write(fd, pid, strlen(pid)); |
282 | |||
283 | /* | ||
284 | * Older kernels required "-1" to disable pid | ||
285 | */ | ||
286 | if (ret < 0 && !strlen(pid)) | ||
287 | ret = write(fd, "-1", 2); | ||
288 | |||
289 | if (ret < 0) | ||
281 | die("error writing to %s", path); | 290 | die("error writing to %s", path); |
282 | 291 | ||
283 | close(fd); | 292 | close(fd); |