From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 023B0C48BDA for ; Sun, 7 Jul 2019 08:02:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB28C20850 for ; Sun, 7 Jul 2019 08:02:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fR2juOQw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727330AbfGGICs (ORCPT ); Sun, 7 Jul 2019 04:02:48 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:40255 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727259AbfGGICr (ORCPT ); Sun, 7 Jul 2019 04:02:47 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 815831C2E; Sun, 7 Jul 2019 04:02:46 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 07 Jul 2019 04:02:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=rm7kWBoTiupsYJF0hXOuWHRvFGvVGtgnjz/KRcNVGbc=; b=fR2juOQw wJGfHLSxNcPu8ihr7XS8XTCQzJv7QxkVy2CapcmYkYIdH1K74BBr97abaYTQbY1k IAgqORcPidcBKI/esuTt2mvrHLgMIpRStqvtHGPzwPQiH8rJGluo5xNGyxcE5hnW aKs+Wb37CUyriHgIHsH/uzI0PLmfkKOSBFPpwdzx8vFY7ZRwpm6heTAVno3snVdC nkw5lhf2GCiELhbglIU42rNX1FNMAnjpap3VNnqifzxzpGaEt/4RY6t/I0Q5kvJJ JlQR2CODpDfWqzTrBzdmBHRSeLjJGZNv9KTng+k31rCL0eV1+OlPVM+tE/vzyUTb 7dvGNkb/Q1opbQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrfeejgdduvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepkfguohcuufgthhhimhhmvghluceoihguohhstghhsehiugho shgthhdrohhrgheqnecukfhppeduleefrdegjedrudeihedrvdehudenucfrrghrrghmpe hmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrghenucevlhhushhtvghr ufhiiigvpedt X-ME-Proxy: Received: from splinter.mtl.com (unknown [193.47.165.251]) by mail.messagingengine.com (Postfix) with ESMTPA id E781A8005B; Sun, 7 Jul 2019 04:02:43 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, jiri@mellanox.com, mlxsw@mellanox.com, dsahern@gmail.com, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, andy@greyhouse.net, pablo@netfilter.org, jakub.kicinski@netronome.com, pieter.jansenvanvuuren@netronome.com, andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com, Ido Schimmel Subject: [PATCH iproute2-next 6/7] devlink: Add fflush() to print functions Date: Sun, 7 Jul 2019 11:01:59 +0300 Message-Id: <20190707080200.3699-7-idosch@idosch.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190707080200.3699-1-idosch@idosch.org> References: <20190707075828.3315-1-idosch@idosch.org> <20190707080200.3699-1-idosch@idosch.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel Similar to commit 09e0528cf977 ("ip: mroute: add fflush to print_mroute"), we need to add fflush() to the print functions to get the following to work: # devlink mon &> log Without it, stdout output is buffered and not written to the disk. This is useful when writing tests that rely on devlink-monitor output. Signed-off-by: Ido Schimmel Acked-by: Jiri Pirko --- devlink/devlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devlink/devlink.c b/devlink/devlink.c index 817b74259ec3..6fa3be69ff1a 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -58,6 +58,7 @@ static int g_new_line_count; } \ fprintf(stdout, ##args); \ g_new_line_count = 0; \ + fflush(stdout); \ } while (0) #define pr_out_sp(num, args...) \ @@ -66,6 +67,7 @@ static int g_new_line_count; if (ret < num) \ fprintf(stdout, "%*s", num - ret, ""); \ g_new_line_count = 0; \ + fflush(stdout); \ } while (0) static int g_indent_level; -- 2.20.1