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
78 * Backoff to DECIMAL mode if humanize_number does not have FRACTIONAL mode.
81 #define HN_FRACTIONAL HN_DECIMAL
95 const size_t NL_LAST_MANDATORY
= NL_NUMVNODES
;
98 { "_mountlist", 0, 0, 0, 0 }, /* address of head of mount list. */
99 { "_numvnodes", 0, 0, 0, 0 },
100 { "_rc_tty", 0, 0, 0, 0 },
101 { "_nrc_tty", 0, 0, 0, 0 },
102 { "_cy_tty", 0, 0, 0, 0 },
103 { "_ncy_tty", 0, 0, 0, 0 },
104 { "_si__tty", 0, 0, 0, 0 },
105 { "_si_Nports", 0, 0, 0, 0 },
119 const char *usagestr
;
125 { MNT_RDONLY
, "rdonly" },
126 { MNT_SYNCHRONOUS
, "sync" },
127 { MNT_NOEXEC
, "noexec" },
128 { MNT_NOSUID
, "nosuid" },
129 { MNT_NODEV
, "nodev" },
130 { MNT_ASYNC
, "async" },
131 { MNT_SUIDDIR
, "suiddir" },
132 { MNT_SOFTDEP
, "softdep" },
133 { MNT_NOSYMFOLLOW
, "nosymfollow" },
134 { MNT_NOATIME
, "noatime" },
135 { MNT_NOCLUSTERR
, "noclusterread" },
136 { MNT_NOCLUSTERW
, "noclusterwrite" },
137 { MNT_EXRDONLY
, "exrdonly" },
138 { MNT_EXPORTED
, "exported" },
139 { MNT_DEFEXPORTED
, "defexported" },
140 { MNT_EXPORTANON
, "exportanon" },
141 { MNT_EXKERB
, "exkerb" },
142 { MNT_EXPUBLIC
, "public" },
143 { MNT_LOCAL
, "local" },
144 { MNT_QUOTA
, "quota" },
145 { MNT_ROOTFS
, "rootfs" },
146 { MNT_USER
, "user" },
147 { MNT_IGNORE
, "ignore" },
148 { MNT_UPDATE
, "update" },
149 { MNT_DELEXPORT
, "delexport" },
150 { MNT_RELOAD
, "reload" },
151 { MNT_FORCE
, "force" },
156 #define SVAR(var) __STRING(var) /* to force expansion */
157 #define KGET(idx, var) \
158 KGET1(idx, &var, sizeof(var), SVAR(var))
159 #define KGET1(idx, p, s, msg) \
160 KGET2(nl[idx].n_value, p, s, msg)
161 #define KGET2(addr, p, s, msg) \
162 if (kvm_read(kd, (u_long)(addr), p, s) != s) \
163 warnx("cannot read %s: %s", msg, kvm_geterr(kd))
164 #define KGETN(idx, var) \
165 KGET1N(idx, &var, sizeof(var), SVAR(var))
166 #define KGET1N(idx, p, s, msg) \
167 KGET2N(nl[idx].n_value, p, s, msg)
168 #define KGET2N(addr, p, s, msg) \
169 ((kvm_read(kd, (u_long)(addr), p, s) == s) ? 1 : 0)
170 #define KGETRET(addr, p, s, msg) \
171 if (kvm_read(kd, (u_long)(addr), p, s) != s) { \
172 warnx("cannot read %s: %s", msg, kvm_geterr(kd)); \
177 int getfiles(char **, int *);
179 getmnt(struct mount
*);
184 void mount_print(struct mount
*);
185 void nfs_header(void);
186 int nfs_print(struct vnode
*);
189 void ttyprt(struct tty
*, int);
190 void ttytype(struct tty
*, const char *, int, int, int);
191 void ufs_header(void);
192 int ufs_print(struct vnode
*);
193 static void usage(void);
194 void vnode_header(void);
195 void vnode_print(struct vnode
*, struct vnode
*);
196 void vnodemode(void);
198 static void Output(const char *name
, int hlen
,
199 struct kvm_swap
*kswap
, int flags
);
202 main(int argc
, char **argv
)
205 int fileflag
, ttyflag
, vnodeflag
;
206 char buf
[_POSIX2_LINE_MAX
];
209 fileflag
= swapflag
= ttyflag
= vnodeflag
= 0;
211 /* We will behave like good old swapinfo if thus invoked */
212 opts
= strrchr(argv
[0],'/');
217 if (!strcmp(opts
,"swapinfo")) {
220 usagestr
= "swapinfo [-ghkm] [-M core] [-N system]";
222 opts
= "TM:N:fhiknstv";
223 usagestr
= "pstat [-Tfhknst] [-M core] [-N system]";
226 while ((ch
= getopt(argc
, argv
, opts
)) != -1) {
232 if (setenv("BLOCKSIZE", "1G", 1) == -1)
233 warn("setenv: cannot set BLOCKSIZE=1K");
236 if (setenv("BLOCKSIZE", "1K", 1) == -1)
237 warn("setenv: cannot set BLOCKSIZE=1K");
240 if (setenv("BLOCKSIZE", "1M", 1) == -1)
241 warn("setenv: cannot set BLOCKSIZE=1K");
265 case 'i': /* Backward compatibility. */
266 errx(1, "vnode mode not supported");
279 * Discard setgid privileges if not the running kernel so that bad
280 * guys can't print interesting stuff from kernel memory.
282 if (nlistf
!= NULL
|| memf
!= NULL
)
285 if ((kd
= kvm_openfiles(nlistf
, memf
, NULL
, O_RDONLY
, buf
)) == NULL
)
286 errx(1, "kvm_openfiles: %s", buf
);
288 if (kcore_wrapper_open(nlistf
, memf
, buf
))
289 errx(1, "kcore_open: %s", buf
);
291 if ((ret
= kvm_nlist(kd
, nl
)) != 0) {
296 errx(1, "kvm_nlist: %s", kvm_geterr(kd
));
297 for (i
= 0; i
< NL_LAST_MANDATORY
; i
++) {
298 if (!nl
[i
].n_value
) {
300 warnx("undefined symbol: %s", nl
[i
].n_name
);
306 if (!(fileflag
| vnodeflag
| ttyflag
| swapflag
| totalflag
))
308 if (fileflag
|| totalflag
)
314 if (swapflag
|| totalflag
)
322 fprintf(stderr
, "usage: %s\n", usagestr
);
327 struct vnode
*avnode
;
334 struct e_vnode
*e_vnodebase
, *endvnode
, *evp
;
336 struct mount
*maddr
, *mp
= NULL
;
339 e_vnodebase
= loadvnodes(&numvnodes
);
341 printf("%7d vnodes\n", numvnodes
);
344 endvnode
= e_vnodebase
+ numvnodes
;
345 printf("%d active vnodes\n", numvnodes
);
348 #define ST mp->mnt_stat
350 for (evp
= e_vnodebase
; evp
< endvnode
; evp
++) {
352 if (vp
->v_mount
!= maddr
) {
356 if ((mp
= getmnt(vp
->v_mount
)) == NULL
)
361 if (!strcmp(ST
.f_fstypename
, "ufs") ||
362 !strcmp(ST
.f_fstypename
, "mfs"))
364 else if (!strcmp(ST
.f_fstypename
, "nfs"))
368 vnode_print(evp
->avnode
, vp
);
369 if (!strcmp(ST
.f_fstypename
, "ufs") ||
370 !strcmp(ST
.f_fstypename
, "mfs"))
372 else if (!strcmp(ST
.f_fstypename
, "nfs"))
382 printf("ADDR TYP VFLAG USE HOLD");
386 vnode_print(struct vnode
*avnode
, struct vnode
*vp
)
397 switch (vp
->v_type
) {
439 if (flag
& (VAGE0
| VAGE1
))
445 if (flag
& VONWORKLST
)
448 if (flag
& VINACTIVE
)
450 if (flag
& VRECLAIMED
)
459 * Convert SYSREF ref counts into something more
460 * human readable for display.
463 printf("%8lx %s %5s %08x %4d",
464 (u_long
)(void *)avnode
, type
, flags
, refs
, vp
->v_auxrefs
);
470 printf(" FILEID IFLAG RDEV|SZ");
474 ufs_print(struct vnode
*vp
)
477 struct inode inode
, *ip
= &inode
;
478 char flagbuf
[16], *flags
= flagbuf
;
482 KGETRET(VTOI(vp
), &inode
, sizeof(struct inode
), "vnode's inode");
484 if (flag
& IN_ACCESS
)
486 if (flag
& IN_CHANGE
)
488 if (flag
& IN_UPDATE
)
490 if (flag
& IN_MODIFIED
)
492 if (flag
& IN_RENAME
)
494 if (flag
& IN_SHLOCK
)
496 if (flag
& IN_EXLOCK
)
498 if (flag
& IN_HASHED
)
500 if (flag
& IN_LAZYMOD
)
506 printf(" %6ju %5s", (uintmax_t)ip
->i_number
, flagbuf
);
507 type
= ip
->i_mode
& S_IFMT
;
508 if (S_ISCHR(ip
->i_mode
) || S_ISBLK(ip
->i_mode
))
509 if (usenumflag
|| ((name
= devname(ip
->i_rdev
, type
)) == NULL
))
511 major(ip
->i_rdev
), minor(ip
->i_rdev
));
513 printf(" %7s", name
);
515 printf(" %7ju", (uintmax_t)ip
->i_size
);
522 printf(" FILEID NFLAG RDEV|SZ");
526 nfs_print(struct vnode
*vp
)
528 struct nfsnode nfsnode
, *np
= &nfsnode
;
529 char flagbuf
[16], *flags
= flagbuf
;
534 KGETRET(VTONFS(vp
), &nfsnode
, sizeof(nfsnode
), "vnode's nfsnode");
536 if (flag
& NFLUSHWANT
)
538 if (flag
& NFLUSHINPROG
)
540 if (flag
& NLMODIFIED
)
542 if (flag
& NRMODIFIED
)
544 if (flag
& NWRITEERR
)
546 if (flag
& NQNFSEVICTED
)
562 #define VT np->n_vattr
563 printf(" %6ju %5s", (uintmax_t)VT
.va_fileid
, flagbuf
);
564 type
= VT
.va_mode
& S_IFMT
;
565 if (S_ISCHR(VT
.va_mode
) || S_ISBLK(VT
.va_mode
))
566 if (usenumflag
|| ((name
= devname((VT
.va_rmajor
<< 8) | VT
.va_rminor
, type
)) == NULL
))
568 VT
.va_rmajor
, VT
.va_rminor
);
570 printf(" %7s", name
);
572 printf(" %7ju", (uintmax_t)np
->n_size
);
577 * Given a pointer to a mount structure in kernel space,
578 * read it in and return a usable pointer to it.
581 getmnt(struct mount
*maddr
)
590 for (mt
= mhead
; mt
!= NULL
; mt
= mt
->next
)
591 if (maddr
== mt
->maddr
)
593 if ((mt
= malloc(sizeof(struct mtab
))) == NULL
)
595 KGETRET(maddr
, &mt
->mount
, sizeof(struct mount
), "mount table");
603 mount_print(struct mount
*mp
)
607 #define ST mp->mnt_stat
608 printf("*** MOUNT %s %s on %s", ST
.f_fstypename
,
609 ST
.f_mntfromname
, ST
.f_mntonname
);
610 if ((flags
= mp
->mnt_flag
)) {
612 const char *sep
= " (";
614 for (i
= 0; mnt_flags
[i
].m_flag
; i
++) {
615 if (flags
& mnt_flags
[i
].m_flag
) {
616 printf("%s%s", sep
, mnt_flags
[i
].m_name
);
617 flags
&= ~mnt_flags
[i
].m_flag
;
622 printf("%sunknown_flags:%x", sep
, flags
);
630 loadvnodes(int *avnodes
)
634 struct e_vnode
*vnodebase
;
640 return (kinfo_vnodes(avnodes
));
644 if (sysctl(mib
, 2, NULL
, ©size
, NULL
, 0) == -1)
645 err(1, "sysctl: KERN_VNODE");
646 if ((vnodebase
= malloc(copysize
)) == NULL
)
648 if (sysctl(mib
, 2, vnodebase
, ©size
, NULL
, 0) == -1)
649 err(1, "sysctl: KERN_VNODE");
650 if (copysize
% sizeof(struct e_vnode
))
651 errx(1, "vnode size mismatch");
652 *avnodes
= copysize
/ sizeof(struct e_vnode
);
658 * simulate what a running kernel does in in kinfo_vnode
661 kinfo_vnodes(int *avnodes
)
663 struct mntlist mountlist
;
664 struct mount
*mp
, mounth
, *mp_next
;
665 struct vnode
*vp
, vnode
, *vp_next
;
666 char *vbuf
, *evbuf
, *bp
;
669 #define VPTRSZ sizeof(struct vnode *)
670 #define VNODESZ sizeof(struct vnode)
672 KGET(NL_NUMVNODES
, numvnodes
);
673 if ((vbuf
= malloc((numvnodes
+ 20) * (VPTRSZ
+ VNODESZ
))) == NULL
)
676 evbuf
= vbuf
+ (numvnodes
+ 20) * (VPTRSZ
+ VNODESZ
);
677 KGET(NL_MOUNTLIST
, mountlist
);
678 for (num
= 0, mp
= TAILQ_FIRST(&mountlist
); ; mp
= mp_next
) {
679 KGET2(mp
, &mounth
, sizeof(mounth
), "mount entry");
680 mp_next
= TAILQ_NEXT(&mounth
, mnt_list
);
681 for (vp
= TAILQ_FIRST(&mounth
.mnt_nvnodelist
);
682 vp
!= NULL
; vp
= vp_next
) {
683 KGET2(vp
, &vnode
, sizeof(vnode
), "vnode");
684 vp_next
= TAILQ_NEXT(&vnode
, v_nmntvnodes
);
685 if ((bp
+ VPTRSZ
+ VNODESZ
) > evbuf
)
686 /* XXX - should realloc */
687 errx(1, "no more room for vnodes");
688 memmove(bp
, &vp
, VPTRSZ
);
690 memmove(bp
, &vnode
, VNODESZ
);
694 if (mp
== TAILQ_LAST(&mountlist
, mntlist
))
698 return ((struct e_vnode
*)vbuf
);
702 " LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n";
709 struct tty ttyb
[1000];
715 error
= sysctlbyname("kern.ttys", &ttyb
, &len
, 0, 0);
717 len
/= sizeof(ttyb
[0]);
718 for (i
= 0; i
< len
; i
++) {
722 if ((tty
= malloc(ttyspace
* sizeof(*tty
))) == NULL
)
724 if (nl
[NL_NRC_TTY
].n_type
!= 0)
725 ttytype(tty
, "rc", NL_RC_TTY
, NL_NRC_TTY
, 0);
726 if (nl
[NL_NCY_TTY
].n_type
!= 0)
727 ttytype(tty
, "cy", NL_CY_TTY
, NL_NCY_TTY
, 0);
728 if (nl
[NL_SI_NPORTS
].n_type
!= 0)
729 ttytype(tty
, "si", NL_SI_TTY
, NL_SI_NPORTS
, 1);
734 ttytype(struct tty
*tty
, const char *name
, int type
, int number
, int indir
)
738 struct tty
**ttyaddr
;
743 printf("%d %s %s\n", ntty
, name
, (ntty
== 1) ? "line" : "lines");
744 if (ntty
> ttyspace
) {
746 if ((tty
= realloc(tty
, ttyspace
* sizeof(*tty
))) == NULL
)
751 KGET2(ttyaddr
, tty
, (ssize_t
)(ntty
* sizeof(struct tty
)),
754 KGET1(type
, tty
, (ssize_t
)(ntty
* sizeof(struct tty
)),
758 for (tp
= tty
; tp
< &tty
[ntty
]; tp
++)
759 ttyprt(tp
, tp
- tty
);
772 { TS_CONNECTED
, 'c'},
781 { TS_SO_OLOWAT
, 'A'},
783 #ifdef TS_SO_OCOMPLETE
784 { TS_SO_OCOMPLETE
, 'a'},
789 { TS_CAR_OFLOW
, 'm'},
792 { TS_CTS_OFLOW
, 'o'},
795 { TS_DSR_OFLOW
, 'd'},
804 #ifdef TS_CAN_BYPASS_L_RINT
805 { TS_CAN_BYPASS_L_RINT
, 'l'},
817 ttyprt(struct tty
*tp
, int line
)
821 char *name
, state
[20];
824 dev
= (uintptr_t)tp
->t_dev
& 0xffff; /* XXX t_dev is really dev_t */
826 if (usenumflag
|| dev
== 0 || (name
= devname(dev
, S_IFCHR
)) == NULL
)
827 printf("%7d ", line
);
829 printf("%7s ", name
);
830 printf("%2d %3d ", tp
->t_rawq
.c_cc
, tp
->t_canq
.c_cc
);
831 printf("%3d %5d %5d %4d %3d %7d ", tp
->t_outq
.c_cc
,
832 tp
->t_ihiwat
, tp
->t_ilowat
, tp
->t_ohiwat
, tp
->t_olowat
,
834 for (i
= j
= 0; ttystates
[i
].flag
; i
++)
835 if (tp
->t_state
&ttystates
[i
].flag
)
836 state
[j
++] = ttystates
[i
].val
;
840 printf("%-6s %8lx", state
, (u_long
)(void *)tp
->t_session
);
842 if (tp
->t_pgrp
!= NULL
)
843 KGET2(&tp
->t_pgrp
->pg_id
, &pgid
, sizeof(pid_t
), "pgid");
844 printf("%6d ", pgid
);
845 switch (tp
->t_line
) {
859 printf("%d\n", tp
->t_line
);
867 struct kinfo_file
*fp
, *ofp
;
869 char flagbuf
[16], *fbp
;
871 static const char *dtypes
[] = { "???", "inode", "socket" };
873 if (kinfo_get_maxfiles(&maxfile
))
874 err(1, "kinfo_get_maxfiles");
876 if (kinfo_get_openfiles(&nfile
))
877 err(1, "kinfo_get_openfiles");
878 printf("%3d/%3d files\n", nfile
, maxfile
);
881 if (kinfo_get_files(&fp
, &len
))
882 err(1, "kinfo_get_files");
885 printf("%zu/%d open files\n", len
, maxfile
);
886 printf(" LOC TYPE FLG CNT MSG DATA OFFSET\n");
887 for (; len
-- > 0; fp
++) {
888 if ((unsigned)fp
->f_type
> DTYPE_SOCKET
)
890 printf("%p ", fp
->f_file
);
891 printf("%-8.8s", dtypes
[fp
->f_type
]);
893 if (fp
->f_flag
& FREAD
)
895 if (fp
->f_flag
& FWRITE
)
897 if (fp
->f_flag
& FAPPEND
)
899 #ifdef FSHLOCK /* currently gone */
900 if (fp
->f_flag
& FSHLOCK
)
902 if (fp
->f_flag
& FEXLOCK
)
905 if (fp
->f_flag
& FASYNC
)
908 printf("%6s %3d", flagbuf
, fp
->f_count
);
909 printf(" %3d", fp
->f_msgcount
);
910 printf(" %8lx", (u_long
)(void *)fp
->f_data
);
911 if (fp
->f_offset
< 0)
912 printf(" %jx\n", (uintmax_t)fp
->f_offset
);
914 printf(" %jd\n", (intmax_t)fp
->f_offset
);
920 * swapmode is based on a program called swapinfo written
921 * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
926 struct kvm_swap kswap
[16];
932 pagesize
= getpagesize();
936 sizeof(kswap
)/sizeof(kswap
[0]),
937 ((swapflag
> 1) ? SWIF_DUMP_TREE
: 0) | SWIF_DEV_PREFIX
940 #define CONVERT(v) ((long)((quad_t)(v) * pagesize / blocksize))
941 #define CONVERTB(v) ((long)((quad_t)(v) * pagesize))
947 header
= getbsize(&hlen
, &blocksize
);
950 if (totalflag
== 0) {
951 printf("%-15s %*s %8s %8s %8s %s\n",
952 "Device", hlen
, header
,
953 "Used", "Avail", "Capacity", "Type");
955 for (i
= 0; i
< n
; ++i
) {
956 Output(kswap
[i
].ksw_devname
, hlen
, &kswap
[i
], 1);
964 humanize_number(buf1
, sizeof(buf1
),
965 CONVERTB(kswap
[n
].ksw_used
),
967 HN_AUTOSCALE
, HN_NOSPACE
|
969 humanize_number(buf2
, sizeof(buf2
),
970 CONVERTB(kswap
[n
].ksw_total
),
972 HN_AUTOSCALE
, HN_NOSPACE
|
974 printf("%s/%s swap space\n", buf1
, buf2
);
976 blocksize
= 1024 * 1024;
977 printf("%ldM/%ldM swap space\n",
978 CONVERT(kswap
[n
].ksw_used
),
979 CONVERT(kswap
[n
].ksw_total
));
982 Output("Total", hlen
, &kswap
[n
], 0);
988 Output(const char *name
, int hlen
, struct kvm_swap
*kswap
, int flags
)
995 humanize_number(buf1
, 6,
996 CONVERTB(kswap
->ksw_total
),
999 HN_NOSPACE
| HN_FRACTIONAL
);
1000 humanize_number(buf2
, 6,
1001 CONVERTB(kswap
->ksw_used
),
1004 HN_NOSPACE
| HN_FRACTIONAL
);
1005 humanize_number(buf3
, 6,
1006 CONVERTB(kswap
->ksw_total
-
1010 HN_NOSPACE
| HN_FRACTIONAL
);
1012 snprintf(buf1
, sizeof(buf1
), "%*ld",
1014 CONVERT(kswap
->ksw_total
));
1015 snprintf(buf2
, sizeof(buf2
), "%8ld",
1016 CONVERT(kswap
->ksw_used
));
1017 snprintf(buf3
, sizeof(buf2
), "%8ld",
1018 CONVERT(kswap
->ksw_total
-
1021 printf("%-15s %*s ", name
, hlen
, buf1
);
1022 printf("%8s %8s %5.0f%%",
1025 (double)kswap
->ksw_used
* 100.0 / (double)kswap
->ksw_total
);
1028 ((kswap
->ksw_flags
& SW_SEQUENTIAL
) ?
1029 "Sequential" : "Interleaved"));