DORMANTno replies REVIEWED: 4 (3M)

2 review trailers.

[PATCH iproute2] devlink: Add fflush() in cmd_mon_show_cb()

From: Amit Cohen <hidden>
Date: 2020-08-20 13:52:01
Subsystem: the rest · Maintainer: Linus Torvalds

From: Amit Cohen <redacted>

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 <redacted>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jiri Pirko <redacted>
---
 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);
 		break;
 	}
+	fflush(stdout);
 	return MNL_CB_OK;
 }
 
-- 
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help