summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2010-11-25 18:36:44 +0000
committerdim <dim@FreeBSD.org>2010-11-25 18:36:44 +0000
commitce4ad7ab6156be02b01fdf19735a19a9c4d5a8ad (patch)
tree7fb434479af2e2b02b32b54ca0e7312065b0f6ed /usr.sbin
parent71b42433f68a7680bcd07cef6c81b5a9bbe4e948 (diff)
parent835f186e056004cd67b3e5a1ee17f3ae1202646c (diff)
downloadFreeBSD-src-ce4ad7ab6156be02b01fdf19735a19a9c4d5a8ad.zip
FreeBSD-src-ce4ad7ab6156be02b01fdf19735a19a9c4d5a8ad.tar.gz
Sync: merge r215709 through r215824 from ^/head.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/iostat/iostat.818
-rw-r--r--usr.sbin/kernbb/Makefile12
-rw-r--r--usr.sbin/kernbb/kernbb.882
-rw-r--r--usr.sbin/kernbb/kernbb.c145
-rw-r--r--usr.sbin/usbdump/usbdump.c76
5 files changed, 55 insertions, 278 deletions
diff --git a/usr.sbin/iostat/iostat.8 b/usr.sbin/iostat/iostat.8
index 69fadcf..aab668a 100644
--- a/usr.sbin/iostat/iostat.8
+++ b/usr.sbin/iostat/iostat.8
@@ -60,7 +60,7 @@
.\"
.\" @(#)iostat.8 8.1 (Berkeley) 6/6/93
.\"
-.Dd April 17, 2006
+.Dd November 24, 2010
.Dt IOSTAT 8
.Os
.Sh NAME
@@ -102,11 +102,18 @@ Repeat the display
times.
If no repeat
.Ar count
-is specified, the default is infinity.
+is specified, the default depends on whether
+.Fl w
+is specified.
+With
+.Fl w
+the default repeat count is infinity, otherwise it is 1.
.It Fl C
Display CPU statistics.
This is on by default, unless
.Fl d
+or
+.Fl x
is specified.
.It Fl d
Display only device statistics.
@@ -231,6 +238,8 @@ output, up to the number of devices that can be displayed in
Display TTY statistics.
This is on by default, unless
.Fl d
+or
+.Fl x
is specified.
.It Fl w
Pause
@@ -255,6 +264,11 @@ so your mileage may vary.
.It Fl x
Show extended disk statistics.
Each disk is displayed on a line of its own with all available statistics.
+If this flag is turned on, only disk statistics will be displayed, unless
+.Fl C
+or
+.Fl T
+is also specified to enable the display of CPU or TTY statistics.
.It Fl z
If
.Fl x
diff --git a/usr.sbin/kernbb/Makefile b/usr.sbin/kernbb/Makefile
deleted file mode 100644
index f3bf37c..0000000
--- a/usr.sbin/kernbb/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $FreeBSD$
-
-PROG= kernbb
-MAN= kernbb.8
-
-DPADD= ${LIBKVM}
-LDADD= -lkvm
-
-CFLAGS+= -I${.CURDIR}/../../contrib/gcc
-
-.include <bsd.prog.mk>
-
diff --git a/usr.sbin/kernbb/kernbb.8 b/usr.sbin/kernbb/kernbb.8
deleted file mode 100644
index 3d6fe02..0000000
--- a/usr.sbin/kernbb/kernbb.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 22, 1995
-.Dt KERNBB 8
-.Os
-.Sh NAME
-.Nm kernbb
-.Nd generate a dump of the kernels basic-block profile buffers
-.Sh SYNOPSIS
-.Nm
-.Sh DESCRIPTION
-The
-.Nm
-utility is used to extract the basic-block profiling buffers of the running
-kernel into the files needed for the
-.Xr gcov 1
-tool.
-.Pp
-At least one source file in the running kernel must have been compiled
-with the
-.Fl Fl test-coverage
-and
-.Fl Fl profile-arcs
-options.
-.Pp
-The output is stored in the filenames compiled into the kernel by
-.Xr gcc 1 .
-If the absolute pathname cannot be written to, the directory part
-of the filename is discarded and the file stored in the current
-directory under its basename.
-.Pp
-The output files are named
-.Pa *.da ,
-and the
-.Xr gcov 1
-program will extract the counts and merge them with the source
-file to show actual execution counts.
-.Sh FILES
-.Bl -tag -width /boot/kernel/kernel -compact
-.It Pa /boot/kernel/kernel
-the default system
-.It Pa /dev/kmem
-the default memory
-.El
-.Sh SEE ALSO
-.Xr cc 1 ,
-.Xr gcov 1
-.Sh AUTHORS
-The
-.Nm
-utility was written by
-.An Poul-Henning Kamp ,
-along with the kernel-support.
-.Sh BUGS
-There are far too much magic and internal knowledge from GCC in this.
diff --git a/usr.sbin/kernbb/kernbb.c b/usr.sbin/kernbb/kernbb.c
deleted file mode 100644
index 1ecd5ad..0000000
--- a/usr.sbin/kernbb/kernbb.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <err.h>
-#include <fcntl.h>
-#include <kvm.h>
-#include <nlist.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/endian.h>
-
-typedef long long gcov_type;
-
-#define PARAMS(foo) foo
-#define ATTRIBUTE_UNUSED __unused
-#include "gcov-io.h"
-
-struct bbf {
- long checksum;
- int arc_count;
- u_long name;
-};
-
-struct bb {
- u_long zero_one;
- u_long filename;
- u_long counts;
- u_long ncounts;
- u_long next;
- u_long sizeof_bb;
- u_long funcs;
-};
-
-struct nlist namelist[] = {
- { "bbhead", 0, 0, 0, 0 },
- { NULL, 0, 0, 0, 0 }
-};
-
-kvm_t *kv;
-
-int
-main(int argc __unused, char **argv __unused)
-{
- int i, funcs;
- u_long l1,l2,l4;
- struct bb bb;
- struct bbf bbf;
- char buf[BUFSIZ], *p;
- gcov_type *q, *qr;
-
- FILE *f;
-
- kv = kvm_open(NULL,NULL,NULL,O_RDWR,"dnc");
- if (!kv)
- err(1,"kvm_open");
- i = kvm_nlist(kv,namelist);
- if (i)
- err(1,"kvm_nlist");
-
- l1 = namelist[0].n_value;
- kvm_read(kv,l1,&l2,sizeof l2);
- while(l2) {
- l1 += sizeof l1;
- kvm_read(kv,l2,&bb,sizeof bb);
-#if 0
-printf("%lx\n%lx\n%lx\n%lx\n%lx\n%lx\n%lx\n",
- bb.zero_one, bb.filename, bb.counts, bb.ncounts, bb.next,
- bb.sizeof_bb, bb.funcs);
-#endif
-
- funcs = 0;
- for (l4 = bb.funcs; ; l4 += sizeof (bbf)) {
- kvm_read(kv, l4, &bbf, sizeof(bbf));
- if (bbf.arc_count == -1)
- break;
- funcs++;
- }
-
- l2 = bb.next;
-
- kvm_read(kv, bb.filename, buf, sizeof(buf));
- p = buf;
- f = fopen(p, "w");
- if (f != NULL) {
- printf("Writing \"%s\"\n", p);
- } else {
- p = strrchr(buf, '/');
- if (p == NULL)
- p = buf;
- else
- p++;
- printf("Writing \"%s\" (spec \"%s\")\n", p, buf);
- f = fopen(p, "w");
- }
- if (f == NULL)
- err(1,"%s", p);
- __write_long(-123, f, 4);
-
- __write_long(funcs, f, 4);
-
- __write_long(4 + 8 + 8 + 4 + 8 + 8, f, 4);
-
- __write_long(bb.ncounts, f, 4);
- __write_long(0, f, 8);
- __write_long(0, f, 8);
-
- __write_long(bb.ncounts, f, 4);
- __write_long(0, f, 8);
- __write_long(0, f, 8);
-
- qr = malloc(bb.ncounts * 8);
- kvm_read(kv, bb.counts, qr, bb.ncounts * 8);
- q = qr;
- for (l4 = bb.funcs; ; l4 += sizeof (bbf)) {
- kvm_read(kv, l4, &bbf, sizeof(bbf));
- if (bbf.arc_count == -1)
- break;
- kvm_read(kv, bbf.name, buf, sizeof(buf));
-
- __write_gcov_string(buf, strlen(buf), f, -1);
-
- __write_long(bbf.checksum, f, 4);
- __write_long(bbf.arc_count, f, 4);
- for (i = 0; i < bbf.arc_count; i++) {
- __write_gcov_type(*q, f, 8);
- q++;
- }
- }
- fclose(f);
- free(qr);
- }
- return 0;
-}
diff --git a/usr.sbin/usbdump/usbdump.c b/usr.sbin/usbdump/usbdump.c
index 6545f1c..93e9f21 100644
--- a/usr.sbin/usbdump/usbdump.c
+++ b/usr.sbin/usbdump/usbdump.c
@@ -32,8 +32,11 @@
#include <sys/param.h>
#include <sys/endian.h>
#include <sys/ioctl.h>
+#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/utsname.h>
+#include <net/if.h>
+#include <net/bpf.h>
#include <dev/usb/usb.h>
#include <dev/usb/usb_pf.h>
#include <dev/usb/usbdi.h>
@@ -216,7 +219,7 @@ hexdump(const char *region, size_t len)
}
static void
-print_apacket(const struct usbpf_xhdr *hdr, struct usbpf_pkthdr *up,
+print_apacket(const struct bpf_xhdr *hdr, struct usbpf_pkthdr *up,
const char *payload)
{
struct tm *tm;
@@ -235,8 +238,8 @@ print_apacket(const struct usbpf_xhdr *hdr, struct usbpf_pkthdr *up,
up->up_error = le32toh(up->up_error);
up->up_interval = le32toh(up->up_interval);
- tv.tv_sec = hdr->uh_tstamp.ut_sec;
- tv.tv_usec = hdr->uh_tstamp.ut_frac;
+ tv.tv_sec = hdr->bh_tstamp.bt_sec;
+ tv.tv_usec = hdr->bh_tstamp.bt_frac;
tm = localtime(&tv.tv_sec);
len = strftime(buf, sizeof(buf), "%H:%M:%S", tm);
@@ -267,20 +270,19 @@ print_apacket(const struct usbpf_xhdr *hdr, struct usbpf_pkthdr *up,
print_status(up->up_status);
}
}
-
static void
print_packets(char *data, const int datalen)
{
struct usbpf_pkthdr *up;
- const struct usbpf_xhdr *hdr;
+ const struct bpf_xhdr *hdr;
u_int32_t framelen, x;
char *ptr, *next;
for (ptr = data; ptr < (data + datalen); ptr = next) {
- hdr = (const struct usbpf_xhdr *)ptr;
- up = (struct usbpf_pkthdr *)(ptr + hdr->uh_hdrlen);
- next = ptr + USBPF_WORDALIGN(hdr->uh_hdrlen + hdr->uh_caplen);
+ hdr = (const struct bpf_xhdr *)ptr;
+ up = (struct usbpf_pkthdr *)(ptr + hdr->bh_hdrlen);
+ next = ptr + BPF_WORDALIGN(hdr->bh_hdrlen + hdr->bh_caplen);
ptr = ((char *)up) + sizeof(struct usbpf_pkthdr);
if (w_arg == NULL)
@@ -404,12 +406,12 @@ int
main(int argc, char *argv[])
{
struct timeval tv;
- struct usbpf_insn total_insn;
- struct usbpf_program total_prog;
- struct usbpf_stat us;
- struct usbpf_version uv;
+ struct bpf_insn total_insn;
+ struct bpf_program total_prog;
+ struct bpf_stat us;
+ struct bpf_version bv;
struct usbcap uc, *p = &uc;
- struct usbpf_ifreq ufr;
+ struct ifreq ifr;
long snapshot = 192;
u_int v;
int fd, o;
@@ -454,37 +456,37 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
- p->fd = fd = open("/dev/usbpf", O_RDONLY);
+ p->fd = fd = open("/dev/bpf", O_RDONLY);
if (p->fd < 0) {
fprintf(stderr, "(no devices found)\n");
return (EXIT_FAILURE);
}
- if (ioctl(fd, UIOCVERSION, (caddr_t)&uv) < 0) {
- fprintf(stderr, "UIOCVERSION: %s\n", strerror(errno));
+ if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0) {
+ fprintf(stderr, "BIOCVERSION: %s\n", strerror(errno));
return (EXIT_FAILURE);
}
- if (uv.uv_major != USBPF_MAJOR_VERSION ||
- uv.uv_minor < USBPF_MINOR_VERSION) {
+ if (bv.bv_major != BPF_MAJOR_VERSION ||
+ bv.bv_minor < BPF_MINOR_VERSION) {
fprintf(stderr, "kernel bpf filter out of date");
return (EXIT_FAILURE);
}
- if ((ioctl(fd, UIOCGBLEN, (caddr_t)&v) < 0) || v < 65536)
- v = 65536;
+ if ((ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) || v < 4096)
+ v = 4096;
for ( ; v != 0; v >>= 1) {
- (void)ioctl(fd, UIOCSBLEN, (caddr_t)&v);
- (void)strncpy(ufr.ufr_name, i_arg, sizeof(ufr.ufr_name));
- if (ioctl(fd, UIOCSETIF, (caddr_t)&ufr) >= 0)
+ (void)ioctl(fd, BIOCSBLEN, (caddr_t)&v);
+ (void)strncpy(ifr.ifr_name, i_arg, sizeof(ifr.ifr_name));
+ if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) >= 0)
break;
}
if (v == 0) {
- fprintf(stderr, "UIOCSBLEN: %s: No buffer size worked", i_arg);
+ fprintf(stderr, "BIOCSBLEN: %s: No buffer size worked", i_arg);
return (EXIT_FAILURE);
}
- if (ioctl(fd, UIOCGBLEN, (caddr_t)&v) < 0) {
- fprintf(stderr, "UIOCGBLEN: %s", strerror(errno));
+ if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) {
+ fprintf(stderr, "BIOCGBLEN: %s", strerror(errno));
return (EXIT_FAILURE);
}
@@ -496,23 +498,23 @@ main(int argc, char *argv[])
}
/* XXX no read filter rules yet so at this moment accept everything */
- total_insn.code = (u_short)(USBPF_RET | USBPF_K);
+ total_insn.code = (u_short)(BPF_RET | BPF_K);
total_insn.jt = 0;
total_insn.jf = 0;
total_insn.k = snapshot;
- total_prog.uf_len = 1;
- total_prog.uf_insns = &total_insn;
- if (ioctl(p->fd, UIOCSETF, (caddr_t)&total_prog) < 0) {
- fprintf(stderr, "UIOCSETF: %s", strerror(errno));
+ total_prog.bf_len = 1;
+ total_prog.bf_insns = &total_insn;
+ if (ioctl(p->fd, BIOCSETF, (caddr_t)&total_prog) < 0) {
+ fprintf(stderr, "BIOCSETF: %s", strerror(errno));
return (EXIT_FAILURE);
}
/* 1 second read timeout */
tv.tv_sec = 1;
tv.tv_usec = 0;
- if (ioctl(p->fd, UIOCSRTIMEOUT, (caddr_t)&tv) < 0) {
- fprintf(stderr, "UIOCSRTIMEOUT: %s", strerror(errno));
+ if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&tv) < 0) {
+ fprintf(stderr, "BIOCSRTIMEOUT: %s", strerror(errno));
return (EXIT_FAILURE);
}
@@ -520,16 +522,16 @@ main(int argc, char *argv[])
do_loop(p);
- if (ioctl(fd, UIOCGSTATS, (caddr_t)&us) < 0) {
- fprintf(stderr, "UIOCGSTATS: %s", strerror(errno));
+ if (ioctl(fd, BIOCGSTATS, (caddr_t)&us) < 0) {
+ fprintf(stderr, "BIOCGSTATS: %s", strerror(errno));
return (EXIT_FAILURE);
}
/* XXX what's difference between pkt_captured and us.us_recv? */
printf("\n");
printf("%d packets captured\n", pkt_captured);
- printf("%d packets received by filter\n", us.us_recv);
- printf("%d packets dropped by kernel\n", us.us_drop);
+ printf("%d packets received by filter\n", us.bs_recv);
+ printf("%d packets dropped by kernel\n", us.bs_drop);
if (p->fd > 0)
close(p->fd);
OpenPOWER on IntegriCloud