diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2011-08-14 00:42:09 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2011-08-14 00:42:09 +0000 |
| commit | d57486e21cc23acfc50574623f70d9a68192c4ec (patch) | |
| tree | ca429aeb22aa1af4b3462fdb8fb86944947b7dde /usr.bin/procstat/procstat.c | |
| parent | 9f2c359f16905909b1f23e77b9f2be3056baa7fa (diff) | |
Notes
Diffstat (limited to 'usr.bin/procstat/procstat.c')
| -rw-r--r-- | usr.bin/procstat/procstat.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/procstat/procstat.c b/usr.bin/procstat/procstat.c index 69648fdedacff..97ff8792e58c9 100644 --- a/usr.bin/procstat/procstat.c +++ b/usr.bin/procstat/procstat.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2007, 2011 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,13 +40,13 @@ #include "procstat.h" static int aflag, bflag, cflag, fflag, iflag, jflag, kflag, sflag, tflag, vflag; -int hflag, nflag; +int hflag, nflag, Cflag; static void usage(void) { - fprintf(stderr, "usage: procstat [-h] [-M core] [-N system] " + fprintf(stderr, "usage: procstat [-h] [-C] [-M core] [-N system] " "[-w interval] [-b | -c | -f | -i | -j | -k | -s | -t | -v]\n"); fprintf(stderr, " [-a | pid ...]\n"); exit(EX_USAGE); @@ -117,8 +117,12 @@ main(int argc, char *argv[]) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "N:M:abcfijkhstvw:")) != -1) { + while ((ch = getopt(argc, argv, "CN:M:abcfijkhstvw:")) != -1) { switch (ch) { + case 'C': + Cflag++; + break; + case 'M': memf = optarg; break; @@ -204,6 +208,10 @@ main(int argc, char *argv[]) if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0)) usage(); + /* Only allow -C with -f. */ + if (Cflag && !fflag) + usage(); + if (memf != NULL) prstat = procstat_open_kvm(nlistf, memf); else |
