aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-01-06 13:39:28 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-01-09 13:12:37 -0500
commit102d78c5198f407de2f7015ae0ce4a6c0894b911 (patch)
treeb1ca77aaba6eb4fa0bfbfb8bb6e6dbd36c4ab5e8
parent762310195778ec91343b35ba64b15c319520899c (diff)
downloadtrace-cmd-102d78c5198f407de2f7015ae0ce4a6c0894b911.tar.gz
trace-cmd library: Return the result of tracefs_cpu_stop()
Ideally, tracefs_cpu_stop() is suppose to return zero if it guaranteed to stop the recorders (but this may not be true if called from a signal handler). Return the result of tracefs_cpu_stop() in tracecmd_stop_recording(). Link: https://lore.kernel.org/linux-trace-devel/20230106183930.12565-9-rostedt@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--lib/trace-cmd/include/private/trace-cmd-private.h2
-rw-r--r--lib/trace-cmd/trace-recorder.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
index e8b0989a..05c084ce 100644
--- a/lib/trace-cmd/include/private/trace-cmd-private.h
+++ b/lib/trace-cmd/include/private/trace-cmd-private.h
@@ -377,7 +377,7 @@ struct tracecmd_recorder *tracecmd_create_buffer_recorder(const char *file, int
struct tracecmd_recorder *tracecmd_create_buffer_recorder_maxkb(const char *file, int cpu, unsigned flags, struct tracefs_instance *instance, int maxkb);
int tracecmd_start_recording(struct tracecmd_recorder *recorder, unsigned long sleep);
-void tracecmd_stop_recording(struct tracecmd_recorder *recorder);
+int tracecmd_stop_recording(struct tracecmd_recorder *recorder);
long tracecmd_flush_recording(struct tracecmd_recorder *recorder, bool finish);
enum tracecmd_msg_flags {
diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index db159e5e..23499f30 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -102,9 +102,9 @@ void tracecmd_free_recorder(struct tracecmd_recorder *recorder)
free(recorder);
}
-static void set_nonblock(struct tracecmd_recorder *recorder)
+static int set_nonblock(struct tracecmd_recorder *recorder)
{
- tracefs_cpu_stop(recorder->tcpu);
+ return tracefs_cpu_stop(recorder->tcpu);
}
static struct tracecmd_recorder *
@@ -437,12 +437,12 @@ int tracecmd_start_recording(struct tracecmd_recorder *recorder, unsigned long s
return 0;
}
-void tracecmd_stop_recording(struct tracecmd_recorder *recorder)
+int tracecmd_stop_recording(struct tracecmd_recorder *recorder)
{
if (!recorder)
- return;
-
- set_nonblock(recorder);
+ return -1;
recorder->stop = 1;
+
+ return set_nonblock(recorder);
}