diff options
author | pjd <pjd@FreeBSD.org> | 2007-02-06 17:57:20 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-02-06 17:57:20 +0000 |
commit | 7397d5d7b94193f8d722b4d992322d9bc3f83076 (patch) | |
tree | 109bcb3998fed27adbdd94d05b3d8bd11c47e4c4 /tools/tools | |
parent | 477d310a8e743bae47362dca26446244080eea4f (diff) | |
download | FreeBSD-src-7397d5d7b94193f8d722b4d992322d9bc3f83076.zip FreeBSD-src-7397d5d7b94193f8d722b4d992322d9bc3f83076.tar.gz |
Allow to use umastat on coredumps.
Reviewed by: rwatson
Diffstat (limited to 'tools/tools')
-rw-r--r-- | tools/tools/umastat/umastat.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/tools/umastat/umastat.c b/tools/tools/umastat/umastat.c index 626982c..8e3bfdc 100644 --- a/tools/tools/umastat/umastat.c +++ b/tools/tools/umastat/umastat.c @@ -40,6 +40,7 @@ #include <memstat.h> #include <stdio.h> #include <stdlib.h> +#include <unistd.h> static struct nlist namelist[] = { #define X_UMA_KEGS 0 @@ -57,7 +58,7 @@ static void usage(void) { - fprintf(stderr, "umastat\n"); + fprintf(stderr, "umastat [-M core [-N system]]\n"); exit(-1); } @@ -283,11 +284,31 @@ main(int argc, char *argv[]) kvm_t *kvm; int all_cpus, cpu, mp_maxcpus, mp_maxid, ret, ub_cnt, ub_entries; size_t uzp_userspace_len; + char *memf, *nlistf; + int ch; + + memf = nlistf = NULL; + while ((ch = getopt(argc, argv, "M:N:")) != -1) { + switch (ch) { + case 'M': + memf = optarg; + break; + case 'N': + nlistf = optarg; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; - if (argc != 1) + if (argc != 0) + usage(); + if (nlistf != NULL && memf == NULL) usage(); - kvm = kvm_open(NULL, NULL, NULL, 0, "umastat"); + kvm = kvm_open(nlistf, memf, NULL, 0, "umastat"); if (kvm == NULL) err(-1, "kvm_open"); |