Permalink
Browse files

Print iostat headers every time terminal fills.

Each time terminal fills zpool iostat will print headers.
If -n flag is passed this behavior will be supressed.

Signed-off-by: Damian Wojslaw <damian@wojslaw.pl>
  • Loading branch information...
madwizard committed Jan 8, 2019
1 parent 5811e7c commit 647ca715cd99d90052e2673af8d60dc921312f80
Showing with 10 additions and 10 deletions.
  1. +10 −10 cmd/zpool/zpool_main.c
@@ -4748,7 +4748,7 @@ get_namewidth_iostat(zpool_handle_t *zhp, void *data)
* -w Display latency histograms
* -r Display request size histogram
* -T Display a timestamp in date(1) or Unix format
* -n Only print headers once
* -nOnly print headers once
*
* This command can be tricky because we want to be able to deal with pool
* creation/destruction as well as vdev configuration changes. The bulk of this
@@ -4764,8 +4764,8 @@ zpool_do_iostat(int argc, char **argv)
int npools;
float interval = 0;
unsigned long count = 0;
struct winsize win;
int winheight = 24; // Default number of terminal rows
>···struct winsize win;
>···int winheight = 24; // Default number of terminal rows
zpool_list_t *list;
boolean_t verbose = B_FALSE;
boolean_t latency = B_FALSE, l_histo = B_FALSE, rq_histo = B_FALSE;
@@ -4774,7 +4774,7 @@ zpool_do_iostat(int argc, char **argv)
boolean_t guid = B_FALSE;
boolean_t follow_links = B_FALSE;
boolean_t full_name = B_FALSE;
boolean_t headers_once = B_FALSE;
>···boolean_t headers_once = B_FALSE;
iostat_cbdata_t cb = { 0 };
char *cmd = NULL;

@@ -4848,9 +4848,9 @@ zpool_do_iostat(int argc, char **argv)
case 'y':
omit_since_boot = B_TRUE;
break;
case 'n':
headers_once = B_TRUE;
break;
>···>···>···case 'n':
>···>···>···headers_once = B_TRUE;
>···>···>···break;
case 'h':
usage(B_FALSE);
break;
@@ -4860,7 +4860,7 @@ zpool_do_iostat(int argc, char **argv)
exit(0);
} else {
fprintf(stderr,
gettext("invalid option '%c'\n"), optopt);
>···gettext("invalid option '%c'\n"), optopt);
}
usage(B_FALSE);
}
@@ -5013,8 +5013,8 @@ zpool_do_iostat(int argc, char **argv)
}


if(ioctl(1,TIOCGWINSZ, &win) != -1 && win.ws_row > 0)
winheight = win.ws_row;
>···if(ioctl(1,TIOCGWINSZ, &win) != -1 && win.ws_row > 0)
>···>···winheight = win.ws_row;

for (;;) {
if ((npools = pool_list_count(list)) == 0)

0 comments on commit 647ca71

Please sign in to comment.