netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pavel Šimerda" <pavlix@pavlix.net>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, psimerda@redhat.com
Subject: [PATCH 7/7] lnstat: run indefinitely by default
Date: Mon, 13 Apr 2015 16:01:01 +0200	[thread overview]
Message-ID: <1428933661-8193-7-git-send-email-pavlix@pavlix.net> (raw)
In-Reply-To: <1428933661-8193-2-git-send-email-pavlix@pavlix.net>

From: Pavel Šimerda <psimerda@redhat.com>

See also:

 * https://bugzilla.redhat.com/show_bug.cgi?id=977845

Signed-off-by: Pavel Šimerda <psimerda@redhat.com>
---
 misc/lnstat.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/misc/lnstat.c b/misc/lnstat.c
index e105b70..0385cbb 100644
--- a/misc/lnstat.c
+++ b/misc/lnstat.c
@@ -249,7 +249,7 @@ int main(int argc, char **argv)
 		MODE_JSON,
 		MODE_NORMAL,
 	} mode = MODE_NORMAL;
-	unsigned long count = 1;
+	unsigned long count = 0;
 	struct table_hdr *header;
 	static struct field_params fp;
 	int num_req_files = 0;
@@ -362,7 +362,7 @@ int main(int argc, char **argv)
 		if (interval < 1 )
 			interval = 1;
 
-		for (i = 0; i < count; i++) {
+		for (i = 0; i < count || !count; ) {
 			lnstat_update(lnstat_files);
 			if (mode == MODE_JSON)
 				print_json(stdout, lnstat_files, &fp);
@@ -373,8 +373,10 @@ int main(int argc, char **argv)
 				print_line(stdout, lnstat_files, &fp);
 			}
 			fflush(stdout);
-			if (i < count - 1)
+			if (i < count - 1 || !count)
 				sleep(interval);
+			if (count)
+				++i;
 		}
 		break;
 	}
-- 
2.3.5

  parent reply	other threads:[~2015-04-13 14:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 14:00 [PATCH 2/7] turn Makefile more distribution friendly Pavel Šimerda
2015-04-13 14:00 ` [PATCH 3/7] ip-xfrm: support 'proto any' with 'sport' and 'dport' Pavel Šimerda
2015-04-13 14:00 ` [PATCH 4/7] cbq: fix find syntax in example Pavel Šimerda
2015-04-13 14:00 ` [PATCH 5/7] ip-route: don't hide routes with RTM_F_CLONED by default Pavel Šimerda
2015-05-04 15:37   ` Stephen Hemminger
2015-05-04 18:37     ` David Miller
2015-05-11 17:48       ` Pavel Šimerda
2015-04-13 14:01 ` [PATCH 6/7] lnstat: dump to stdout, not stderr Pavel Šimerda
2015-04-13 14:01 ` Pavel Šimerda [this message]
2015-04-20 16:55 ` [PATCH 2/7] turn Makefile more distribution friendly Stephen Hemminger
2015-04-21 15:32   ` Pavel Šimerda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428933661-8193-7-git-send-email-pavlix@pavlix.net \
    --to=pavlix@pavlix.net \
    --cc=netdev@vger.kernel.org \
    --cc=psimerda@redhat.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).