aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
Diffstat (limited to 'procps')
-rw-r--r--procps/iostat.c1
-rw-r--r--procps/kill.c5
-rw-r--r--procps/lsof.c1
-rw-r--r--procps/mpstat.c11
-rw-r--r--procps/nmeter.c1
-rw-r--r--procps/pmap.c2
-rw-r--r--procps/powertop.c6
-rw-r--r--procps/pwdx.c1
-rw-r--r--procps/smemcap.c9
-rw-r--r--procps/top.c9
-rw-r--r--procps/watch.c11
11 files changed, 30 insertions, 27 deletions
diff --git a/procps/iostat.c b/procps/iostat.c
index 050625f57..09aae7102 100644
--- a/procps/iostat.c
+++ b/procps/iostat.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10//config:config IOSTAT 9//config:config IOSTAT
11//config: bool "iostat (7.4 kb)" 10//config: bool "iostat (7.4 kb)"
12//config: default y 11//config: default y
diff --git a/procps/kill.c b/procps/kill.c
index 0ddae2f70..24cc903fc 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -184,6 +184,10 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
184 if (is_killall5 && arg[0] == 'o') 184 if (is_killall5 && arg[0] == 'o')
185 goto do_it_now; 185 goto do_it_now;
186 186
187 /* "--" separates options from args. Testcase: "kill -- -123" */
188 if (!is_killall5 && arg[0] == '-' && arg[1] == '\0')
189 goto do_it_sooner;
190
187 if (argv[1] && arg[0] == 's' && arg[1] == '\0') { /* -s SIG? */ 191 if (argv[1] && arg[0] == 's' && arg[1] == '\0') { /* -s SIG? */
188 arg = *++argv; 192 arg = *++argv;
189 } /* else it must be -SIG */ 193 } /* else it must be -SIG */
@@ -192,6 +196,7 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
192 bb_error_msg("bad signal name '%s'", arg); 196 bb_error_msg("bad signal name '%s'", arg);
193 return EXIT_FAILURE; 197 return EXIT_FAILURE;
194 } 198 }
199 do_it_sooner:
195 arg = *++argv; 200 arg = *++argv;
196 201
197 do_it_now: 202 do_it_now:
diff --git a/procps/lsof.c b/procps/lsof.c
index 8d3a23cc8..4917cf899 100644
--- a/procps/lsof.c
+++ b/procps/lsof.c
@@ -6,7 +6,6 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10//config:config LSOF 9//config:config LSOF
11//config: bool "lsof (3.6 kb)" 10//config: bool "lsof (3.6 kb)"
12//config: default y 11//config: default y
diff --git a/procps/mpstat.c b/procps/mpstat.c
index c6279f9d8..b1ac09d75 100644
--- a/procps/mpstat.c
+++ b/procps/mpstat.c
@@ -6,18 +6,17 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10//applet:IF_MPSTAT(APPLET(mpstat, BB_DIR_BIN, BB_SUID_DROP))
11/* shouldn't be noexec: "mpstat INTERVAL" runs indefinitely */
12
13//kbuild:lib-$(CONFIG_MPSTAT) += mpstat.o
14
15//config:config MPSTAT 9//config:config MPSTAT
16//config: bool "mpstat (10 kb)" 10//config: bool "mpstat (10 kb)"
17//config: default y 11//config: default y
18//config: help 12//config: help
19//config: Per-processor statistics 13//config: Per-processor statistics
20 14
15//applet:IF_MPSTAT(APPLET(mpstat, BB_DIR_BIN, BB_SUID_DROP))
16/* shouldn't be noexec: "mpstat INTERVAL" runs indefinitely */
17
18//kbuild:lib-$(CONFIG_MPSTAT) += mpstat.o
19
21#include "libbb.h" 20#include "libbb.h"
22#include <sys/utsname.h> /* struct utsname */ 21#include <sys/utsname.h> /* struct utsname */
23 22
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 9463f94dc..166c8ab18 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -5,7 +5,6 @@
5 * 5 *
6 * Contact me: vda.linux@googlemail.com 6 * Contact me: vda.linux@googlemail.com
7 */ 7 */
8
9//config:config NMETER 8//config:config NMETER
10//config: bool "nmeter (10 kb)" 9//config: bool "nmeter (10 kb)"
11//config: default y 10//config: default y
diff --git a/procps/pmap.c b/procps/pmap.c
index 5c2d1ad59..c8fa0d280 100644
--- a/procps/pmap.c
+++ b/procps/pmap.c
@@ -7,7 +7,6 @@
7 * Licensed under GPLv2 or later, see the LICENSE file in this source tree 7 * Licensed under GPLv2 or later, see the LICENSE file in this source tree
8 * for details. 8 * for details.
9 */ 9 */
10
11//config:config PMAP 10//config:config PMAP
12//config: bool "pmap (6 kb)" 11//config: bool "pmap (6 kb)"
13//config: default y 12//config: default y
@@ -15,6 +14,7 @@
15//config: Display processes' memory mappings. 14//config: Display processes' memory mappings.
16 15
17//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP)) 16//applet:IF_PMAP(APPLET(pmap, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_PMAP) += pmap.o 18//kbuild:lib-$(CONFIG_PMAP) += pmap.o
19 19
20//usage:#define pmap_trivial_usage 20//usage:#define pmap_trivial_usage
diff --git a/procps/powertop.c b/procps/powertop.c
index 5d522bf91..2872035cf 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -51,6 +51,8 @@
51/* Max filename length of entry in /sys/devices subsystem */ 51/* Max filename length of entry in /sys/devices subsystem */
52#define BIG_SYSNAME_LEN 16 52#define BIG_SYSNAME_LEN 16
53 53
54#define ESC "\033"
55
54typedef unsigned long long ullong; 56typedef unsigned long long ullong;
55 57
56struct line { 58struct line {
@@ -776,8 +778,8 @@ int powertop_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv)
776 } 778 }
777 } 779 }
778 780
779 /* Clear the screen */ 781 /* Home; clear screen */
780 printf("\033[H\033[J"); 782 printf(ESC"[H" ESC"[J");
781 783
782 /* Clear C-state lines */ 784 /* Clear C-state lines */
783 memset(&cstate_lines, 0, sizeof(cstate_lines)); 785 memset(&cstate_lines, 0, sizeof(cstate_lines));
diff --git a/procps/pwdx.c b/procps/pwdx.c
index c72cf804a..6009e2aa3 100644
--- a/procps/pwdx.c
+++ b/procps/pwdx.c
@@ -7,7 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10
11//config:config PWDX 10//config:config PWDX
12//config: bool "pwdx (3.5 kb)" 11//config: bool "pwdx (3.5 kb)"
13//config: default y 12//config: default y
diff --git a/procps/smemcap.c b/procps/smemcap.c
index 17aeccd53..f2e2de29d 100644
--- a/procps/smemcap.c
+++ b/procps/smemcap.c
@@ -7,11 +7,6 @@
7 the GNU General Public License version 2 or later, incorporated 7 the GNU General Public License version 2 or later, incorporated
8 herein by reference. 8 herein by reference.
9*/ 9*/
10
11//applet:IF_SMEMCAP(APPLET(smemcap, BB_DIR_USR_BIN, BB_SUID_DROP))
12
13//kbuild:lib-$(CONFIG_SMEMCAP) += smemcap.o
14
15//config:config SMEMCAP 10//config:config SMEMCAP
16//config: bool "smemcap (2.5 kb)" 11//config: bool "smemcap (2.5 kb)"
17//config: default y 12//config: default y
@@ -19,6 +14,10 @@
19//config: smemcap is a tool for capturing process data for smem, 14//config: smemcap is a tool for capturing process data for smem,
20//config: a memory usage statistic tool. 15//config: a memory usage statistic tool.
21 16
17//applet:IF_SMEMCAP(APPLET(smemcap, BB_DIR_USR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SMEMCAP) += smemcap.o
20
22#include "libbb.h" 21#include "libbb.h"
23#define BB_ARCHIVE_PUBLIC 22#define BB_ARCHIVE_PUBLIC
24#include "bb_archive.h" 23#include "bb_archive.h"
diff --git a/procps/top.c b/procps/top.c
index f97ded5d6..b777c494e 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -117,6 +117,7 @@
117 117
118#include "libbb.h" 118#include "libbb.h"
119 119
120#define ESC "\033"
120 121
121typedef struct top_status_t { 122typedef struct top_status_t {
122 unsigned long vsz; 123 unsigned long vsz;
@@ -580,7 +581,7 @@ static unsigned long display_header(int scr_width, int *lines_rem_p)
580 meminfo[MI_BUFFERS], 581 meminfo[MI_BUFFERS],
581 meminfo[MI_CACHED]); 582 meminfo[MI_CACHED]);
582 /* Go to top & clear to the end of screen */ 583 /* Go to top & clear to the end of screen */
583 printf(OPT_BATCH_MODE ? "%s\n" : "\033[H\033[J%s\n", scrbuf); 584 printf(OPT_BATCH_MODE ? "%s\n" : ESC"[H" ESC"[J" "%s\n", scrbuf);
584 (*lines_rem_p)--; 585 (*lines_rem_p)--;
585 586
586 /* Display CPU time split as percentage of total time. 587 /* Display CPU time split as percentage of total time.
@@ -618,7 +619,7 @@ static NOINLINE void display_process_list(int lines_rem, int scr_width)
618#endif 619#endif
619 620
620 /* what info of the processes is shown */ 621 /* what info of the processes is shown */
621 printf(OPT_BATCH_MODE ? "%.*s" : "\033[7m%.*s\033[0m", scr_width, 622 printf(OPT_BATCH_MODE ? "%.*s" : ESC"[7m" "%.*s" ESC"[m", scr_width,
622 " PID PPID USER STAT VSZ %VSZ" 623 " PID PPID USER STAT VSZ %VSZ"
623 IF_FEATURE_TOP_SMP_PROCESS(" CPU") 624 IF_FEATURE_TOP_SMP_PROCESS(" CPU")
624 IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU") 625 IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE(" %CPU")
@@ -802,7 +803,7 @@ static void display_topmem_header(int scr_width, int *lines_rem_p)
802 meminfo[MI_ANONPAGES], 803 meminfo[MI_ANONPAGES],
803 meminfo[MI_MAPPED], 804 meminfo[MI_MAPPED],
804 meminfo[MI_MEMFREE]); 805 meminfo[MI_MEMFREE]);
805 printf(OPT_BATCH_MODE ? "%.*s\n" : "\033[H\033[J%.*s\n", scr_width, line_buf); 806 printf(OPT_BATCH_MODE ? "%.*s\n" : ESC"[H" ESC"[J" "%.*s\n", scr_width, line_buf);
806 807
807 snprintf(line_buf, LINE_BUF_SIZE, 808 snprintf(line_buf, LINE_BUF_SIZE,
808 " slab:%lu buf:%lu cache:%lu dirty:%lu write:%lu", 809 " slab:%lu buf:%lu cache:%lu dirty:%lu write:%lu",
@@ -844,7 +845,7 @@ static NOINLINE void display_topmem_process_list(int lines_rem, int scr_width)
844 cp[6] = ch; 845 cp[6] = ch;
845 do *cp++ = ch; while (*cp == ' '); 846 do *cp++ = ch; while (*cp == ' ');
846 847
847 printf(OPT_BATCH_MODE ? "%.*s" : "\e[7m%.*s\e[0m", scr_width, line_buf); 848 printf(OPT_BATCH_MODE ? "%.*s" : ESC"[7m" "%.*s" ESC"[m", scr_width, line_buf);
848 lines_rem--; 849 lines_rem--;
849 850
850 if (lines_rem > ntop - G_scroll_ofs) 851 if (lines_rem > ntop - G_scroll_ofs)
diff --git a/procps/watch.c b/procps/watch.c
index 6fc9f7db7..420e6d3d1 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -7,10 +7,6 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11/* BB_AUDIT SUSv3 N/A */
12/* BB_AUDIT GNU defects -- only option -n is supported. */
13
14//config:config WATCH 10//config:config WATCH
15//config: bool "watch (4.1 kb)" 11//config: bool "watch (4.1 kb)"
16//config: default y 12//config: default y
@@ -35,8 +31,13 @@
35//usage: "Mon Dec 17 10:31:42 GMT 2000\n" 31//usage: "Mon Dec 17 10:31:42 GMT 2000\n"
36//usage: "Mon Dec 17 10:31:44 GMT 2000" 32//usage: "Mon Dec 17 10:31:44 GMT 2000"
37 33
34/* BB_AUDIT SUSv3 N/A */
35/* BB_AUDIT GNU defects -- only option -n is supported. */
36
38#include "libbb.h" 37#include "libbb.h"
39 38
39#define ESC "\033"
40
40// procps 2.0.18: 41// procps 2.0.18:
41// watch [-d] [-n seconds] 42// watch [-d] [-n seconds]
42// [--differences[=cumulative]] [--interval=seconds] command 43// [--differences[=cumulative]] [--interval=seconds] command
@@ -77,7 +78,7 @@ int watch_main(int argc UNUSED_PARAM, char **argv)
77 header = NULL; 78 header = NULL;
78 while (1) { 79 while (1) {
79 /* home; clear to the end of screen */ 80 /* home; clear to the end of screen */
80 printf("\033[H""\033[J"); 81 printf(ESC"[H" ESC"[J");
81 if (!(opt & 0x2)) { // no -t 82 if (!(opt & 0x2)) { // no -t
82 const unsigned time_len = sizeof("1234-67-90 23:56:89"); 83 const unsigned time_len = sizeof("1234-67-90 23:56:89");
83 84