2 * Copyright (c) 1980, 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * @(#) Copyright (c) 1980, 1991, 1993, 1994 The Regents of the University of California. All rights reserved.
30 * @(#)pstat.c 8.16 (Berkeley) 5/9/95
31 * $FreeBSD: src/usr.sbin/pstat/pstat.c,v 1.49.2.5 2002/07/12 09:12:49 des Exp $
35 #include <sys/kinfo.h>
36 #include <sys/param.h>
38 #include <sys/vnode.h>
39 #include <sys/ucred.h>
41 #include <vfs/ufs/quota.h>
42 #include <vfs/ufs/inode.h>
43 #include <sys/mount.h>
45 #include <sys/namei.h>
47 #include <nfs/rpcv2.h>
48 #include <nfs/nfsproto.h>
50 #include <nfs/nfsnode.h>
51 #include <sys/ioctl.h>
52 #include <sys/ioctl_compat.h> /* XXX NTTYDISC is too well hidden */
55 #include <sys/blist.h>
57 #include <sys/sysctl.h>
71 # define KCORE_KINFO_WRAPPER
88 const size_t NL_LAST_MANDATORY
= NL_NUMVNODES
;
91 { "_mountlist", 0, 0, 0, 0 }, /* address of head of mount list. */
92 { "_numvnodes", 0, 0, 0, 0 },
93 { "_rc_tty", 0, 0, 0, 0 },
94 { "_nrc_tty", 0, 0, 0, 0 },
95 { "_cy_tty", 0, 0, 0, 0 },
96 { "_ncy_tty", 0, 0, 0, 0 },
97 { "_si__tty", 0, 0, 0, 0 },
98 { "_si_Nports", 0, 0, 0, 0 },
112 const char *usagestr
;
118 { MNT_RDONLY
, "rdonly" },
119 { MNT_SYNCHRONOUS
, "sync" },
120 { MNT_NOEXEC
, "noexec" },
121 { MNT_NOSUID
, "nosuid" },
122 { MNT_NODEV
, "nodev" },
123 { MNT_ASYNC
, "async" },
124 { MNT_SUIDDIR
, "suiddir" },
125 { MNT_SOFTDEP
, "softdep" },
126 { MNT_NOSYMFOLLOW
, "nosymfollow" },
127 { MNT_NOATIME
, "noatime" },
128 { MNT_NOCLUSTERR
, "noclusterread" },
129 { MNT_NOCLUSTERW
, "noclusterwrite" },
130 { MNT_EXRDONLY
, "exrdonly" },
131 { MNT_EXPORTED
, "exported" },
132 { MNT_DEFEXPORTED
, "defexported" },
133 { MNT_EXPORTANON
, "exportanon" },
134 { MNT_EXKERB
, "exkerb" },
135 { MNT_EXPUBLIC
, "public" },
136 { MNT_LOCAL
, "local" },
137 { MNT_QUOTA
, "quota" },
138 { MNT_ROOTFS
, "rootfs" },
139 { MNT_USER
, "user" },
140 { MNT_IGNORE
, "ignore" },
141 { MNT_UPDATE
, "update" },
142 { MNT_DELEXPORT
, "delexport" },
143 { MNT_RELOAD
, "reload" },
144 { MNT_FORCE
, "force" },
149 #define SVAR(var) __STRING(var) /* to force expansion */
150 #define KGET(idx, var) \
151 KGET1(idx, &var, sizeof(var), SVAR(var))
152 #define KGET1(idx, p, s, msg) \
153 KGET2(nl[idx].n_value, p, s, msg)
154 #define KGET2(addr, p, s, msg) \
155 if (kvm_read(kd, (u_long)(addr), p, s) != s) \
156 warnx("cannot read %s: %s", msg, kvm_geterr(kd))
157 #define KGETN(idx, var) \
158 KGET1N(idx, &var, sizeof(var), SVAR(var))
159 #define KGET1N(idx, p, s, msg) \
160 KGET2N(nl[idx].n_value, p, s, msg)
161 #define KGET2N(addr, p, s, msg) \
162 ((kvm_read(kd, (u_long)(addr), p, s) == s) ? 1 : 0)
163 #define KGETRET(addr, p, s, msg) \
164 if (kvm_read(kd, (u_long)(addr), p, s) != s) { \
165 warnx("cannot read %s: %s", msg, kvm_geterr(kd)); \
170 int getfiles(char **, int *);
172 getmnt(struct mount
*);
177 void mount_print(struct mount
*);
178 void nfs_header(void);
179 int nfs_print(struct vnode
*);
182 void ttyprt(struct tty
*, int);
183 void ttytype(struct tty
*, const char *, int, int, int);
184 void ufs_header(void);
185 int ufs_print(struct vnode
*);
186 static void usage(void);
187 void vnode_header(void);
188 void vnode_print(struct vnode
*, struct vnode
*);
189 void vnodemode(void);
191 static void Output(const char *name
, int hlen
,
192 struct kvm_swap
*kswap
, int flags
);
195 main(int argc
, char **argv
)
198 int fileflag
, ttyflag
, vnodeflag
;
199 char buf
[_POSIX2_LINE_MAX
];
202 fileflag
= swapflag
= ttyflag
= vnodeflag
= 0;
204 /* We will behave like good old swapinfo if thus invoked */
205 opts
= strrchr(argv
[0],'/');
210 if (!strcmp(opts
,"swapinfo")) {
213 usagestr
= "swapinfo [-ghkm] [-M core] [-N system]";
215 opts
= "TM:N:fhiknstv";
216 usagestr
= "pstat [-Tfhknst] [-M core] [-N system]";
219 while ((ch
= getopt(argc
, argv
, opts
)) != -1) {
225 if (setenv("BLOCKSIZE", "1G", 1) == -1)
226 warn("setenv: cannot set BLOCKSIZE=1K");
229 if (setenv("BLOCKSIZE", "1K", 1) == -1)
230 warn("setenv: cannot set BLOCKSIZE=1K");
233 if (setenv("BLOCKSIZE", "1M", 1) == -1)
234 warn("setenv: cannot set BLOCKSIZE=1K");
258 case 'i': /* Backward compatibility. */
259 errx(1, "vnode mode not supported");
272 * Discard setgid privileges if not the running kernel so that bad
273 * guys can't print interesting stuff from kernel memory.
275 if (nlistf
!= NULL
|| memf
!= NULL
)
278 if ((kd
= kvm_openfiles(nlistf
, memf
, NULL
, O_RDONLY
, buf
)) == NULL
)
279 errx(1, "kvm_openfiles: %s", buf
);
281 if (kcore_wrapper_open(nlistf
, memf
, buf
))
282 errx(1, "kcore_open: %s", buf
);
284 if ((ret
= kvm_nlist(kd
, nl
)) != 0) {
289 errx(1, "kvm_nlist: %s", kvm_geterr(kd
));
290 for (i
= 0; i
< NL_LAST_MANDATORY
; i
++) {
291 if (!nl
[i
].n_value
) {
293 warnx("undefined symbol: %s", nl
[i
].n_name
);
299 if (!(fileflag
| vnodeflag
| ttyflag
| swapflag
| totalflag
))
301 if (fileflag
|| totalflag
)
307 if (swapflag
|| totalflag
)
315 fprintf(stderr
, "usage: %s\n", usagestr
);
320 struct vnode
*avnode
;
327 struct e_vnode
*e_vnodebase
, *endvnode
, *evp
;
329 struct mount
*maddr
, *mp
= NULL
;
332 e_vnodebase
= loadvnodes(&numvnodes
);
334 printf("%7d vnodes\n", numvnodes
);
337 endvnode
= e_vnodebase
+ numvnodes
;
338 printf("%d active vnodes\n", numvnodes
);
341 #define ST mp->mnt_stat
343 for (evp
= e_vnodebase
; evp
< endvnode
; evp
++) {
345 if (vp
->v_mount
!= maddr
) {
349 if ((mp
= getmnt(vp
->v_mount
)) == NULL
)
354 if (!strcmp(ST
.f_fstypename
, "ufs") ||
355 !strcmp(ST
.f_fstypename
, "mfs"))
357 else if (!strcmp(ST
.f_fstypename
, "nfs"))
361 vnode_print(evp
->avnode
, vp
);
362 if (!strcmp(ST
.f_fstypename
, "ufs") ||
363 !strcmp(ST
.f_fstypename
, "mfs"))
365 else if (!strcmp(ST
.f_fstypename
, "nfs"))
375 printf("ADDR TYP VFLAG USE HOLD");
379 vnode_print(struct vnode
*avnode
, struct vnode
*vp
)
390 switch (vp
->v_type
) {
432 if (flag
& (VAGE0
| VAGE1
))
438 if (flag
& VONWORKLST
)
441 if (flag
& VINACTIVE
)
443 if (flag
& VRECLAIMED
)
452 * Convert SYSREF ref counts into something more
453 * human readable for display.
456 printf("%8lx %s %5s %08x %4d",
457 (u_long
)(void *)avnode
, type
, flags
, refs
, vp
->v_auxrefs
);
463 printf(" FILEID IFLAG RDEV|SZ");
467 ufs_print(struct vnode
*vp
)
470 struct inode inode
, *ip
= &inode
;
471 char flagbuf
[16], *flags
= flagbuf
;
475 KGETRET(VTOI(vp
), &inode
, sizeof(struct inode
), "vnode's inode");
477 if (flag
& IN_ACCESS
)
479 if (flag
& IN_CHANGE
)
481 if (flag
& IN_UPDATE
)
483 if (flag
& IN_MODIFIED
)
485 if (flag
& IN_RENAME
)
487 if (flag
& IN_SHLOCK
)
489 if (flag
& IN_EXLOCK
)
491 if (flag
& IN_HASHED
)
493 if (flag
& IN_LAZYMOD
)
499 printf(" %6ju %5s", (uintmax_t)ip
->i_number
, flagbuf
);
500 type
= ip
->i_mode
& S_IFMT
;
501 if (S_ISCHR(ip
->i_mode
) || S_ISBLK(ip
->i_mode
))
502 if (usenumflag
|| ((name
= devname(ip
->i_rdev
, type
)) == NULL
))
504 major(ip
->i_rdev
), minor(ip
->i_rdev
));
506 printf(" %7s", name
);
508 printf(" %7ju", (uintmax_t)ip
->i_size
);
515 printf(" FILEID NFLAG RDEV|SZ");
519 nfs_print(struct vnode
*vp
)
521 struct nfsnode nfsnode
, *np
= &nfsnode
;
522 char flagbuf
[16], *flags
= flagbuf
;
527 KGETRET(VTONFS(vp
), &nfsnode
, sizeof(nfsnode
), "vnode's nfsnode");
529 if (flag
& NFLUSHWANT
)
531 if (flag
& NFLUSHINPROG
)
533 if (flag
& NLMODIFIED
)
535 if (flag
& NRMODIFIED
)
537 if (flag
& NWRITEERR
)
539 if (flag
& NQNFSEVICTED
)
555 #define VT np->n_vattr
556 printf(" %6ju %5s", (uintmax_t)VT
.va_fileid
, flagbuf
);
557 type
= VT
.va_mode
& S_IFMT
;
558 if (S_ISCHR(VT
.va_mode
) || S_ISBLK(VT
.va_mode
))
559 if (usenumflag
|| ((name
= devname((VT
.va_rmajor
<< 8) | VT
.va_rminor
, type
)) == NULL
))
561 VT
.va_rmajor
, VT
.va_rminor
);
563 printf(" %7s", name
);
565 printf(" %7ju", (uintmax_t)np
->n_size
);
570 * Given a pointer to a mount structure in kernel space,
571 * read it in and return a usable pointer to it.
574 getmnt(struct mount
*maddr
)
583 for (mt
= mhead
; mt
!= NULL
; mt
= mt
->next
)
584 if (maddr
== mt
->maddr
)
586 if ((mt
= malloc(sizeof(struct mtab
))) == NULL
)
588 KGETRET(maddr
, &mt
->mount
, sizeof(struct mount
), "mount table");
596 mount_print(struct mount
*mp
)
600 #define ST mp->mnt_stat
601 printf("*** MOUNT %s %s on %s", ST
.f_fstypename
,
602 ST
.f_mntfromname
, ST
.f_mntonname
);
603 if ((flags
= mp
->mnt_flag
)) {
605 const char *sep
= " (";
607 for (i
= 0; mnt_flags
[i
].m_flag
; i
++) {
608 if (flags
& mnt_flags
[i
].m_flag
) {
609 printf("%s%s", sep
, mnt_flags
[i
].m_name
);
610 flags
&= ~mnt_flags
[i
].m_flag
;
615 printf("%sunknown_flags:%x", sep
, flags
);
623 loadvnodes(int *avnodes
)
627 struct e_vnode
*vnodebase
;
633 return (kinfo_vnodes(avnodes
));
637 if (sysctl(mib
, 2, NULL
, ©size
, NULL
, 0) == -1)
638 err(1, "sysctl: KERN_VNODE");
639 if ((vnodebase
= malloc(copysize
)) == NULL
)
641 if (sysctl(mib
, 2, vnodebase
, ©size
, NULL
, 0) == -1)
642 err(1, "sysctl: KERN_VNODE");
643 if (copysize
% sizeof(struct e_vnode
))
644 errx(1, "vnode size mismatch");
645 *avnodes
= copysize
/ sizeof(struct e_vnode
);
651 * simulate what a running kernel does in in kinfo_vnode
654 kinfo_vnodes(int *avnodes
)
656 struct mntlist mountlist
;
657 struct mount
*mp
, mounth
, *mp_next
;
658 struct vnode
*vp
, vnode
, *vp_next
;
659 char *vbuf
, *evbuf
, *bp
;
662 #define VPTRSZ sizeof(struct vnode *)
663 #define VNODESZ sizeof(struct vnode)
665 KGET(NL_NUMVNODES
, numvnodes
);
666 if ((vbuf
= malloc((numvnodes
+ 20) * (VPTRSZ
+ VNODESZ
))) == NULL
)
669 evbuf
= vbuf
+ (numvnodes
+ 20) * (VPTRSZ
+ VNODESZ
);
670 KGET(NL_MOUNTLIST
, mountlist
);
671 for (num
= 0, mp
= TAILQ_FIRST(&mountlist
); ; mp
= mp_next
) {
672 KGET2(mp
, &mounth
, sizeof(mounth
), "mount entry");
673 mp_next
= TAILQ_NEXT(&mounth
, mnt_list
);
674 for (vp
= TAILQ_FIRST(&mounth
.mnt_nvnodelist
);
675 vp
!= NULL
; vp
= vp_next
) {
676 KGET2(vp
, &vnode
, sizeof(vnode
), "vnode");
677 vp_next
= TAILQ_NEXT(&vnode
, v_nmntvnodes
);
678 if ((bp
+ VPTRSZ
+ VNODESZ
) > evbuf
)
679 /* XXX - should realloc */
680 errx(1, "no more room for vnodes");
681 memmove(bp
, &vp
, VPTRSZ
);
683 memmove(bp
, &vnode
, VNODESZ
);
687 if (mp
== TAILQ_LAST(&mountlist
, mntlist
))
691 return ((struct e_vnode
*)vbuf
);
695 " LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n";
702 struct tty ttyb
[1000];
708 error
= sysctlbyname("kern.ttys", &ttyb
, &len
, 0, 0);
710 len
/= sizeof(ttyb
[0]);
711 for (i
= 0; i
< len
; i
++) {
715 if ((tty
= malloc(ttyspace
* sizeof(*tty
))) == NULL
)
717 if (nl
[NL_NRC_TTY
].n_type
!= 0)
718 ttytype(tty
, "rc", NL_RC_TTY
, NL_NRC_TTY
, 0);
719 if (nl
[NL_NCY_TTY
].n_type
!= 0)
720 ttytype(tty
, "cy", NL_CY_TTY
, NL_NCY_TTY
, 0);
721 if (nl
[NL_SI_NPORTS
].n_type
!= 0)
722 ttytype(tty
, "si", NL_SI_TTY
, NL_SI_NPORTS
, 1);
727 ttytype(struct tty
*tty
, const char *name
, int type
, int number
, int indir
)
731 struct tty
**ttyaddr
;
736 printf("%d %s %s\n", ntty
, name
, (ntty
== 1) ? "line" : "lines");
737 if (ntty
> ttyspace
) {
739 if ((tty
= realloc(tty
, ttyspace
* sizeof(*tty
))) == NULL
)
744 KGET2(ttyaddr
, tty
, (ssize_t
)(ntty
* sizeof(struct tty
)),
747 KGET1(type
, tty
, (ssize_t
)(ntty
* sizeof(struct tty
)),
751 for (tp
= tty
; tp
< &tty
[ntty
]; tp
++)
752 ttyprt(tp
, tp
- tty
);
765 { TS_CONNECTED
, 'c'},
774 { TS_SO_OLOWAT
, 'A'},
776 #ifdef TS_SO_OCOMPLETE
777 { TS_SO_OCOMPLETE
, 'a'},
782 { TS_CAR_OFLOW
, 'm'},
785 { TS_CTS_OFLOW
, 'o'},
788 { TS_DSR_OFLOW
, 'd'},
797 #ifdef TS_CAN_BYPASS_L_RINT
798 { TS_CAN_BYPASS_L_RINT
, 'l'},
810 ttyprt(struct tty
*tp
, int line
)
814 char *name
, state
[20];
817 dev
= (uintptr_t)tp
->t_dev
& 0xffff; /* XXX t_dev is really dev_t */
819 if (usenumflag
|| dev
== 0 || (name
= devname(dev
, S_IFCHR
)) == NULL
)
820 printf("%7d ", line
);
822 printf("%7s ", name
);
823 printf("%2d %3d ", tp
->t_rawq
.c_cc
, tp
->t_canq
.c_cc
);
824 printf("%3d %5d %5d %4d %3d %7d ", tp
->t_outq
.c_cc
,
825 tp
->t_ihiwat
, tp
->t_ilowat
, tp
->t_ohiwat
, tp
->t_olowat
,
827 for (i
= j
= 0; ttystates
[i
].flag
; i
++)
828 if (tp
->t_state
&ttystates
[i
].flag
)
829 state
[j
++] = ttystates
[i
].val
;
833 printf("%-6s %8lx", state
, (u_long
)(void *)tp
->t_session
);
835 if (tp
->t_pgrp
!= NULL
)
836 KGET2(&tp
->t_pgrp
->pg_id
, &pgid
, sizeof(pid_t
), "pgid");
837 printf("%6d ", pgid
);
838 switch (tp
->t_line
) {
852 printf("%d\n", tp
->t_line
);
860 struct kinfo_file
*fp
, *ofp
;
862 char flagbuf
[16], *fbp
;
864 static const char *dtypes
[] = { "???", "inode", "socket" };
866 if (kinfo_get_maxfiles(&maxfile
))
867 err(1, "kinfo_get_maxfiles");
869 if (kinfo_get_openfiles(&nfile
))
870 err(1, "kinfo_get_openfiles");
871 printf("%3d/%3d files\n", nfile
, maxfile
);
874 if (kinfo_get_files(&fp
, &len
))
875 err(1, "kinfo_get_files");
878 printf("%zu/%d open files\n", len
, maxfile
);
879 printf(" LOC TYPE FLG CNT MSG DATA OFFSET\n");
880 for (; len
-- > 0; fp
++) {
881 if ((unsigned)fp
->f_type
> DTYPE_SOCKET
)
883 printf("%p ", fp
->f_file
);
884 printf("%-8.8s", dtypes
[fp
->f_type
]);
886 if (fp
->f_flag
& FREAD
)
888 if (fp
->f_flag
& FWRITE
)
890 if (fp
->f_flag
& FAPPEND
)
892 #ifdef FSHLOCK /* currently gone */
893 if (fp
->f_flag
& FSHLOCK
)
895 if (fp
->f_flag
& FEXLOCK
)
898 if (fp
->f_flag
& FASYNC
)
901 printf("%6s %3d", flagbuf
, fp
->f_count
);
902 printf(" %3d", fp
->f_msgcount
);
903 printf(" %8lx", (u_long
)(void *)fp
->f_data
);
904 if (fp
->f_offset
< 0)
905 printf(" %jx\n", (uintmax_t)fp
->f_offset
);
907 printf(" %jd\n", (intmax_t)fp
->f_offset
);
913 * swapmode is based on a program called swapinfo written
914 * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
919 struct kvm_swap kswap
[16];
925 pagesize
= getpagesize();
929 sizeof(kswap
)/sizeof(kswap
[0]),
930 ((swapflag
> 1) ? SWIF_DUMP_TREE
: 0) | SWIF_DEV_PREFIX
933 #define CONVERT(v) ((long)((quad_t)(v) * pagesize / blocksize))
934 #define CONVERTB(v) ((long)((quad_t)(v) * pagesize))
940 header
= getbsize(&hlen
, &blocksize
);
943 if (totalflag
== 0) {
944 printf("%-15s %*s %8s %8s %8s %s\n",
945 "Device", hlen
, header
,
946 "Used", "Avail", "Capacity", "Type");
948 for (i
= 0; i
< n
; ++i
) {
949 Output(kswap
[i
].ksw_devname
, hlen
, &kswap
[i
], 1);
957 humanize_number(buf1
, sizeof(buf1
),
958 CONVERTB(kswap
[n
].ksw_used
),
960 HN_AUTOSCALE
, HN_NOSPACE
| HN_DECIMAL
);
961 humanize_number(buf2
, sizeof(buf2
),
962 CONVERTB(kswap
[n
].ksw_total
),
964 HN_AUTOSCALE
, HN_NOSPACE
| HN_DECIMAL
);
965 printf("%s/%s swap space\n", buf1
, buf2
);
967 blocksize
= 1024 * 1024;
968 printf("%ldM/%ldM swap space\n",
969 CONVERT(kswap
[n
].ksw_used
),
970 CONVERT(kswap
[n
].ksw_total
));
973 Output("Total", hlen
, &kswap
[n
], 0);
979 Output(const char *name
, int hlen
, struct kvm_swap
*kswap
, int flags
)
986 humanize_number(buf1
, 6,
987 CONVERTB(kswap
->ksw_total
),
990 HN_NOSPACE
| HN_DECIMAL
);
991 humanize_number(buf2
, 6,
992 CONVERTB(kswap
->ksw_used
),
995 HN_NOSPACE
| HN_DECIMAL
);
996 humanize_number(buf3
, 6,
997 CONVERTB(kswap
->ksw_total
-
1001 HN_NOSPACE
| HN_DECIMAL
);
1003 snprintf(buf1
, sizeof(buf1
), "%*ld",
1005 CONVERT(kswap
->ksw_total
));
1006 snprintf(buf2
, sizeof(buf2
), "%8ld",
1007 CONVERT(kswap
->ksw_used
));
1008 snprintf(buf3
, sizeof(buf2
), "%8ld",
1009 CONVERT(kswap
->ksw_total
-
1012 printf("%-15s %*s ", name
, hlen
, buf1
);
1013 printf("%8s %8s %5.0f%%",
1016 (double)kswap
->ksw_used
* 100.0 / (double)kswap
->ksw_total
);
1019 ((kswap
->ksw_flags
& SW_SEQUENTIAL
) ?
1020 "Sequential" : "Interleaved"));