diff mbox series

trace-cmd: fix --poll trace recording

Message ID ZbgNqiyocHf/FEQw@tpad (mailing list archive)
State Accepted
Commit c7f19c48d000e67bac82eb4089f6f819df97e415
Headers show
Series trace-cmd: fix --poll trace recording | expand

Commit Message

Marcelo Tosatti Jan. 29, 2024, 8:42 p.m. UTC
When using --poll, move_data() returns -1 and errno is set to EAGAIN.
This causes the record threads to stop recording.

Fix it by returning to the read loop in case EAGAIN, if --poll
is specified.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-recorder.c b/lib/trace-cmd/trace-recorder.c
index 70ce52e..0633edf 100644
--- a/lib/trace-cmd/trace-recorder.c
+++ b/lib/trace-cmd/trace-recorder.c
@@ -421,6 +421,9 @@  int tracecmd_start_recording(struct tracecmd_recorder *recorder, unsigned long s
 			if (ret < 0) {
 				if (errno == EINTR)
 					continue;
+				if ((recorder->flags & TRACECMD_RECORD_POLL) &&
+				    errno == EAGAIN)
+					continue;
 				return ret;
 			}
 			read += ret;