Use -M and -N for core and kernel image respectively.
This commit is contained in:
parent
6e141df200
commit
aa727a5535
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167731
@ -29,7 +29,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 19, 2007
|
.Dd March 20, 2007
|
||||||
.Dt IFMCSTAT 8
|
.Dt IFMCSTAT 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -39,7 +39,8 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Op Fl i Ar interface
|
.Op Fl i Ar interface
|
||||||
.Op Fl f Ar address-family
|
.Op Fl f Ar address-family
|
||||||
.Op Fl k Ar kernel
|
.Op Fl M Ar core
|
||||||
|
.Op Fl N Ar system
|
||||||
.Nm
|
.Nm
|
||||||
.Op Ar kernel
|
.Op Ar kernel
|
||||||
.\"
|
.\"
|
||||||
@ -59,13 +60,17 @@ specifies the address-family to be displayed; currently only
|
|||||||
and
|
and
|
||||||
.Ar inet6
|
.Ar inet6
|
||||||
are supported.
|
are supported.
|
||||||
.It Fl k Ar kernel
|
.It Fl M Ar core
|
||||||
|
extracts values associated with the name list from the specified core,
|
||||||
|
instead of the default
|
||||||
|
.Pa /dev/kmem .
|
||||||
|
.It Fl N Ar system
|
||||||
extracts the name list from the specified kernel instead of the
|
extracts the name list from the specified kernel instead of the
|
||||||
default, which is the kernel image the system has booted from.
|
default, which is the kernel image the system has booted from.
|
||||||
.It Nm Ar kernel
|
.It Nm Ar system
|
||||||
This is the same as specifying
|
This is the same as specifying
|
||||||
.Nm
|
.Nm
|
||||||
.Fl k Ar kernel .
|
.Fl N Ar system .
|
||||||
This usage is deprecated; it is supported only for backwards compatibility.
|
This usage is deprecated; it is supported only for backwards compatibility.
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
.Nm
|
.Nm
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO: use -M, -N for kernel/namelist. */
|
|
||||||
/* TODO: use sysctl. */
|
/* TODO: use sysctl. */
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
@ -151,12 +150,13 @@ int main(argc, argv)
|
|||||||
int c;
|
int c;
|
||||||
struct ifnet *ifp, *nifp, ifnet;
|
struct ifnet *ifp, *nifp, ifnet;
|
||||||
const char *kernel = NULL;
|
const char *kernel = NULL;
|
||||||
|
const char *core = NULL;
|
||||||
|
|
||||||
/* "ifmcstat [kernel]" format is supported for backward compatiblity */
|
/* "ifmcstat [kernel]" format is supported for backward compatiblity */
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
kernel = argv[1];
|
kernel = argv[1];
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "i:f:k:")) != -1) {
|
while ((c = getopt(argc, argv, "i:f:M:N:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i':
|
case 'i':
|
||||||
if ((ifindex = if_nametoindex(optarg)) == 0) {
|
if ((ifindex = if_nametoindex(optarg)) == 0) {
|
||||||
@ -176,17 +176,22 @@ int main(argc, argv)
|
|||||||
fprintf(stderr, "%s: unknown address family\n", optarg);
|
fprintf(stderr, "%s: unknown address family\n", optarg);
|
||||||
exit(1);
|
exit(1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
case 'k':
|
case 'M':
|
||||||
|
core = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
kernel = strdup(optarg);
|
kernel = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "usage: ifmcstat [-i interface] [-f address family] [-k kernel]\n");
|
fprintf(stderr,
|
||||||
|
"usage: ifmcstat [-i interface] [-f address family] [-M core] [-N system]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((kvmd = kvm_openfiles(kernel, NULL, NULL, O_RDONLY, buf)) == NULL) {
|
if ((kvmd = kvm_openfiles(kernel, core, NULL, O_RDONLY, buf)) ==
|
||||||
|
NULL) {
|
||||||
perror("kvm_openfiles");
|
perror("kvm_openfiles");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user