diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/free.c | 12 | ||||
-rw-r--r-- | procps/fuser.c | 11 | ||||
-rw-r--r-- | procps/kill.c | 39 | ||||
-rw-r--r-- | procps/pgrep.c | 29 | ||||
-rw-r--r-- | procps/pidof.c | 28 | ||||
-rw-r--r-- | procps/ps.c | 47 | ||||
-rw-r--r-- | procps/renice.c | 10 | ||||
-rw-r--r-- | procps/sysctl.c | 19 | ||||
-rw-r--r-- | procps/uptime.c | 9 | ||||
-rw-r--r-- | procps/watch.c | 14 |
10 files changed, 218 insertions, 0 deletions
diff --git a/procps/free.c b/procps/free.c index ad8711f..ca75313 100644 --- a/procps/free.c +++ b/procps/free.c @@ -9,6 +9,18 @@ /* getopt not needed */ +//usage:#define free_trivial_usage +//usage: "" IF_DESKTOP("[-b/k/m/g]") +//usage:#define free_full_usage "\n\n" +//usage: "Display the amount of free and used system memory" +//usage: +//usage:#define free_example_usage +//usage: "$ free\n" +//usage: " total used free shared buffers\n" +//usage: " Mem: 257628 248724 8904 59644 93124\n" +//usage: " Swap: 128516 8404 120112\n" +//usage: "Total: 386144 257128 129016\n" + #include "libbb.h" struct globals { diff --git a/procps/fuser.c b/procps/fuser.c index a1b93d7..7837ff8 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -7,6 +7,17 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#define fuser_trivial_usage +//usage: "[OPTIONS] FILE or PORT/PROTO" +//usage:#define fuser_full_usage "\n\n" +//usage: "Find processes which use FILEs or PORTs\n" +//usage: "\nOptions:" +//usage: "\n -m Find processes which use same fs as FILEs" +//usage: "\n -4,-6 Search only IPv4/IPv6 space" +//usage: "\n -s Don't display PIDs" +//usage: "\n -k Kill found processes" +//usage: "\n -SIGNAL Signal to send (default: KILL)" + #include "libbb.h" #define MAX_LINE 255 diff --git a/procps/kill.c b/procps/kill.c index 695d266..6776d95 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -8,6 +8,45 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//usage:#define kill_trivial_usage +//usage: "[-l] [-SIG] PID..." +//usage:#define kill_full_usage "\n\n" +//usage: "Send a signal (default: TERM) to given PIDs\n" +//usage: "\nOptions:" +//usage: "\n -l List all signal names and numbers" +/* //usage: "\n -s SIG Yet another way of specifying SIG" */ +//usage: +//usage:#define kill_example_usage +//usage: "$ ps | grep apache\n" +//usage: "252 root root S [apache]\n" +//usage: "263 www-data www-data S [apache]\n" +//usage: "264 www-data www-data S [apache]\n" +//usage: "265 www-data www-data S [apache]\n" +//usage: "266 www-data www-data S [apache]\n" +//usage: "267 www-data www-data S [apache]\n" +//usage: "$ kill 252\n" +//usage: +//usage:#define killall_trivial_usage +//usage: "[-l] [-q] [-SIG] PROCESS_NAME..." +//usage:#define killall_full_usage "\n\n" +//usage: "Send a signal (default: TERM) to given processes\n" +//usage: "\nOptions:" +//usage: "\n -l List all signal names and numbers" +/* //usage: "\n -s SIG Yet another way of specifying SIG" */ +//usage: "\n -q Don't complain if no processes were killed" +//usage: +//usage:#define killall_example_usage +//usage: "$ killall apache\n" +//usage: +//usage:#define killall5_trivial_usage +//usage: "[-l] [-SIG] [-o PID]..." +//usage:#define killall5_full_usage "\n\n" +//usage: "Send a signal (default: TERM) to all processes outside current session\n" +//usage: "\nOptions:" +//usage: "\n -l List all signal names and numbers" +//usage: "\n -o PID Don't signal this PID" +/* //usage: "\n -s SIG Yet another way of specifying SIG" */ + #include "libbb.h" /* Note: kill_main is directly called from shell in order to implement diff --git a/procps/pgrep.c b/procps/pgrep.c index 5d388a8..902a3a7 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -6,6 +6,35 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ + +//usage:#define pgrep_trivial_usage +//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]" +//usage:#define pgrep_full_usage "\n\n" +//usage: "Display process(es) selected by regex PATTERN\n" +//usage: "\nOptions:" +//usage: "\n -l Show command name too" +//usage: "\n -f Match against entire command line" +//usage: "\n -n Show the newest process only" +//usage: "\n -o Show the oldest process only" +//usage: "\n -v Negate the match" +//usage: "\n -x Match whole name (not substring)" +//usage: "\n -s Match session ID (0 for current)" +//usage: "\n -P Match parent process ID" +//usage: +//usage:#define pkill_trivial_usage +//usage: "[-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]" +//usage:#define pkill_full_usage "\n\n" +//usage: "Send a signal to process(es) selected by regex PATTERN\n" +//usage: "\nOptions:" +//usage: "\n -l List all signals" +//usage: "\n -f Match against entire command line" +//usage: "\n -n Signal the newest process only" +//usage: "\n -o Signal the oldest process only" +//usage: "\n -v Negate the match" +//usage: "\n -x Match whole name (not substring)" +//usage: "\n -s Match session ID (0 for current)" +//usage: "\n -P Match parent process ID" + #include "libbb.h" #include "xregex.h" diff --git a/procps/pidof.c b/procps/pidof.c index 49e469c..e102a31 100644 --- a/procps/pidof.c +++ b/procps/pidof.c @@ -7,6 +7,34 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) +//usage:#define pidof_trivial_usage +//usage: "[OPTIONS] [NAME]..." +//usage:#define USAGE_PIDOF "\n\nOptions:" +//usage:#else +//usage:#define pidof_trivial_usage +//usage: "[NAME]..." +//usage:#define USAGE_PIDOF /* none */ +//usage:#endif +//usage:#define pidof_full_usage "\n\n" +//usage: "List PIDs of all processes with names that match NAMEs" +//usage: USAGE_PIDOF +//usage: IF_FEATURE_PIDOF_SINGLE( +//usage: "\n -s Show only one PID" +//usage: ) +//usage: IF_FEATURE_PIDOF_OMIT( +//usage: "\n -o PID Omit given pid" +//usage: "\n Use %PPID to omit pid of pidof's parent" +//usage: ) +//usage: +//usage:#define pidof_example_usage +//usage: "$ pidof init\n" +//usage: "1\n" +//usage: IF_FEATURE_PIDOF_OMIT( +//usage: "$ pidof /bin/sh\n20351 5973 5950\n") +//usage: IF_FEATURE_PIDOF_OMIT( +//usage: "$ pidof /bin/sh -o %PPID\n20351 5950") + #include "libbb.h" enum { diff --git a/procps/ps.c b/procps/ps.c index 6945780..7f273d0 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -9,6 +9,53 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//usage:#if ENABLE_DESKTOP +//usage: +//usage:#define ps_trivial_usage +//usage: "[-o COL1,COL2=HEADER]" IF_FEATURE_SHOW_THREADS(" [-T]") +//usage:#define ps_full_usage "\n\n" +//usage: "Show list of processes\n" +//usage: "\nOptions:" +//usage: "\n -o COL1,COL2=HEADER Select columns for display" +//usage: IF_FEATURE_SHOW_THREADS( +//usage: "\n -T Show threads" +//usage: ) +//usage: +//usage:#else /* !ENABLE_DESKTOP */ +//usage: +//usage:#if !ENABLE_SELINUX && !ENABLE_FEATURE_PS_WIDE +//usage:#define USAGE_PS "\nThis version of ps accepts no options" +//usage:#else +//usage:#define USAGE_PS "\nOptions:" +//usage:#endif +//usage: +//usage:#define ps_trivial_usage +//usage: "" +//usage:#define ps_full_usage "\n\n" +//usage: "Show list of processes\n" +//usage: USAGE_PS +//usage: IF_SELINUX( +//usage: "\n -Z Show selinux context" +//usage: ) +//usage: IF_FEATURE_PS_WIDE( +//usage: "\n w Wide output" +//usage: ) +//usage: +//usage:#endif /* ENABLE_DESKTOP */ +//usage: +//usage:#define ps_example_usage +//usage: "$ ps\n" +//usage: " PID Uid Gid State Command\n" +//usage: " 1 root root S init\n" +//usage: " 2 root root S [kflushd]\n" +//usage: " 3 root root S [kupdate]\n" +//usage: " 4 root root S [kpiod]\n" +//usage: " 5 root root S [kswapd]\n" +//usage: " 742 andersen andersen S [bash]\n" +//usage: " 743 andersen andersen S -bash\n" +//usage: " 745 root root S [getty]\n" +//usage: " 2990 andersen andersen R ps\n" + #include "libbb.h" /* Absolute maximum on output line length */ diff --git a/procps/renice.c b/procps/renice.c index 59194b5..067c8f7 100644 --- a/procps/renice.c +++ b/procps/renice.c @@ -19,6 +19,16 @@ * following IDs (if any). Multiple switches are allowed. */ +//usage:#define renice_trivial_usage +//usage: "{{-n INCREMENT} | PRIORITY} [[-p | -g | -u] ID...]" +//usage:#define renice_full_usage "\n\n" +//usage: "Change scheduling priority for a running process\n" +//usage: "\nOptions:" +//usage: "\n -n Adjust current nice value (smaller is faster)" +//usage: "\n -p Process id(s) (default)" +//usage: "\n -g Process group id(s)" +//usage: "\n -u Process user name(s) and/or id(s)" + #include "libbb.h" #include <sys/resource.h> diff --git a/procps/sysctl.c b/procps/sysctl.c index aba966e..f36548f 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c @@ -11,6 +11,25 @@ * v1.01.1 - busybox applet aware by <solar@gentoo.org> */ +//usage:#define sysctl_trivial_usage +//usage: "[OPTIONS] [VALUE]..." +//usage:#define sysctl_full_usage "\n\n" +//usage: "Configure kernel parameters at runtime\n" +//usage: "\nOptions:" +//usage: "\n -n Don't print key names" +//usage: "\n -e Don't warn about unknown keys" +//usage: "\n -w Change sysctl setting" +//usage: "\n -p FILE Load sysctl settings from FILE (default /etc/sysctl.conf)" +//usage: "\n -a Display all values" +//usage: "\n -A Display all values in table form" +//usage: +//usage:#define sysctl_example_usage +//usage: "sysctl [-n] [-e] variable...\n" +//usage: "sysctl [-n] [-e] -w variable=value...\n" +//usage: "sysctl [-n] [-e] -a\n" +//usage: "sysctl [-n] [-e] -p file (default /etc/sysctl.conf)\n" +//usage: "sysctl [-n] [-e] -A\n" + #include "libbb.h" enum { diff --git a/procps/uptime.c b/procps/uptime.c index 5c48795..1a7da46 100644 --- a/procps/uptime.c +++ b/procps/uptime.c @@ -15,6 +15,15 @@ /* getopt not needed */ +//usage:#define uptime_trivial_usage +//usage: "" +//usage:#define uptime_full_usage "\n\n" +//usage: "Display the time since the last boot" +//usage: +//usage:#define uptime_example_usage +//usage: "$ uptime\n" +//usage: " 1:55pm up 2:30, load average: 0.09, 0.04, 0.00\n" + #include "libbb.h" #ifndef FSHIFT diff --git a/procps/watch.c b/procps/watch.c index 36f71c4..e289bf8 100644 --- a/procps/watch.c +++ b/procps/watch.c @@ -11,6 +11,20 @@ /* BB_AUDIT SUSv3 N/A */ /* BB_AUDIT GNU defects -- only option -n is supported. */ +//usage:#define watch_trivial_usage +//usage: "[-n SEC] [-t] PROG ARGS" +//usage:#define watch_full_usage "\n\n" +//usage: "Run PROG periodically\n" +//usage: "\nOptions:" +//usage: "\n -n Loop period in seconds (default 2)" +//usage: "\n -t Don't print header" +//usage: +//usage:#define watch_example_usage +//usage: "$ watch date\n" +//usage: "Mon Dec 17 10:31:40 GMT 2000\n" +//usage: "Mon Dec 17 10:31:42 GMT 2000\n" +//usage: "Mon Dec 17 10:31:44 GMT 2000" + #include "libbb.h" // procps 2.0.18: |