diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-13 15:17:22 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-13 15:17:22 +0100 |
commit | a6041860f878142e91be7889a26742e25f323c8f (patch) | |
tree | a0d3565adcf8857c36a34b4b6da16e9a666aebbf | |
parent | da6fb7e33100e5135e3e898dd157e6c729b34d7c (diff) | |
download | busybox-w32-a6041860f878142e91be7889a26742e25f323c8f.tar.gz busybox-w32-a6041860f878142e91be7889a26742e25f323c8f.tar.bz2 busybox-w32-a6041860f878142e91be7889a26742e25f323c8f.zip |
nmeter: deprecate %NNNd specified, use -d MSEC instead
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | include/applets.src.h | 1 | ||||
-rw-r--r-- | include/usage.src.h | 29 | ||||
-rw-r--r-- | procps/Config.src | 6 | ||||
-rw-r--r-- | procps/Kbuild.src | 1 | ||||
-rw-r--r-- | procps/nmeter.c | 50 |
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)) | |||
258 | IF_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 258 | IF_NC(APPLET(nc, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
259 | IF_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_DROP)) | 259 | IF_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_DROP)) |
260 | IF_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_DROP)) | 260 | IF_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_DROP)) |
261 | IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | ||
262 | IF_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 261 | IF_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
263 | IF_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | 262 | IF_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_DROP)) |
264 | IF_NTPD(APPLET(ntpd, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) | 263 | 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 | |||
1577 | "\n -c One-byte character display" \ | 1577 | "\n -c One-byte character display" \ |
1578 | "\n -C Canonical hex+ASCII, 16 bytes per line" \ | 1578 | "\n -C Canonical hex+ASCII, 16 bytes per line" \ |
1579 | "\n -d Two-byte decimal display" \ | 1579 | "\n -d Two-byte decimal display" \ |
1580 | "\n -e FORMAT STRING" \ | 1580 | "\n -e FORMAT_STRING" \ |
1581 | "\n -f FORMAT FILE" \ | 1581 | "\n -f FORMAT_FILE" \ |
1582 | "\n -n LENGTH Interpret only LENGTH bytes of input" \ | 1582 | "\n -n LENGTH Interpret only LENGTH bytes of input" \ |
1583 | "\n -o Two-byte octal display" \ | 1583 | "\n -o Two-byte octal display" \ |
1584 | "\n -s OFFSET Skip OFFSET bytes" \ | 1584 | "\n -s OFFSET Skip OFFSET bytes" \ |
@@ -2706,31 +2706,6 @@ INSERT | |||
2706 | " or\n" \ | 2706 | " or\n" \ |
2707 | "$ nameif -c /etc/my_mactab_file\n" \ | 2707 | "$ nameif -c /etc/my_mactab_file\n" \ |
2708 | 2708 | ||
2709 | #define nmeter_trivial_usage \ | ||
2710 | "format_string" | ||
2711 | #define nmeter_full_usage "\n\n" \ | ||
2712 | "Monitor system in real time\n\n" \ | ||
2713 | "Format specifiers:\n" \ | ||
2714 | " %Nc or %[cN] Monitor CPU. N - bar size, default 10\n" \ | ||
2715 | " (displays: S:system U:user N:niced D:iowait I:irq i:softirq)\n" \ | ||
2716 | " %[niface] Monitor network interface 'iface'\n" \ | ||
2717 | " %m Monitor allocated memory\n" \ | ||
2718 | " %[mf] Monitor free memory\n" \ | ||
2719 | " %[mt] Monitor total memory\n" \ | ||
2720 | " %s Monitor allocated swap\n" \ | ||
2721 | " %f Monitor number of used file descriptors\n" \ | ||
2722 | " %Ni Monitor total/specific IRQ rate\n" \ | ||
2723 | " %x Monitor context switch rate\n" \ | ||
2724 | " %p Monitor forks\n" \ | ||
2725 | " %[pn] Monitor # of processes\n" \ | ||
2726 | " %b Monitor block io\n" \ | ||
2727 | " %Nt Show time (with N decimal points)\n" \ | ||
2728 | " %Nd Milliseconds between updates (default:1000)\n" \ | ||
2729 | " %r Print <cr> instead of <lf> at EOL" \ | ||
2730 | |||
2731 | #define nmeter_example_usage \ | ||
2732 | "nmeter '%250d%t %20c int %i bio %b mem %m forks%p'" | ||
2733 | |||
2734 | #define nohup_trivial_usage \ | 2709 | #define nohup_trivial_usage \ |
2735 | "PROG ARGS" | 2710 | "PROG ARGS" |
2736 | #define nohup_full_usage "\n\n" \ | 2711 | #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 | |||
46 | default y | 46 | default y |
47 | depends on KILL | 47 | depends on KILL |
48 | 48 | ||
49 | config NMETER | ||
50 | bool "nmeter" | ||
51 | default y | ||
52 | help | ||
53 | Prints selected system stats continuously, one line per update. | ||
54 | |||
55 | config PGREP | 49 | config PGREP |
56 | bool "pgrep" | 50 | bool "pgrep" |
57 | default y | 51 | 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 | |||
11 | lib-$(CONFIG_FUSER) += fuser.o | 11 | lib-$(CONFIG_FUSER) += fuser.o |
12 | lib-$(CONFIG_KILL) += kill.o | 12 | lib-$(CONFIG_KILL) += kill.o |
13 | lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash | 13 | lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash |
14 | lib-$(CONFIG_NMETER) += nmeter.o | ||
15 | lib-$(CONFIG_PGREP) += pgrep.o | 14 | lib-$(CONFIG_PGREP) += pgrep.o |
16 | lib-$(CONFIG_PKILL) += pgrep.o | 15 | lib-$(CONFIG_PKILL) += pgrep.o |
17 | lib-$(CONFIG_PIDOF) += pidof.o | 16 | 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 @@ | |||
6 | * Contact me: vda.linux@googlemail.com | 6 | * Contact me: vda.linux@googlemail.com |
7 | */ | 7 | */ |
8 | 8 | ||
9 | //config:config NMETER | ||
10 | //config: bool "nmeter" | ||
11 | //config: default y | ||
12 | //config: help | ||
13 | //config: Prints selected system stats continuously, one line per update. | ||
14 | |||
15 | //applet:IF_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_DROP)) | ||
16 | |||
17 | //kbuild:lib-$(CONFIG_NMETER) += nmeter.o | ||
18 | |||
19 | //usage:#define nmeter_trivial_usage | ||
20 | //usage: "[-d MSEC] FORMAT_STRING" | ||
21 | //usage:#define nmeter_full_usage "\n\n" | ||
22 | //usage: "Monitor system in real time" | ||
23 | //usage: "\n" | ||
24 | //usage: "\n -d MSEC Milliseconds between updates (default:1000)" | ||
25 | //usage: "\n" | ||
26 | //usage: "\nFormat specifiers:" | ||
27 | //usage: "\n %Nc or %[cN] Monitor CPU. N - bar size (default:10)" | ||
28 | //usage: "\n (displays: S:system U:user N:niced D:iowait I:irq i:softirq)" | ||
29 | //usage: "\n %[niface] Monitor network interface 'iface'" | ||
30 | //usage: "\n %m Monitor allocated memory" | ||
31 | //usage: "\n %[mf] Monitor free memory" | ||
32 | //usage: "\n %[mt] Monitor total memory" | ||
33 | //usage: "\n %s Monitor allocated swap" | ||
34 | //usage: "\n %f Monitor number of used file descriptors" | ||
35 | //usage: "\n %Ni Monitor total/specific IRQ rate" | ||
36 | //usage: "\n %x Monitor context switch rate" | ||
37 | //usage: "\n %p Monitor forks" | ||
38 | //usage: "\n %[pn] Monitor # of processes" | ||
39 | //usage: "\n %b Monitor block io" | ||
40 | //usage: "\n %Nt Show time (with N decimal points)" | ||
41 | //usage: "\n %r Print <cr> instead of <lf> at EOL" | ||
42 | |||
9 | //TODO: | 43 | //TODO: |
10 | // simplify code | 44 | // simplify code |
11 | // /proc/locks | 45 | // /proc/locks |
@@ -769,6 +803,7 @@ static void FAST_FUNC collect_info(s_stat *s) | |||
769 | 803 | ||
770 | typedef s_stat* init_func(const char *param); | 804 | typedef s_stat* init_func(const char *param); |
771 | 805 | ||
806 | // Deprecated %NNNd is to be removed, -d MSEC supersedes it | ||
772 | static const char options[] ALIGN1 = "ncmsfixptbdr"; | 807 | static const char options[] ALIGN1 = "ncmsfixptbdr"; |
773 | static init_func *const init_functions[] = { | 808 | static init_func *const init_functions[] = { |
774 | init_if, | 809 | init_if, |
@@ -792,23 +827,28 @@ int nmeter_main(int argc UNUSED_PARAM, char **argv) | |||
792 | s_stat *first = NULL; | 827 | s_stat *first = NULL; |
793 | s_stat *last = NULL; | 828 | s_stat *last = NULL; |
794 | s_stat *s; | 829 | s_stat *s; |
830 | char *opt_d; | ||
795 | char *cur, *prev; | 831 | char *cur, *prev; |
796 | 832 | ||
797 | INIT_G(); | 833 | INIT_G(); |
798 | 834 | ||
799 | xchdir("/proc"); | 835 | xchdir("/proc"); |
800 | 836 | ||
801 | if (!argv[1]) | ||
802 | bb_show_usage(); | ||
803 | |||
804 | if (open_read_close("version", buf, sizeof(buf)-1) > 0) { | 837 | if (open_read_close("version", buf, sizeof(buf)-1) > 0) { |
805 | buf[sizeof(buf)-1] = '\0'; | 838 | buf[sizeof(buf)-1] = '\0'; |
806 | is26 = (strstr(buf, " 2.4.") == NULL); | 839 | is26 = (strstr(buf, " 2.4.") == NULL); |
807 | } | 840 | } |
808 | 841 | ||
809 | // Can use argv[1] directly, but this will mess up | 842 | if (getopt32(argv, "d:", &opt_d)) |
843 | init_delay(opt_d); | ||
844 | argv += optind; | ||
845 | |||
846 | if (!argv[0]) | ||
847 | bb_show_usage(); | ||
848 | |||
849 | // Can use argv[0] directly, but this will mess up | ||
810 | // parameters as seen by e.g. ps. Making a copy... | 850 | // parameters as seen by e.g. ps. Making a copy... |
811 | cur = xstrdup(argv[1]); | 851 | cur = xstrdup(argv[0]); |
812 | while (1) { | 852 | while (1) { |
813 | char *param, *p; | 853 | char *param, *p; |
814 | prev = cur; | 854 | prev = cur; |