[PATCH 1/2] libtracefs: Do not return negative on EAGAIN for tracefs_cpu_flush_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

Like tracefs_cpu_flush(), when the buffer is empty, and because the
reading of the buffer is done in NON_BLOCK mode, it will finish with a
negative and EAGAIN. This is a successful state, do not return a negative
number here.

Fixes: 26b8893efda7c ("libtracefs: Add reading of per cpu files")
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 src/tracefs-record.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/tracefs-record.c b/src/tracefs-record.c
index dbe0e9f01aad..71d1df99bb02 100644
--- a/src/tracefs-record.c
+++ b/src/tracefs-record.c
@@ -495,6 +495,10 @@ int tracefs_cpu_flush_write(struct tracefs_cpu *tcpu, int wfd)
 	if (ret > 0)
 		ret = write(wfd, buffer, ret);
 
+	/* It's OK if there's no data to read */
+	if (ret < 0 && errno == EAGAIN)
+		ret = 0;
+
 	return ret;
 }
 
-- 
2.35.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux