aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-01-06 13:39:22 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-01-09 13:12:37 -0500
commit37e96d7855c9638073e93b63992ab468b3a291e9 (patch)
tree02c68e5490fb3296ccc8d4299085f59f41c130d0
parent85f75900c2fb12b4d91dc9e0685cbeec8a9a11c6 (diff)
downloadtrace-cmd-37e96d7855c9638073e93b63992ab468b3a291e9.tar.gz
trace-cmd stream: Do not block when stopping threads
When the trace-cmd stream is exiting, it flushes the data. But it does so in a blocking way, where it can block when there's nothing to read. Set the timeout of trace_stream_read() to zero in order to return immediately. Link: https://lore.kernel.org/linux-trace-devel/20230106183930.12565-3-rostedt@goodmis.org Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--tracecmd/trace-record.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 361524b5..cc6f27bf 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -798,7 +798,8 @@ static void stop_threads(enum trace_type type)
/* Flush out the pipes */
if (type & TRACE_TYPE_STREAM) {
do {
- ret = trace_stream_read(pids, recorder_threads, NULL);
+ struct timeval tv = { 0, 0 };
+ ret = trace_stream_read(pids, recorder_threads, &tv);
} while (ret > 0);
}
}