Netdev Archive on
help / color / mirror / Atom feed
* [PATCH iproute2] devlink: Add fflush() in cmd_mon_show_cb()
@ 2020-08-20 13:51 Amit Cohen
  0 siblings, 0 replies; only message in thread
From: Amit Cohen @ 2020-08-20 13:51 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, mlxsw, Amit Cohen, Ido Schimmel, Jiri Pirko

From: Amit Cohen <>

Similar to other print functions we need to flush buffered data
in order to work with pipes and output redirects.

Without it, stdout output is buffered and not written to the disk.

This is useful when writing scripts that rely on devlink-monitor output.

Signed-off-by: Amit Cohen <>
Reviewed-by: Ido Schimmel <>
Reviewed-by: Jiri Pirko <>
 devlink/devlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 0ab0bca5..4b7d4452 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -4654,6 +4654,7 @@ static int cmd_mon_show_cb(const struct nlmsghdr *nlh, void *data)
 		pr_out_trap_policer(dl, tb, false);
+	fflush(stdout);
 	return MNL_CB_OK;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-20 13:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 13:51 [PATCH iproute2] devlink: Add fflush() in cmd_mon_show_cb() Amit Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).