#include <stdio.h>
#include <kstat.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/vnode.h>
#include <sys/vfs.h>
#include <sys/statvfs.h>
#include <sys/fstyp.h>
#include <sys/fsid.h>
#include <sys/mnttab.h>
#include <sys/debug.h>
#include <values.h>
#include <poll.h>
#include <ctype.h>
#include <libintl.h>
#include <locale.h>
#include <signal.h>
#include <libcmdutils.h>
#include "statcommon.h"
#define PARSABLE_OUTPUT 0
#if PARSABLE_OUTPUT
#define OPTIONS "FPT:afginv"
#else
#define OPTIONS "FT:afginv"
#endif
#define NODATE 0
#define DDATE 1
#define UDATE 2
#define RETRY_DELAY 250
#define HEADERLINES 12
#define LBUFSZ 64
CTASSERT(LBUFSZ >= NN_NUMBUF_SZ);
#define NENTITY_INIT 1
#define VS_SIZE 2
#define CUR_INDEX (vs_i)
#define PREV_INDEX ((vs_i == 0) ? 1 : 0)
#define BUMP_INDEX() vs_i = ((vs_i == 0) ? 1 : 0)
typedef struct entity {
char *e_name;
vopstats_t *e_vs;
ulong_t e_fsid;
int e_type;
char e_ksname[KSTAT_STRLEN];
} entity_t;
#define ENTYPE_UNKNOWN 0
#define ENTYPE_FSTYPE 1
#define ENTYPE_MNTPT 2
char *cmdname;
int caught_cont = 0;
static uint_t timestamp_fmt = NODATE;
static int vs_i = 0;
static void
usage()
{
(void) fprintf(stderr, gettext(
"Usage: %s [-a|f|i|n|v] [-T d|u] {-F | {fstype | fspath}...} "
"[interval [count]]\n"), cmdname);
exit(2);
}
#define RAWVAL(ptr, member) ((ptr)->member.value.ui64)
#define DELTA(member) \
(newvsp->member.value.ui64 - (oldvsp ? oldvsp->member.value.ui64 : 0))
#define PRINTSTAT(isnice, nicestring, rawstring, rawval, buf) \
(isnice) ? \
nicenum(rawval, buf, sizeof (buf)), \
(void) printf((nicestring), (buf)) \
: \
(void) printf((rawstring), (rawval))
#define DISP_HEADER 0x1
#define DISP_RAW 0x2
int
dispflag_policy(int printhdr, int dispflag)
{
if ((dispflag & DISP_RAW) == 0) {
if (printhdr) {
dispflag |= DISP_HEADER;
}
}
return (dispflag);
}
static void
dflt_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag)
{
int niceflag = ((dispflag & DISP_RAW) == 0);
longlong_t nnewfile;
longlong_t nnamerm;
longlong_t nnamechg;
longlong_t nattrret;
longlong_t nattrchg;
longlong_t nlookup;
longlong_t nreaddir;
longlong_t ndataread;
longlong_t ndatawrite;
longlong_t readthruput;
longlong_t writethruput;
char buf[LBUFSZ];
nnewfile = DELTA(ncreate) + DELTA(nmkdir) + DELTA(nsymlink);
nnamerm = DELTA(nremove) + DELTA(nrmdir);
nnamechg = DELTA(nrename) + DELTA(nlink) + DELTA(nsymlink);
nattrret = DELTA(ngetattr) + DELTA(naccess) +
DELTA(ngetsecattr) + DELTA(nfid);
nattrchg = DELTA(nsetattr) + DELTA(nsetsecattr) + DELTA(nspace);
nlookup = DELTA(nlookup);
nreaddir = DELTA(nreaddir);
ndataread = DELTA(nread);
ndatawrite = DELTA(nwrite);
readthruput = DELTA(read_bytes);
writethruput = DELTA(write_bytes);
if (dispflag & DISP_HEADER) {
(void) printf(
" new name name attr attr lookup rddir read read write write\n"
" file remov chng get set ops ops ops bytes ops bytes\n");
}
PRINTSTAT(niceflag, "%5s ", "%lld:", nnewfile, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", nnamerm, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", nnamechg, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", nattrret, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", nattrchg, buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", nlookup, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", nreaddir, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", ndataread, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", readthruput, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", ndatawrite, buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", writethruput, buf);
(void) printf("%s\n", name);
}
static void
io_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag)
{
int niceflag = ((dispflag & DISP_RAW) == 0);
char buf[LBUFSZ];
if (dispflag & DISP_HEADER) {
(void) printf(
" read read write write rddir rddir rwlock rwulock\n"
" ops bytes ops bytes ops bytes ops ops\n");
}
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nread), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(read_bytes), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nwrite), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(write_bytes), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nreaddir), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(readdir_bytes), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nrwlock), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nrwunlock), buf);
(void) printf("%s\n", name);
}
static void
vm_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag)
{
int niceflag = ((dispflag & DISP_RAW) == 0);
char buf[LBUFSZ];
if (dispflag & DISP_HEADER) {
(void) printf(" map addmap delmap getpag putpag pagio\n");
}
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nmap), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(naddmap), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ndelmap), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ngetpage), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nputpage), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(npageio), buf);
(void) printf("%s\n", name);
}
static void
attr_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag)
{
int niceflag = ((dispflag & DISP_RAW) == 0);
char buf[LBUFSZ];
if (dispflag & DISP_HEADER) {
(void) printf("getattr setattr getsec setsec\n");
}
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ngetattr), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nsetattr), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(ngetsecattr), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nsetsecattr), buf);
(void) printf("%s\n", name);
}
static void
naming_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag)
{
int niceflag = ((dispflag & DISP_RAW) == 0);
char buf[LBUFSZ];
if (dispflag & DISP_HEADER) {
(void) printf(
"lookup creat remov link renam mkdir rmdir rddir symlnk rdlnk\n");
}
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nlookup), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(ncreate), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nremove), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nlink), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nrename), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nmkdir), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nrmdir), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nreaddir), buf);
PRINTSTAT(niceflag, " %5s ", "%lld:", DELTA(nsymlink), buf);
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(nreadlink), buf);
(void) printf("%s\n", name);
}
#define PRINT_VOPSTAT_CMN(niceflag, vop) \
if (niceflag) \
(void) printf("%10s ", #vop); \
PRINTSTAT(niceflag, "%5s ", "%lld:", DELTA(n##vop), buf);
#define PRINT_VOPSTAT(niceflag, vop) \
PRINT_VOPSTAT_CMN(niceflag, vop); \
if (niceflag) \
(void) printf("\n");
#define PRINT_VOPSTAT_IO(niceflag, vop) \
PRINT_VOPSTAT_CMN(niceflag, vop); \
PRINTSTAT(niceflag, " %5s\n", "%lld:", \
DELTA(vop##_bytes), buf);
static void
vop_display(char *name, vopstats_t *oldvsp, vopstats_t *newvsp, int dispflag)
{
int niceflag = ((dispflag & DISP_RAW) == 0);
char buf[LBUFSZ];
if (niceflag) {
(void) printf("%s\n", name);
(void) printf(" operation #ops bytes\n");
}
PRINT_VOPSTAT(niceflag, open);
PRINT_VOPSTAT(niceflag, close);
PRINT_VOPSTAT_IO(niceflag, read);
PRINT_VOPSTAT_IO(niceflag, write);
PRINT_VOPSTAT(niceflag, ioctl);
PRINT_VOPSTAT(niceflag, setfl);
PRINT_VOPSTAT(niceflag, getattr);
PRINT_VOPSTAT(niceflag, setattr);
PRINT_VOPSTAT(niceflag, access);
PRINT_VOPSTAT(niceflag, lookup);
PRINT_VOPSTAT(niceflag, create);
PRINT_VOPSTAT(niceflag, remove);
PRINT_VOPSTAT(niceflag, link);
PRINT_VOPSTAT(niceflag, rename);
PRINT_VOPSTAT(niceflag, mkdir);
PRINT_VOPSTAT(niceflag, rmdir);
PRINT_VOPSTAT_IO(niceflag, readdir);
PRINT_VOPSTAT(niceflag, symlink);
PRINT_VOPSTAT(niceflag, readlink);
PRINT_VOPSTAT(niceflag, fsync);
PRINT_VOPSTAT(niceflag, inactive);
PRINT_VOPSTAT(niceflag, fid);
PRINT_VOPSTAT(niceflag, rwlock);
PRINT_VOPSTAT(niceflag, rwunlock);
PRINT_VOPSTAT(niceflag, seek);
PRINT_VOPSTAT(niceflag, cmp);
PRINT_VOPSTAT(niceflag, frlock);
PRINT_VOPSTAT(niceflag, space);
PRINT_VOPSTAT(niceflag, realvp);
PRINT_VOPSTAT(niceflag, getpage);
PRINT_VOPSTAT(niceflag, putpage);
PRINT_VOPSTAT(niceflag, map);
PRINT_VOPSTAT(niceflag, addmap);
PRINT_VOPSTAT(niceflag, delmap);
PRINT_VOPSTAT(niceflag, poll);
PRINT_VOPSTAT(niceflag, dump);
PRINT_VOPSTAT(niceflag, pathconf);
PRINT_VOPSTAT(niceflag, pageio);
PRINT_VOPSTAT(niceflag, dumpctl);
PRINT_VOPSTAT(niceflag, dispose);
PRINT_VOPSTAT(niceflag, getsecattr);
PRINT_VOPSTAT(niceflag, setsecattr);
PRINT_VOPSTAT(niceflag, shrlock);
PRINT_VOPSTAT(niceflag, vnevent);
PRINT_VOPSTAT(niceflag, reqzcbuf);
PRINT_VOPSTAT(niceflag, retzcbuf);
if (niceflag) {
(void) printf("\n");
} else {
(void) printf("%s\n", name);
}
}
int
get_vopstats(kstat_ctl_t *kc, char *ksname, vopstats_t *vsp, kstat_t **kspp)
{
kstat_t *ksp;
if (ksname == NULL || *ksname == 0)
return (1);
errno = 0;
while (kstat_chain_update(kc) == -1) {
if (errno == EAGAIN) {
errno = 0;
(void) poll(NULL, 0, RETRY_DELAY);
continue;
}
perror("kstat_chain_update");
exit(1);
}
if ((ksp = kstat_lookup(kc, NULL, -1, ksname)) == NULL) {
return (1);
}
if (kstat_read(kc, ksp, vsp) == -1) {
return (1);
}
if (kspp)
*kspp = ksp;
return (0);
}
int
is_exception(char *fsname)
{
char **xlp;
static char *exception_list[] = {
"specfs",
"fifofs",
"fd",
"swapfs",
"ctfs",
"objfs",
"nfsdyn",
NULL
};
for (xlp = &exception_list[0]; *xlp != NULL; xlp++) {
if (strcmp(fsname, *xlp) == 0)
return (1);
}
return (0);
}
int
build_fstype_list(char ***fstypep)
{
int i;
int nfstype;
char buf[FSTYPSZ + 1];
if ((nfstype = sysfs(GETNFSTYP)) < 0) {
perror("sysfs(GETNFSTYP)");
return (0);
}
if ((*fstypep = calloc(nfstype, sizeof (char *))) == NULL) {
perror("calloc() fstypes");
return (0);
}
for (i = 1; i < nfstype; i++) {
if (sysfs(GETFSTYP, i, buf) < 0) {
perror("sysfs(GETFSTYP)");
return (0);
}
if (buf[0] == 0)
continue;
if (is_exception(buf))
continue;
if (((*fstypep)[i] = strdup(buf)) == NULL) {
perror("strdup() fstype name");
return (0);
}
}
return (i);
}
int
parse_operands(
int argc,
char **argv,
int optind,
long *interval,
long *count,
entity_t **entityp)
{
int nentities = 0;
int out_of_range;
if (argc == optind)
return (nentities);
if ((*entityp = calloc((argc - optind), sizeof (entity_t))) == NULL) {
perror("calloc() entities");
return (-1);
}
for (; argc > optind; optind++) {
const char *errstr;
if ((argc - optind) > 2) {
(*entityp)[nentities++].e_name = strdup(argv[optind]);
continue;
}
out_of_range = 0;
*interval = strtonum(argv[optind], 1, MAXLONG, &errstr);
if (errstr != NULL) {
if (errno == EINVAL) {
(*entityp)[nentities++].e_name =
strdup(argv[optind]);
continue;
}
if (errno == ERANGE) {
out_of_range++;
}
}
if ((argc - optind) == 1) {
if (out_of_range) {
(void) fprintf(stderr, gettext(
"interval must be between 1 and "
"%ld (inclusive)\n"), MAXLONG);
return (-1);
} else {
*count = MAXLONG;
break;
}
}
*count = strtonum(argv[optind + 1], 1, MAXLONG, &errstr);
if (errstr != NULL) {
if (errno == EINVAL) {
*interval = 0;
(*entityp)[nentities++].e_name =
strdup(argv[optind++]);
(*entityp)[nentities++].e_name =
strdup(argv[optind++]);
}
if (errno == ERANGE)
out_of_range++;
}
if (out_of_range != 0) {
(void) fprintf(stderr, gettext(
"Both interval and count must be between 1 "
"and %ld (inclusive)\n"), MAXLONG);
return (-1);
}
break;
}
return (nentities);
}
int
set_mntpt(entity_t *ep)
{
static struct mnt {
struct mnt *m_next;
char *m_mntpt;
ulong_t m_fsid;
} *mnt_list = NULL;
struct mnt *mntp;
struct statvfs64 statvfsbuf;
char *original_name = ep->e_name;
char path[PATH_MAX];
if (original_name == NULL)
return (1);
if (mnt_list == NULL) {
FILE *fp;
struct mnttab mnttab;
if ((fp = fopen(MNTTAB, "r")) == NULL) {
perror(MNTTAB);
return (1);
}
resetmnttab(fp);
while (getmntent(fp, &mnttab) == 0) {
if ((mntp = malloc(sizeof (*mntp))) == NULL) {
perror("malloc() mount list");
return (1);
}
mntp->m_mntpt = strdup(mnttab.mnt_mountp);
mntp->m_next = mnt_list;
mnt_list = mntp;
}
(void) fclose(fp);
}
if (realpath(original_name, path) == NULL) {
perror(original_name);
return (1);
}
for (mntp = mnt_list; mntp; mntp = mntp->m_next) {
if (strncmp(path, mntp->m_mntpt, strlen(mntp->m_mntpt)) == 0) {
if (mntp->m_fsid == 0) {
if (statvfs64(mntp->m_mntpt, &statvfsbuf)) {
continue;
} else {
mntp->m_fsid = statvfsbuf.f_fsid;
}
}
if (ep->e_fsid != mntp->m_fsid) {
continue;
}
break;
}
}
if (mntp == NULL) {
(void) fprintf(stderr, gettext(
"Can't find mount point for %s\n"), path);
return (1);
}
ep->e_name = strdup(mntp->m_mntpt);
free(original_name);
return (0);
}
void
set_ksnames(entity_t *entities, int nentities, char **fstypes, int nfstypes)
{
int i, j;
struct statvfs64 statvfsbuf;
for (i = 0; i < nentities; i++) {
entity_t *ep = &entities[i];
for (j = 1; j < nfstypes; j++) {
if (fstypes[j] && ep->e_name &&
strcmp(ep->e_name, fstypes[j]) == 0) {
ep->e_type = ENTYPE_FSTYPE;
(void) snprintf(ep->e_ksname, KSTAT_STRLEN,
"%s%s", VOPSTATS_STR, ep->e_name);
ep->e_vs = calloc(VS_SIZE, sizeof (vopstats_t));
if (entities[i].e_vs == NULL) {
perror("calloc() fstype vopstats");
exit(1);
}
break;
}
}
if (j < nfstypes)
continue;
if (is_exception(ep->e_name)) {
ep->e_ksname[0] = 0;
continue;
}
if (ep->e_name == NULL || statvfs64(ep->e_name, &statvfsbuf)) {
ep->e_ksname[0] = 0;
continue;
}
(void) snprintf(ep->e_ksname, KSTAT_STRLEN, "%s%lx",
VOPSTATS_STR, statvfsbuf.f_fsid);
ep->e_fsid = statvfsbuf.f_fsid;
if (set_mntpt(ep)) {
(void) fprintf(stderr,
gettext("Can't determine type of \"%s\"\n"),
ep->e_name ? ep->e_name : gettext("<NULL>"));
} else {
ep->e_type = ENTYPE_MNTPT;
}
ep->e_vs = calloc(VS_SIZE, sizeof (vopstats_t));
if (entities[i].e_vs == NULL) {
perror("calloc() vopstats array");
exit(1);
}
}
}
void
set_dispfunc(
void (**dspfunc)(char *, vopstats_t *, vopstats_t *, int),
void (*newfunc)(char *, vopstats_t *, vopstats_t *, int))
{
if (*dspfunc != dflt_display) {
(void) fprintf(stderr, gettext(
"%s: Display options -{a|f|i|n|v} are mutually exclusive\n"),
cmdname);
usage();
}
*dspfunc = newfunc;
}
int
main(int argc, char *argv[])
{
int c;
int i, j;
int nentities_found;
int linesout = 0;
int printhdr = 0;
int nfstypes;
int dispflag = 0;
long count = 0;
int forever;
long interval = 0;
boolean_t fstypes_only = B_FALSE;
char **fstypes;
int nentities;
entity_t *entities;
kstat_ctl_t *kc;
void (*dfunc)(char *, vopstats_t *, vopstats_t *, int) = dflt_display;
hrtime_t start_n;
hrtime_t period_n;
extern int optind;
(void) setlocale(LC_ALL, "");
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
(void) setvbuf(stdout, NULL, _IOLBF, 0);
cmdname = argv[0];
while ((c = getopt(argc, argv, OPTIONS)) != EOF) {
switch (c) {
default:
usage();
break;
case 'F':
fstypes_only = B_TRUE;
break;
#if PARSABLE_OUTPUT
case 'P':
dispflag |= DISP_RAW;
break;
#endif
case 'T':
if (optarg) {
if (strcmp(optarg, "u") == 0) {
timestamp_fmt = UDATE;
} else if (strcmp(optarg, "d") == 0) {
timestamp_fmt = DDATE;
}
}
if (timestamp_fmt == NODATE) {
(void) fprintf(stderr, gettext("%s: -T option "
"requires either 'u' or 'd'\n"), cmdname);
usage();
}
break;
case 'a':
set_dispfunc(&dfunc, attr_display);
break;
case 'f':
set_dispfunc(&dfunc, vop_display);
break;
case 'i':
set_dispfunc(&dfunc, io_display);
break;
case 'n':
set_dispfunc(&dfunc, naming_display);
break;
case 'v':
set_dispfunc(&dfunc, vm_display);
break;
}
}
#if PARSABLE_OUTPUT
if ((dispflag & DISP_RAW) && (timestamp_fmt != NODATE)) {
(void) fprintf(stderr, gettext(
"-P and -T options are mutually exclusive\n"));
usage();
}
#endif
if ((nfstypes = build_fstype_list(&fstypes)) == 0) {
(void) fprintf(stderr,
gettext("Can't build list of fstypes\n"));
exit(1);
}
nentities = parse_operands(
argc, argv, optind, &interval, &count, &entities);
forever = count == MAXLONG;
period_n = (hrtime_t)interval * NANOSEC;
if (nentities == -1)
usage();
if ((nentities == 0) && (fstypes_only == B_FALSE)) {
(void) fprintf(stderr, gettext(
"Must specify -F or at least one fstype or mount point\n"));
usage();
}
if ((nentities > 0) && (fstypes_only == B_TRUE)) {
(void) fprintf(stderr, gettext(
"Cannot use -F with fstypes or mount points\n"));
usage();
}
if ((nentities == 0) && (fstypes_only == B_TRUE)) {
if ((entities = calloc(nfstypes, sizeof (entity_t))) == NULL) {
perror("calloc() fstype stats");
exit(1);
}
for (i = 1; i < nfstypes; i++) {
if (fstypes[i]) {
entities[nentities].e_name = strdup(fstypes[i]);
nentities++;
}
}
}
set_ksnames(entities, nentities, fstypes, nfstypes);
if ((kc = kstat_open()) == NULL) {
perror("kstat_open");
exit(1);
}
start_n = gethrtime();
if (timestamp_fmt != NODATE) {
print_timestamp(timestamp_fmt);
linesout++;
}
for (j = 0, printhdr = 1; j < nentities; j++) {
entity_t *ent = &entities[j];
vopstats_t *vsp = &ent->e_vs[CUR_INDEX];
kstat_t *ksp = NULL;
if (get_vopstats(kc, ent->e_ksname, vsp, &ksp) == 0) {
(*dfunc)(ent->e_name, NULL, vsp,
dispflag_policy(printhdr, dispflag));
linesout++;
} else {
entities[j].e_ksname[0] = 0;
if (fstypes_only == B_FALSE) {
(void) fprintf(stderr, gettext(
"No statistics available for %s\n"),
entities[j].e_name);
}
}
printhdr = 0;
}
if (count > 1)
if (signal(SIGCONT, cont_handler) == SIG_ERR)
fail(1, "signal failed");
BUMP_INDEX();
i = 1;
while (forever || i++ <= count) {
if (linesout > HEADERLINES) {
linesout = 0;
printhdr = 1;
}
sleep_until(&start_n, period_n, forever, &caught_cont);
if (timestamp_fmt != NODATE) {
print_timestamp(timestamp_fmt);
linesout++;
}
for (j = 0, nentities_found = 0; j < nentities; j++) {
entity_t *ent = &entities[j];
if (ent->e_ksname[0] == 0) {
continue;
}
if (get_vopstats(kc, ent->e_ksname,
&ent->e_vs[CUR_INDEX], NULL) == 0) {
(*dfunc)(ent->e_name, &ent->e_vs[PREV_INDEX],
&ent->e_vs[CUR_INDEX],
dispflag_policy(printhdr, dispflag));
linesout++;
nentities_found++;
} else {
if (ent->e_type == ENTYPE_MNTPT) {
(void) printf(gettext(
"<<mount point no longer "
"available: %s>>\n"), ent->e_name);
} else if (ent->e_type == ENTYPE_FSTYPE) {
(void) printf(gettext(
"<<file system module no longer "
"loaded: %s>>\n"), ent->e_name);
} else {
(void) printf(gettext(
"<<%s no longer available>>\n"),
ent->e_name);
}
ent->e_ksname[0] = 0;
}
printhdr = 0;
}
BUMP_INDEX();
if (nentities_found == 0)
break;
}
return (0);
}