FreeBSD Bugzilla – Attachment 153890 Details for
Bug 198347
[patch] continuous batch mode for gstat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add option -B to gstat
gstat-B.patch (text/plain), 2.20 KB, created by
Robert Schulze
on 2015-03-06 10:46:19 UTC
(
hide
)
Description:
Add option -B to gstat
Filename:
MIME Type:
Creator:
Robert Schulze
Created:
2015-03-06 10:46:19 UTC
Size:
2.20 KB
patch
obsolete
>diff -Naur gstat.orig/gstat.8 gstat/gstat.8 >--- gstat.orig/gstat.8 2015-03-06 09:39:41.000000000 +0000 >+++ gstat/gstat.8 2015-03-06 10:05:51.000000000 +0000 >@@ -32,7 +32,7 @@ > .Nd print statistics about GEOM disks > .Sh SYNOPSIS > .Nm >-.Op Fl abcdop >+.Op Fl abBcdop > .Op Fl f Ar filter > .Op Fl I Ar interval > .Sh DESCRIPTION >@@ -50,6 +50,10 @@ > Batch mode. > Collect numbers, print and exit. > Default if stdout is not a tty. >+.It Fl B >+Endless batch mode. >+Same as batch mode, but dont exit after collecting >+the first set of data. > .It Fl c > Enable display of > .Xr geom 4 >diff -Naur gstat.orig/gstat.c gstat/gstat.c >--- gstat.orig/gstat.c 2015-03-06 09:39:41.000000000 +0000 >+++ gstat/gstat.c 2015-03-06 10:38:40.000000000 +0000 >@@ -51,11 +51,11 @@ > #include <sysexits.h> > #include <unistd.h> > >-static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p; >+static int flag_a, flag_b, flag_c, flag_d, flag_o, flag_p, flag_B; > static int flag_I = 1000000; > > #define PRINTMSG(...) do { \ >- if (flag_b && !loop) \ >+ if ((flag_b && !loop) || (flag_B)) \ > printf(__VA_ARGS__); \ > else if (!flag_b) \ > printw(__VA_ARGS__); \ >@@ -99,12 +99,13 @@ > maxx = -1; > curx = -1; > loop = 1; >+ > /* Turn on batch mode if output is not tty. */ > if (!isatty(fileno(stdout))) > flag_b = 1; > > f_s[0] = '\0'; >- while ((i = getopt(argc, argv, "abdcf:I:op")) != -1) { >+ while ((i = getopt(argc, argv, "abBdcf:I:op")) != -1) { > switch (i) { > case 'a': > flag_a = 1; >@@ -112,6 +113,10 @@ > case 'b': > flag_b = 1; > break; >+ case 'B': >+ flag_B = 1; >+ flag_b = 1; >+ break; > case 'c': > flag_c = 1; > break; >@@ -208,7 +213,9 @@ > > geom_stats_snapshot_reset(sp); > geom_stats_snapshot_reset(sq); >- move(0,0); >+ if (!flag_b) >+ move(0,0); >+ > PRINTMSG("dT: %5.3fs w: %.3fs", dt, (float)flag_I / 1000000); > if (f_s[0] != '\0') { > PRINTMSG(" filter: "); >@@ -366,6 +373,8 @@ > if (!flag_b) > clrtoeol(); > PRINTMSG("\n"); >+ if (flag_B) >+ fflush(stdout); > *gsq = *gsp; > } > geom_stats_snapshot_free(sp); >@@ -373,7 +382,8 @@ > /* We loop extra to make sure we get the information. */ > if (!loop) > break; >- loop = 0; >+ if (!flag_B) >+ loop = 0; > usleep(flag_I); > continue; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198347
: 153890 |
154239