summaryrefslogtreecommitdiffstats
path: root/usr.sbin/slstat
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1994-11-19 13:57:21 +0000
committerjkh <jkh@FreeBSD.org>1994-11-19 13:57:21 +0000
commitc49122881a112d0f782f7e48538ba5e607e9bc1b (patch)
treeccb20d4bb5f107f44d527ced68940d5a2760a38a /usr.sbin/slstat
parent33879b3599a5b8bf60b3f49055c1e2a75bbcbe24 (diff)
downloadFreeBSD-src-c49122881a112d0f782f7e48538ba5e607e9bc1b.zip
FreeBSD-src-c49122881a112d0f782f7e48538ba5e607e9bc1b.tar.gz
Some miscellaneous bug fixes inspired by Adam Glass's work. Adam's
work is actually more comprehensive, but I just took what was needed for now given our compressed time schedules. Thanks, Adam! Submitted by: glass
Diffstat (limited to 'usr.sbin/slstat')
-rw-r--r--usr.sbin/slstat/slstat.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/slstat/slstat.c b/usr.sbin/slstat/slstat.c
index 1382518..87e9138 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.1.1 1994/06/17 06:42:39 rich Exp $";
+static char rcsid[] = "$Id: slstat.c,v 1.2 1994/10/17 06:05:32 davidg Exp $";
#endif
#include <stdio.h>
@@ -37,6 +37,7 @@ static char rcsid[] = "$Id: slstat.c,v 1.1.1.1 1994/06/17 06:42:39 rich Exp $";
#include <sys/mbuf.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/sockio.h>
#include <sys/file.h>
#include <errno.h>
#include <signal.h>
@@ -55,6 +56,9 @@ struct nlist nl[] = {
{ 0 }
};
+#define INTERFACE_PREFIX "sl%d"
+char interface[IFNAMSIZ];
+
const char *system = NULL;
char *kmemf = NULL;
@@ -99,9 +103,21 @@ main(argc, argv)
continue;
}
if (isdigit(argv[0][0])) {
+ int s;
+ struct ifreq ifr;
+
unit = atoi(argv[0]);
if (unit < 0)
usage();
+ sprintf(interface, INTERFACE_PREFIX, unit);
+ s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s < 0)
+ err(1, "creating socket");
+ strcpy(ifr.ifr_name, interface);
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)
+ errx(1,
+ "unable to confirm existence of interface '%s'",
+ interface);
++argv, --argc;
continue;
}
OpenPOWER on IntegriCloud