summaryrefslogtreecommitdiffstats
path: root/usr.sbin/slstat
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-10-17 06:05:32 +0000
committerdg <dg@FreeBSD.org>1994-10-17 06:05:32 +0000
commit1d409b9b7b95d08847b06810b32d63f8205560d9 (patch)
tree480a10ca85a3e936095d1606d50f67d4d8b81678 /usr.sbin/slstat
parent805eb48b1c7a62d0b9f7bf165e3e8cb579049afa (diff)
downloadFreeBSD-src-1d409b9b7b95d08847b06810b32d63f8205560d9.zip
FreeBSD-src-1d409b9b7b95d08847b06810b32d63f8205560d9.tar.gz
slstats for FBSD 2.0. Copied in the repository from 1.1.5, and then applied
patches from John Hay. Submitted by: John Hay
Diffstat (limited to 'usr.sbin/slstat')
-rw-r--r--usr.sbin/slstat/Makefile4
-rw-r--r--usr.sbin/slstat/slstat.c34
2 files changed, 25 insertions, 13 deletions
diff --git a/usr.sbin/slstat/Makefile b/usr.sbin/slstat/Makefile
index de18bc8..406d370 100644
--- a/usr.sbin/slstat/Makefile
+++ b/usr.sbin/slstat/Makefile
@@ -1,10 +1,10 @@
# from: @(#)Makefile 5.6 (Berkeley) 4/23/91
-# $Id: Makefile,v 1.1 1993/11/16 04:16:46 brezak Exp $
+# $Id: Makefile,v 1.1.1.1 1994/06/17 06:42:36 rich Exp $
PROG= slstat
MAN8= slstat.8
DPADD= ${LIBUTIL}
-LDADD= -lutil
+LDADD= -lkvm
BINGRP= kmem
BINMODE=2555
diff --git a/usr.sbin/slstat/slstat.c b/usr.sbin/slstat/slstat.c
index fe41c79..1382518 100644
--- a/usr.sbin/slstat/slstat.c
+++ b/usr.sbin/slstat/slstat.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: slstat.c,v 1.1 1993/11/16 04:16:48 brezak Exp $";
+static char rcsid[] = "$Id: slstat.c,v 1.1.1.1 1994/06/17 06:42:39 rich Exp $";
#endif
#include <stdio.h>
@@ -32,6 +32,7 @@ static char rcsid[] = "$Id: slstat.c,v 1.1 1993/11/16 04:16:48 brezak Exp $";
#define INET
+#include <limits.h>
#include <sys/param.h>
#include <sys/mbuf.h>
#include <sys/types.h>
@@ -51,12 +52,13 @@ static char rcsid[] = "$Id: slstat.c,v 1.1 1993/11/16 04:16:48 brezak Exp $";
struct nlist nl[] = {
#define N_SOFTC 0
{ "_sl_softc" },
- "",
+ { 0 }
};
-char *system = _PATH_UNIX;
+const char *system = NULL;
char *kmemf = NULL;
+kvm_t *kvm_h;
int kflag;
int rflag;
int vflag;
@@ -71,6 +73,10 @@ main(argc, argv)
char *argv[];
{
int c;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ system = getbootfile();
+
--argc; ++argv;
while (argc > 0) {
if (strcmp(argv[0], "-v") == 0) {
@@ -110,13 +116,14 @@ main(argc, argv)
kflag++;
}
}
- if (kvm_openfiles(system, kmemf, NULL) < 0) {
+ kvm_h = kvm_openfiles(system, kmemf, NULL, O_RDONLY, errbuf);
+ if (kvm_h == 0) {
(void)fprintf(stderr,
"slstat: kvm_openfiles(%s,%s,0): %s\n",
- system, kmemf, kvm_geterr());
+ system, kmemf, errbuf);
exit(1);
}
- if ((c = kvm_nlist(nl)) != 0) {
+ if ((c = kvm_nlist(kvm_h, nl)) != 0) {
if (c > 0) {
(void)fprintf(stderr,
"slstat: undefined symbols in %s:", system);
@@ -126,14 +133,15 @@ main(argc, argv)
(void)fputc('\n', stderr);
} else
(void)fprintf(stderr, "slstat: kvm_nlist: %s\n",
- kvm_geterr());
+ kvm_geterr(kvm_h));
exit(1);
}
intpr();
exit(0);
}
-#define V(offset) ((line % 20)? ((sc->offset - osc->offset) / (rflag ? interval : 1)) : sc->offset)
+#define V(offset) ((line % 20)? ((sc->offset - osc->offset) / \
+ (rflag ? interval : 1)) : sc->offset)
#define AMT (sizeof(*sc) - 2 * sizeof(sc->sc_comp.tstate))
usage()
@@ -167,7 +175,7 @@ intpr()
bzero((char *)osc, AMT);
while (1) {
- if (kread(addr, (char *)sc, AMT) < 0)
+ if (kvm_read(kvm_h, addr, (char *)sc, AMT) < 0)
perror("kmem read");
(void)signal(SIGALRM, catchalarm);
signalled = 0;
@@ -187,7 +195,7 @@ intpr()
putchar('\n');
}
printf("%8u %6d %6u %6u %6u",
- V(sc_bytesrcvd),
+ V(sc_if.if_ibytes),
V(sc_if.if_ipackets),
V(sc_comp.sls_compressedin),
V(sc_comp.sls_uncompressedin),
@@ -201,7 +209,7 @@ intpr()
V(sc_comp.sls_errorin),
V(sc_if.if_ierrors));
printf(" | %8u %6d %6u %6u %6u",
- V(sc_bytessent) / (rflag ? interval : 1),
+ V(sc_if.if_obytes) / (rflag ? interval : 1),
V(sc_if.if_opackets),
V(sc_comp.sls_compressed),
V(sc_comp.sls_packets) - V(sc_comp.sls_compressed),
@@ -236,6 +244,8 @@ catchalarm()
signalled = 1;
}
+#if 0
+
#include <kvm.h>
#include <fcntl.h>
@@ -285,3 +295,5 @@ kread(addr, buf, size)
return -1;
return 0;
}
+#endif
+
OpenPOWER on IntegriCloud