Skip to contentSkip to conversation

trace-cmd: fix --poll trace recording

PATCH New Marcelo Tosatti 1 participant 1 message Jan 29, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: fix --poll trace recording

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.

lib/trace-cmd/trace-recorder.c +3 -0
index 70ce52e..0633edf 100644
@@ -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;