From 72e1c89d971aa2e37abf705c6a01f002deac09b8 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 29 Sep 2007 22:26:01 +0000 Subject: pgrep,pkill: new applets by Loic Grenie --- include/applets.h | 2 ++ include/libbb.h | 4 +++- include/usage.h | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/applets.h b/include/applets.h index f162c5479..e88192d24 100644 --- a/include/applets.h +++ b/include/applets.h @@ -251,11 +251,13 @@ USE_OD(APPLET(od, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_OPENVT(APPLET(openvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_PASSWD(APPLET(passwd, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) USE_PATCH(APPLET(patch, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +USE_PGREP(APPLET(pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_PIDOF(APPLET(pidof, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_PING(APPLET(ping, _BB_DIR_BIN, _BB_SUID_MAYBE)) USE_PING6(APPLET(ping6, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_PIPE_PROGRESS(APPLET_NOUSAGE(pipe_progress, pipe_progress, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_PIVOT_ROOT(APPLET(pivot_root, _BB_DIR_SBIN, _BB_SUID_NEVER)) +USE_PKILL(APPLET_ODDNAME(pkill, pgrep, _BB_DIR_USR_BIN, _BB_SUID_NEVER, pkill)) USE_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, poweroff)) USE_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) diff --git a/include/libbb.h b/include/libbb.h index a6709c95d..34b978452 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -787,6 +787,7 @@ int bb_make_directory(char *path, long mode, int flags); int get_signum(const char *name); const char *get_signame(int number); +void print_signames_and_exit(void) ATTRIBUTE_NORETURN; char *bb_simplify_path(const char *path); @@ -973,7 +974,8 @@ enum { PSSCAN_UTIME = 1 << 13, PSSCAN_TTY = 1 << 14, PSSCAN_SMAPS = (1 << 15) * ENABLE_FEATURE_TOPMEM, - USE_SELINUX(PSSCAN_CONTEXT = 1 << 16,) + PSSCAN_ARGVN = (1 << 16) * (ENABLE_PGREP | ENABLE_PKILL), + USE_SELINUX(PSSCAN_CONTEXT = 1 << 17,) /* These are all retrieved from proc/NN/stat in one go: */ PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID | PSSCAN_COMM | PSSCAN_STATE diff --git a/include/usage.h b/include/usage.h index 4152fecd3..d7e1dd9f1 100644 --- a/include/usage.h +++ b/include/usage.h @@ -2558,6 +2558,18 @@ "$ patch -p1 < example.diff\n" \ "$ patch -p0 -i example.diff" +#define pgrep_trivial_usage \ + "[-flnovx] pattern" +#define pgrep_full_usage \ + "Display process(es) selected by regex pattern" \ + "\n\nOptions:\n" \ + " -l Show command name too\n" \ + " -f Match against entire command line\n" \ + " -n Signal the newest process only\n" \ + " -o Signal the oldest process only\n" \ + " -v Negate the matching\n" \ + " -x Match whole name (not substring)" + #if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) #define USAGE_PIDOF "Options:" #else @@ -2640,6 +2652,18 @@ "Move the current root file system to PUT_OLD and make NEW_ROOT\n" \ "the new root file system" +#define pkill_trivial_usage \ + "[-l] | [-fnovx] [-signal] pattern" +#define pkill_full_usage \ + "Send a signal to process(es) selected by regex pattern" \ + "\n\nOptions:\n" \ + " -l List all signals\n" \ + " -f Match against entire command line\n" \ + " -n Signal the newest process only\n" \ + " -o Signal the oldest process only\n" \ + " -v Negate the matching\n" \ + " -x Match whole name (not substring)" + #define poweroff_trivial_usage \ "[-d delay] [-n] [-f]" #define poweroff_full_usage \ -- cgit v1.2.3