aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-12-13 15:17:22 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-12-13 15:17:22 +0100
commita6041860f878142e91be7889a26742e25f323c8f (patch)
treea0d3565adcf8857c36a34b4b6da16e9a666aebbf
parentda6fb7e33100e5135e3e898dd157e6c729b34d7c (diff)
downloadbusybox-a6041860f878142e91be7889a26742e25f323c8f.tar.gz
nmeter: deprecate %NNNd specified, use -d MSEC instead
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--include/applets.src.h1
-rw-r--r--include/usage.src.h29
-rw-r--r--procps/Config.src6
-rw-r--r--procps/Kbuild.src1
-rw-r--r--procps/nmeter.c50
5 files changed, 47 insertions, 40 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index 5058feb3a..c2f90eac0 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -258,7 +258,6 @@ IF_NAMEIF(APPLET(nameif, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_DROP))
IF_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_DROP))
-IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_NTPD(APPLET(ntpd, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
diff --git a/include/usage.src.h b/include/usage.src.h
index c413fbb91..64f2c909f 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -1577,8 +1577,8 @@ INSERT
"\n -c One-byte character display" \
"\n -C Canonical hex+ASCII, 16 bytes per line" \
"\n -d Two-byte decimal display" \
- "\n -e FORMAT STRING" \
- "\n -f FORMAT FILE" \
+ "\n -e FORMAT_STRING" \
+ "\n -f FORMAT_FILE" \
"\n -n LENGTH Interpret only LENGTH bytes of input" \
"\n -o Two-byte octal display" \
"\n -s OFFSET Skip OFFSET bytes" \
@@ -2706,31 +2706,6 @@ INSERT
" or\n" \
"$ nameif -c /etc/my_mactab_file\n" \
-#define nmeter_trivial_usage \
- "format_string"
-#define nmeter_full_usage "\n\n" \
- "Monitor system in real time\n\n" \
- "Format specifiers:\n" \
- " %Nc or %[cN] Monitor CPU. N - bar size, default 10\n" \
- " (displays: S:system U:user N:niced D:iowait I:irq i:softirq)\n" \
- " %[niface] Monitor network interface 'iface'\n" \
- " %m Monitor allocated memory\n" \
- " %[mf] Monitor free memory\n" \
- " %[mt] Monitor total memory\n" \
- " %s Monitor allocated swap\n" \
- " %f Monitor number of used file descriptors\n" \
- " %Ni Monitor total/specific IRQ rate\n" \
- " %x Monitor context switch rate\n" \
- " %p Monitor forks\n" \
- " %[pn] Monitor # of processes\n" \
- " %b Monitor block io\n" \
- " %Nt Show time (with N decimal points)\n" \
- " %Nd Milliseconds between updates (default:1000)\n" \
- " %r Print <cr> instead of <lf> at EOL" \
-
-#define nmeter_example_usage \
- "nmeter '%250d%t %20c int %i bio %b mem %m forks%p'"
-
#define nohup_trivial_usage \
"PROG ARGS"
#define nohup_full_usage "\n\n" \
diff --git a/procps/Config.src b/procps/Config.src
index 338d75c34..cf664eeb2 100644
--- a/procps/Config.src
+++ b/procps/Config.src
@@ -46,12 +46,6 @@ config KILLALL5
default y
depends on KILL
-config NMETER
- bool "nmeter"
- default y
- help
- Prints selected system stats continuously, one line per update.
-
config PGREP
bool "pgrep"
default y
diff --git a/procps/Kbuild.src b/procps/Kbuild.src
index 791d65670..89b1cc094 100644
--- a/procps/Kbuild.src
+++ b/procps/Kbuild.src
@@ -11,7 +11,6 @@ lib-$(CONFIG_FREE) += free.o
lib-$(CONFIG_FUSER) += fuser.o
lib-$(CONFIG_KILL) += kill.o
lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash
-lib-$(CONFIG_NMETER) += nmeter.o
lib-$(CONFIG_PGREP) += pgrep.o
lib-$(CONFIG_PKILL) += pgrep.o
lib-$(CONFIG_PIDOF) += pidof.o
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 7836a90d5..ac019eb53 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -6,6 +6,40 @@
* Contact me: vda.linux@googlemail.com
*/
+//config:config NMETER
+//config: bool "nmeter"
+//config: default y
+//config: help
+//config: Prints selected system stats continuously, one line per update.
+
+//applet:IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_NMETER) += nmeter.o
+
+//usage:#define nmeter_trivial_usage
+//usage: "[-d MSEC] FORMAT_STRING"
+//usage:#define nmeter_full_usage "\n\n"
+//usage: "Monitor system in real time"
+//usage: "\n"
+//usage: "\n -d MSEC Milliseconds between updates (default:1000)"
+//usage: "\n"
+//usage: "\nFormat specifiers:"
+//usage: "\n %Nc or %[cN] Monitor CPU. N - bar size (default:10)"
+//usage: "\n (displays: S:system U:user N:niced D:iowait I:irq i:softirq)"
+//usage: "\n %[niface] Monitor network interface 'iface'"
+//usage: "\n %m Monitor allocated memory"
+//usage: "\n %[mf] Monitor free memory"
+//usage: "\n %[mt] Monitor total memory"
+//usage: "\n %s Monitor allocated swap"
+//usage: "\n %f Monitor number of used file descriptors"
+//usage: "\n %Ni Monitor total/specific IRQ rate"
+//usage: "\n %x Monitor context switch rate"
+//usage: "\n %p Monitor forks"
+//usage: "\n %[pn] Monitor # of processes"
+//usage: "\n %b Monitor block io"
+//usage: "\n %Nt Show time (with N decimal points)"
+//usage: "\n %r Print <cr> instead of <lf> at EOL"
+
//TODO:
// simplify code
// /proc/locks
@@ -769,6 +803,7 @@ static void FAST_FUNC collect_info(s_stat *s)
typedef s_stat* init_func(const char *param);
+// Deprecated %NNNd is to be removed, -d MSEC supersedes it
static const char options[] ALIGN1 = "ncmsfixptbdr";
static init_func *const init_functions[] = {
init_if,
@@ -792,23 +827,28 @@ int nmeter_main(int argc UNUSED_PARAM, char **argv)
s_stat *first = NULL;
s_stat *last = NULL;
s_stat *s;
+ char *opt_d;
char *cur, *prev;
INIT_G();
xchdir("/proc");
- if (!argv[1])
- bb_show_usage();
-
if (open_read_close("version", buf, sizeof(buf)-1) > 0) {
buf[sizeof(buf)-1] = '\0';
is26 = (strstr(buf, " 2.4.") == NULL);
}
- // Can use argv[1] directly, but this will mess up
+ if (getopt32(argv, "d:", &opt_d))
+ init_delay(opt_d);
+ argv += optind;
+
+ if (!argv[0])
+ bb_show_usage();
+
+ // Can use argv[0] directly, but this will mess up
// parameters as seen by e.g. ps. Making a copy...
- cur = xstrdup(argv[1]);
+ cur = xstrdup(argv[0]);
while (1) {
char *param, *p;
prev = cur;