[PATCH stalld 15/36] tests/helpers: Flush stdout after starvation_gen startup messages

Wander Lairson Costa <[email protected]>
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
starvation_gen prints its startup configuration (iteration target and
stop instructions) via printf, but does not flush stdout afterward.
When stdout is not connected to a terminal, libc switches to block
buffering, so these messages may not reach the test harness until the
buffer fills or the process exits.

Add an explicit fflush(stdout) after the startup printf calls to
ensure immediate delivery regardless of buffering mode.

Signed-off-by: Wander Lairson Costa <[email protected]>
---
 tests/helpers/starvation_gen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/helpers/starvation_gen.c b/tests/helpers/starvation_gen.c
index dc0e3de..81ee714 100644
--- a/tests/helpers/starvation_gen.c
+++ b/tests/helpers/starvation_gen.c
@@ -345,6 +345,7 @@ int main(int argc, char **argv) {
 	}
 	printf("\nBlockees will complete if boosted enough to finish %lu iterations\n", cfg.work_target);
 	printf("Press Ctrl+C to stop early\n");
+	fflush(stdout);
 
 	/*
 	 * Wait for specified duration OR until all blockees complete (whichever comes first).
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.