Convert all procps/* applets to "new style" applet definitions

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-11-23 06:23:44 +01:00
parent f88e3bfa8d
commit f8f81ed7aa
14 changed files with 184 additions and 172 deletions

View File

@ -124,7 +124,6 @@ IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE))
IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold))
IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP))
//IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext2))
//IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3))
@ -133,7 +132,6 @@ IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync))
IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget))
IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpput))
IF_FUSER(APPLET(fuser, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP))
IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
@ -163,9 +161,6 @@ IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP))
IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP))
IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP))
IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP))
IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5))
//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length))
IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
@ -201,14 +196,10 @@ IF_NTPD(APPLET(ntpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP))
//IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP))
IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP))
IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill))
IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv))
IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP))
IF_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP))
@ -217,7 +208,6 @@ IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP))
IF_RENICE(APPLET(renice, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
@ -249,7 +239,6 @@ IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP))
IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP))
IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP))
IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac))
IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP))
/* IF_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) */
@ -262,7 +251,6 @@ IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
#endif
IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP))
/* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */
IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE))
@ -278,12 +266,10 @@ IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, BB_DIR_USR_BIN, BB_SUID_DROP, unexpand))
IF_UNIQ(APPLET(uniq, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
IF_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP))
IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP))
IF_WC(APPLET(wc, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami))
IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))

View File

@ -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

View File

@ -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

View File

@ -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]")

View File

@ -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"

View File

@ -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..."

View File

@ -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]"

View File

@ -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

View File

@ -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:

View File

@ -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...]..."

View File

@ -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]]..."

View File

@ -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"

View File

@ -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"

View File

@ -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"