From patchwork Tue Jan 5 15:50:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 42131 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0172FB6EF4 for ; Wed, 6 Jan 2010 03:23:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754907Ab0AEQXT (ORCPT ); Tue, 5 Jan 2010 11:23:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754711Ab0AEQXT (ORCPT ); Tue, 5 Jan 2010 11:23:19 -0500 Received: from lanfw001a.cxnet.dk ([87.72.215.196]:49657 "EHLO lanfw001a.cxnet.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754126Ab0AEQXS (ORCPT ); Tue, 5 Jan 2010 11:23:18 -0500 Received: from firesoul.comx.local (unknown [172.31.4.134]) by lanfw001a.cxnet.dk (Postfix) with ESMTP id 856B1163531; Tue, 5 Jan 2010 16:50:52 +0100 (CET) Received: from firesoul.comx.local (localhost [127.0.0.1]) by firesoul.comx.local (Postfix) with ESMTP id 763A95A2F6; Tue, 5 Jan 2010 16:50:52 +0100 (CET) From: Jesper Dangaard Brouer Subject: [net-next PATCH] net: Make it easier to parse /proc/net/dev contents. To: "David S. Miller" Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org Date: Tue, 05 Jan 2010 16:50:52 +0100 Message-ID: <20100105155052.13309.1197.stgit@firesoul.comx.local> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The contents of /proc/net/dev is annoying to parse, because it changes whether there is a space after the "ethX:" or not. It depends upon the size of the "Receive bytes" counter, if the number is below 7 digits, then there is whitespaces else if the number is 8 digits or above there is no space between the ":" and the number. This patch changes the output to assure there is always a space between the ":" and the number. Given that all existing userspace application already need to handle the whitespaces, I see no breakage of existing tools. Signed-off-by: Jesper Dangaard Brouer Acked-by: Eric Dumazet --- net/core/dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/core/dev.c b/net/core/dev.c index f9aa699..3a86252 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3207,7 +3207,7 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) { const struct net_device_stats *stats = dev_get_stats(dev); - seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " + seq_printf(seq, "%6s: %7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", dev->name, stats->rx_bytes, stats->rx_packets, stats->rx_errors,