summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko2016-11-23 06:23:44 +0100
committerDenys Vlasenko2016-11-23 06:23:44 +0100
commitf8f81ed7aaf90897fa9a4687dac75152740a71e2 (patch)
treea5c624d8187016e4369be0be2667a2f5de752d03 /procps
parentf88e3bfa8ded4f1c7e7d2143a1cfcbbdfe5e8541 (diff)
downloadbusybox-f8f81ed7aaf90897fa9a4687dac75152740a71e2.zip
busybox-f8f81ed7aaf90897fa9a4687dac75152740a71e2.tar.gz
Convert all procps/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/Config.src140
-rw-r--r--procps/Kbuild.src15
-rw-r--r--procps/free.c12
-rw-r--r--procps/fuser.c11
-rw-r--r--procps/kill.c30
-rw-r--r--procps/pgrep.c17
-rw-r--r--procps/pidof.c26
-rw-r--r--procps/ps.c49
-rw-r--r--procps/renice.c10
-rw-r--r--procps/sysctl.c9
-rw-r--r--procps/top.c5
-rw-r--r--procps/uptime.c7
-rw-r--r--procps/watch.c11
13 files changed, 184 insertions, 158 deletions
diff --git a/procps/Config.src b/procps/Config.src
index 527d9ee..eb47607 100644
--- a/procps/Config.src
+++ b/procps/Config.src
@@ -7,139 +7,6 @@ menu "Process Utilities"
INSERT
-config FREE
- bool "free"
- default y
- select PLATFORM_LINUX #sysinfo()
- help
- free displays the total amount of free and used physical and swap
- memory in the system, as well as the buffers used by the kernel.
- The shared memory column should be ignored; it is obsolete.
-
-config FUSER
- bool "fuser"
- default y
- help
- fuser lists all PIDs (Process IDs) that currently have a given
- file open. fuser can also list all PIDs that have a given network
- (TCP or UDP) port open.
-
-config KILL
- bool "kill"
- default y
- help
- The command kill sends the specified signal to the specified
- process or process group. If no signal is specified, the TERM
- signal is sent.
-
-config KILLALL
- bool "killall"
- default y
- depends on KILL
- help
- killall sends a signal to all processes running any of the
- specified commands. If no signal name is specified, SIGTERM is
- sent.
-
-config KILLALL5
- bool "killall5"
- default y
- depends on KILL
-
-config PGREP
- bool "pgrep"
- default y
- help
- Look for processes by name.
-
-config PIDOF
- bool "pidof"
- default y
- help
- Pidof finds the process id's (pids) of the named programs. It prints
- those id's on the standard output.
-
-config FEATURE_PIDOF_SINGLE
- bool "Enable argument for single shot (-s)"
- default y
- depends on PIDOF
- help
- Support argument '-s' for returning only the first pid found.
-
-config FEATURE_PIDOF_OMIT
- bool "Enable argument for omitting pids (-o)"
- default y
- depends on PIDOF
- help
- Support argument '-o' for omitting the given pids in output.
- The special pid %PPID can be used to name the parent process
- of the pidof, in other words the calling shell or shell script.
-
-config PKILL
- bool "pkill"
- default y
- help
- Send signals to processes by name.
-
-config PS
- bool "ps"
- default y
- help
- ps gives a snapshot of the current processes.
-
-config FEATURE_PS_WIDE
- bool "Enable wide output option (-w)"
- default y
- depends on PS && !DESKTOP
- help
- Support argument 'w' for wide output.
- If given once, 132 chars are printed, and if given more
- than once, the length is unlimited.
-
-config FEATURE_PS_LONG
- bool "Enable long output option (-l)"
- default y
- depends on PS && !DESKTOP
- help
- Support argument 'l' for long output.
- Adds fields PPID, RSS, START, TIME & TTY
-
-config FEATURE_PS_TIME
- bool "Enable time and elapsed time output"
- default y
- depends on PS && DESKTOP
- select PLATFORM_LINUX
- help
- Support -o time and -o etime output specifiers.
-
-config FEATURE_PS_ADDITIONAL_COLUMNS
- bool "Enable additional ps columns"
- default y
- depends on PS && DESKTOP
- help
- Support -o rgroup, -o ruser, -o nice output specifiers.
-
-config FEATURE_PS_UNUSUAL_SYSTEMS
- bool "Support Linux prior to 2.4.0 and non-ELF systems"
- default n
- depends on FEATURE_PS_TIME
- help
- Include support for measuring HZ on old kernels and non-ELF systems
- (if you are on Linux 2.4.0+ and use ELF, you don't need this)
-
-config RENICE
- bool "renice"
- default y
- help
- Renice alters the scheduling priority of one or more running
- processes.
-
-config BB_SYSCTL
- bool "sysctl"
- default y
- help
- Configure kernel parameters at runtime.
-
config FEATURE_SHOW_THREADS
bool "Support for showing threads in ps/pstree/top"
default y
@@ -148,11 +15,4 @@ config FEATURE_SHOW_THREADS
Enables the ps -T option, showing of threads in pstree,
and 'h' command in top.
-config WATCH
- bool "watch"
- default y
- help
- watch is used to execute a program periodically, showing
- output to the screen.
-
endmenu
diff --git a/procps/Kbuild.src b/procps/Kbuild.src
index 89b1cc0..83af05a 100644
--- a/procps/Kbuild.src
+++ b/procps/Kbuild.src
@@ -7,16 +7,5 @@
lib-y:=
INSERT
-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_PGREP) += pgrep.o
-lib-$(CONFIG_PKILL) += pgrep.o
-lib-$(CONFIG_PIDOF) += pidof.o
-lib-$(CONFIG_PS) += ps.o
-lib-$(CONFIG_RENICE) += renice.o
-lib-$(CONFIG_BB_SYSCTL) += sysctl.o
-lib-$(CONFIG_TOP) += top.o
-lib-$(CONFIG_UPTIME) += uptime.o
-lib-$(CONFIG_WATCH) += watch.o
+
+lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash
diff --git a/procps/free.c b/procps/free.c
index fca9a22..f3a2c3c 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -6,8 +6,18 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config FREE
+//config: bool "free"
+//config: default y
+//config: select PLATFORM_LINUX #sysinfo()
+//config: help
+//config: free displays the total amount of free and used physical and swap
+//config: memory in the system, as well as the buffers used by the kernel.
+//config: The shared memory column should be ignored; it is obsolete.
-/* getopt not needed */
+//applet:IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_FREE) += free.o
//usage:#define free_trivial_usage
//usage: "" IF_DESKTOP("[-b/k/m/g]")
diff --git a/procps/fuser.c b/procps/fuser.c
index 6dac852..db28cca 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -6,6 +6,17 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config FUSER
+//config: bool "fuser"
+//config: default y
+//config: help
+//config: fuser lists all PIDs (Process IDs) that currently have a given
+//config: file open. fuser can also list all PIDs that have a given network
+//config: (TCP or UDP) port open.
+
+//applet:IF_FUSER(APPLET(fuser, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_FUSER) += fuser.o
//usage:#define fuser_trivial_usage
//usage: "[OPTIONS] FILE or PORT/PROTO"
diff --git a/procps/kill.c b/procps/kill.c
index c5c7a8d..1ee79a0 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -7,6 +7,36 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config KILL
+//config: bool "kill"
+//config: default y
+//config: help
+//config: The command kill sends the specified signal to the specified
+//config: process or process group. If no signal is specified, the TERM
+//config: signal is sent.
+//config:
+//config:config KILLALL
+//config: bool "killall"
+//config: default y
+//config: depends on KILL
+//config: help
+//config: killall sends a signal to all processes running any of the
+//config: specified commands. If no signal name is specified, SIGTERM is
+//config: sent.
+//config:
+//config:config KILLALL5
+//config: bool "killall5"
+//config: default y
+//config: depends on KILL
+//config:
+
+//applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
+//applet:IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
+//applet:IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5))
+
+//kbuild:lib-$(CONFIG_KILL) += kill.o
+//kbuild:lib-$(CONFIG_KILLALL) += kill.o
+//kbuild:lib-$(CONFIG_KILLALL5) += kill.o
//usage:#define kill_trivial_usage
//usage: "[-l] [-SIG] PID..."
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 1c594cf..974d007 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -6,6 +6,23 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config PGREP
+//config: bool "pgrep"
+//config: default y
+//config: help
+//config: Look for processes by name.
+//config:
+//config:config PKILL
+//config: bool "pkill"
+//config: default y
+//config: help
+//config: Send signals to processes by name.
+
+//applet:IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP))
+//applet:IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill))
+
+//kbuild:lib-$(CONFIG_PGREP) += pgrep.o
+//kbuild:lib-$(CONFIG_PKILL) += pgrep.o
//usage:#define pgrep_trivial_usage
//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]"
diff --git a/procps/pidof.c b/procps/pidof.c
index 6d26566..069adb7 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -6,6 +6,32 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config PIDOF
+//config: bool "pidof"
+//config: default y
+//config: help
+//config: Pidof finds the process id's (pids) of the named programs. It prints
+//config: those id's on the standard output.
+//config:
+//config:config FEATURE_PIDOF_SINGLE
+//config: bool "Enable argument for single shot (-s)"
+//config: default y
+//config: depends on PIDOF
+//config: help
+//config: Support argument '-s' for returning only the first pid found.
+//config:
+//config:config FEATURE_PIDOF_OMIT
+//config: bool "Enable argument for omitting pids (-o)"
+//config: default y
+//config: depends on PIDOF
+//config: help
+//config: Support argument '-o' for omitting the given pids in output.
+//config: The special pid %PPID can be used to name the parent process
+//config: of the pidof, in other words the calling shell or shell script.
+
+//applet:IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_PIDOF) += pidof.o
//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT)
//usage:#define pidof_trivial_usage
diff --git a/procps/ps.c b/procps/ps.c
index ce63826..e291ecd 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -8,6 +8,55 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config PS
+//config: bool "ps"
+//config: default y
+//config: help
+//config: ps gives a snapshot of the current processes.
+//config:
+//config:config FEATURE_PS_WIDE
+//config: bool "Enable wide output option (-w)"
+//config: default y
+//config: depends on PS && !DESKTOP
+//config: help
+//config: Support argument 'w' for wide output.
+//config: If given once, 132 chars are printed, and if given more
+//config: than once, the length is unlimited.
+//config:
+//config:config FEATURE_PS_LONG
+//config: bool "Enable long output option (-l)"
+//config: default y
+//config: depends on PS && !DESKTOP
+//config: help
+//config: Support argument 'l' for long output.
+//config: Adds fields PPID, RSS, START, TIME & TTY
+//config:
+//config:config FEATURE_PS_TIME
+//config: bool "Enable time and elapsed time output"
+//config: default y
+//config: depends on PS && DESKTOP
+//config: select PLATFORM_LINUX
+//config: help
+//config: Support -o time and -o etime output specifiers.
+//config:
+//config:config FEATURE_PS_ADDITIONAL_COLUMNS
+//config: bool "Enable additional ps columns"
+//config: default y
+//config: depends on PS && DESKTOP
+//config: help
+//config: Support -o rgroup, -o ruser, -o nice output specifiers.
+//config:
+//config:config FEATURE_PS_UNUSUAL_SYSTEMS
+//config: bool "Support Linux prior to 2.4.0 and non-ELF systems"
+//config: default n
+//config: depends on FEATURE_PS_TIME
+//config: help
+//config: Include support for measuring HZ on old kernels and non-ELF systems
+//config: (if you are on Linux 2.4.0+ and use ELF, you don't need this)
+
+//applet:IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_PS) += ps.o
//usage:#if ENABLE_DESKTOP
//usage:
diff --git a/procps/renice.c b/procps/renice.c
index 2b690e0..64213c6 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -18,6 +18,16 @@
* options -p, -g, and -u are treated as mode switches for the
* following IDs (if any). Multiple switches are allowed.
*/
+//config:config RENICE
+//config: bool "renice"
+//config: default y
+//config: help
+//config: Renice alters the scheduling priority of one or more running
+//config: processes.
+
+//applet:IF_RENICE(APPLET(renice, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_RENICE) += renice.o
//usage:#define renice_trivial_usage
//usage: "[-n] PRIORITY [[-p | -g | -u] ID...]..."
diff --git a/procps/sysctl.c b/procps/sysctl.c
index f0883f0..93d7c34 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -10,6 +10,15 @@
* v1.01 - added -p <preload> to preload values from a file
* v1.01.1 - busybox applet aware by <solar@gentoo.org>
*/
+//config:config BB_SYSCTL
+//config: bool "sysctl"
+//config: default y
+//config: help
+//config: Configure kernel parameters at runtime.
+
+//applet:IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_BB_SYSCTL) += sysctl.o
//usage:#define sysctl_trivial_usage
//usage: "[OPTIONS] [KEY[=VALUE]]..."
diff --git a/procps/top.c b/procps/top.c
index 6f7f7d3..c66cdb7 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -49,7 +49,6 @@
* cp stat meminfo loadavg proc
* chroot . ./top -bn1 >top1.out
*/
-
//config:config TOP
//config: bool "top"
//config: default y
@@ -104,6 +103,10 @@
//config: help
//config: Enable 's' in top (gives lots of memory info).
+//applet:IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_TOP) += top.o
+
#include "libbb.h"
#include "common_bufsiz.h"
diff --git a/procps/uptime.c b/procps/uptime.c
index 149bae6..4361939 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -11,9 +11,6 @@
*
* Added FEATURE_UPTIME_UTMP_SUPPORT flag.
*/
-
-/* getopt not needed */
-
//config:config UPTIME
//config: bool "uptime"
//config: default y
@@ -30,6 +27,10 @@
//config: help
//config: Makes uptime display the number of users currently logged on.
+//applet:IF_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_UPTIME) += uptime.o
+
//usage:#define uptime_trivial_usage
//usage: ""
//usage:#define uptime_full_usage "\n\n"
diff --git a/procps/watch.c b/procps/watch.c
index 20859c3..bb34124 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -11,6 +11,17 @@
/* BB_AUDIT SUSv3 N/A */
/* BB_AUDIT GNU defects -- only option -n is supported. */
+//config:config WATCH
+//config: bool "watch"
+//config: default y
+//config: help
+//config: watch is used to execute a program periodically, showing
+//config: output to the screen.
+
+//applet:IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_WATCH) += watch.o
+
//usage:#define watch_trivial_usage
//usage: "[-n SEC] [-t] PROG ARGS"
//usage:#define watch_full_usage "\n\n"