Page MenuHomeFreeBSD

D23758.diff
No OneTemporary

D23758.diff

Index: head/usr.sbin/pstat/pstat.c
===================================================================
--- head/usr.sbin/pstat/pstat.c
+++ head/usr.sbin/pstat/pstat.c
@@ -95,6 +95,8 @@
#define NNAMES (sizeof(namelist) / sizeof(*namelist))
static struct nlist nl[NNAMES];
+#define SIZEHDR "Size"
+
static int humanflag;
static int usenumflag;
static int totalflag;
@@ -471,7 +473,12 @@
long blocksize;
const char *header;
- header = getbsize(&hlen, &blocksize);
+ if (humanflag) {
+ header = SIZEHDR;
+ hlen = sizeof(SIZEHDR);
+ } else {
+ header = getbsize(&hlen, &blocksize);
+ }
if (totalflag == 0)
(void)printf("%-15s %*s %8s %8s %8s\n",
"Device", hlen, header,
@@ -484,23 +491,30 @@
{
char usedbuf[5];
char availbuf[5];
+ char sizebuf[5];
int hlen, pagesize;
long blocksize;
pagesize = getpagesize();
getbsize(&hlen, &blocksize);
- printf("%-15s %*jd ", swdevname, hlen, CONVERT(nblks));
+ printf("%-15s ", swdevname);
if (humanflag) {
+ humanize_number(sizebuf, sizeof(sizebuf),
+ CONVERT_BLOCKS(nblks), "",
+ HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
humanize_number(usedbuf, sizeof(usedbuf),
CONVERT_BLOCKS(bused), "",
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
humanize_number(availbuf, sizeof(availbuf),
CONVERT_BLOCKS(bavail), "",
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
- printf("%8s %8s %5.0f%%\n", usedbuf, availbuf, bpercent);
+ printf("%8s %8s %8s %5.0f%%\n", sizebuf,
+ usedbuf, availbuf, bpercent);
} else {
- printf("%8jd %8jd %5.0f%%\n", (intmax_t)CONVERT(bused),
+ printf("%*jd %8jd %8jd %5.0f%%\n", hlen,
+ (intmax_t)CONVERT(nblks),
+ (intmax_t)CONVERT(bused),
(intmax_t)CONVERT(bavail), bpercent);
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Aug 4, 2:05 AM (38 m, 45 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35896194
Default Alt Text
D23758.diff (1 KB)

Event Timeline