aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-01-05 23:16:44 -0500
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-01-06 18:57:18 -0500
commitc4bc5d7bc130a3fb837c880e0a57a8b70ae82ae5 (patch)
tree4fea82e5ef7f7ee98735e23dd82576eeb06a3ce4
parent36a24e3869cd5ac2fc607977082696e3d4685531 (diff)
downloadlibtracefs-c4bc5d7bc130a3fb837c880e0a57a8b70ae82ae5.tar.gz
libtracefs: Flush pipe data in tracefs_cpu_flush()
The flushing of the data read in the splice pipe was missing from tracefs_cpu_flush(). It had a mysterious goto statement that went to the next line?? Anyway, add the code to read the data still in the pipe. Link: https://lore.kernel.org/linux-trace-devel/20230105231644.02c58967@gandalf.local.home Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--src/tracefs-record.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index 428bec0..459c346 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -464,10 +464,13 @@ int tracefs_cpu_flush(struct tracefs_cpu *tcpu, void *buffer)
if (tcpu->buffered < 0)
tcpu->buffered = 0;
- if (tcpu->buffered)
- goto do_read;
+ if (tcpu->buffered) {
+ ret = read(tcpu->splice_pipe[0], buffer, tcpu->subbuf_size);
+ if (ret > 0)
+ tcpu->buffered -= ret;
+ return ret;
+ }
- do_read:
ret = read(tcpu->fd, buffer, tcpu->subbuf_size);
if (ret > 0 && tcpu->buffered)
tcpu->buffered -= ret;