#undef FOR_printf
#endif
-// ps aAdeflo*p*t*u*U*g*G*w[!ol][+Ae]
+// ps aAdeflo*p*s*t*u*U*g*G*w[!ol][+Ae]
#undef OPTSTR_ps
#define OPTSTR_ps 0
#ifdef CLEANUP_ps
#undef FLAG_U
#undef FLAG_u
#undef FLAG_t
+#undef FLAG_s
#undef FLAG_p
#undef FLAG_o
#undef FLAG_l
#define FLAG_U (FORCED_FLAG<<3)
#define FLAG_u (FORCED_FLAG<<4)
#define FLAG_t (FORCED_FLAG<<5)
-#define FLAG_p (FORCED_FLAG<<6)
-#define FLAG_o (FORCED_FLAG<<7)
-#define FLAG_l (FORCED_FLAG<<8)
-#define FLAG_f (FORCED_FLAG<<9)
-#define FLAG_e (FORCED_FLAG<<10)
-#define FLAG_d (FORCED_FLAG<<11)
-#define FLAG_A (FORCED_FLAG<<12)
-#define FLAG_a (FORCED_FLAG<<13)
+#define FLAG_s (FORCED_FLAG<<6)
+#define FLAG_p (FORCED_FLAG<<7)
+#define FLAG_o (FORCED_FLAG<<8)
+#define FLAG_l (FORCED_FLAG<<9)
+#define FLAG_f (FORCED_FLAG<<10)
+#define FLAG_e (FORCED_FLAG<<11)
+#define FLAG_d (FORCED_FLAG<<12)
+#define FLAG_A (FORCED_FLAG<<13)
+#define FLAG_a (FORCED_FLAG<<14)
#endif
#ifdef FOR_pwd
int sock;
};
-// toys/pending/ps.c
-
-struct ps_data {
- struct arg_list *G;
- struct arg_list *g;
- struct arg_list *U;
- struct arg_list *u;
- struct arg_list *t;
- struct arg_list *p;
- struct arg_list *o;
-
- unsigned width;
- dev_t tty;
- void *fields;
- long pidlen, *pids, ttylen, *ttys, bits;
- long long ticks;
-};
-
// toys/pending/route.c
struct route_data {
char *tempname;
};
+// toys/posix/ps.c
+
+struct ps_data {
+ struct arg_list *G;
+ struct arg_list *g;
+ struct arg_list *U;
+ struct arg_list *u;
+ struct arg_list *t;
+ struct arg_list *s;
+ struct arg_list *p;
+ struct arg_list *o;
+
+ struct ptr_len gg, GG, pp, ss, tt, uu, UU, *parsing;
+ unsigned width;
+ dev_t tty;
+ void *fields;
+ long bits;
+ long long ticks;
+};
+
// toys/posix/renice.c
struct renice_data {
struct openvt_data openvt;
struct pgrep_data pgrep;
struct ping_data ping;
- struct ps_data ps;
struct route_data route;
struct sh_data sh;
struct sulogin_data sulogin;
struct od_data od;
struct paste_data paste;
struct patch_data patch;
+ struct ps_data ps;
struct renice_data renice;
struct sed_data sed;
struct sort_data sort;
#define help_route "usage: route -neA inet{6} / [{add|del}]\n\nDisplay/Edit kernel routing tables.\n\n-n Don't resolve names\n-e Display other/more information\n-A inet{6} Select Address Family\n\n"
-#define help_ps "usage: ps [-Aadeflw] [-gG GROUP] [-o FIELD] [-p PID] [-t TTY] [-uU USER]\n\nList processes.\n\nWhich processes to show (selections may be comma separated lists):\n\n-A All processes\n-a Processes with terminals that aren't session leaders\n-d All processes that aren't session leaders\n-e Same as -A\n-g belonging to selected session leaders (not groups: posix says so)\n-G belonging to selected real GROUP IDs\n-p selected PIDs\n-t attached to selected TTYs\n-u owned by selected USERs\n-U owned by selected real USERs\n-w Wide output (don't truncate at terminal width)\n\nWhich FIELDs to show. (Default = -o PID,TTY,TIME,CMD)\n\n-f Full listing (-o USER:8=UID,PID,PPID,C,STIME,TTY,TIME,CMD)\n-l Long listing (-o F,S,UID,PID,PPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD)\n-o Output the listed FIELDs, each with optional :size and/or =title\n\nAvailable -o FIELDs:\n\n ADDR Instruction pointer\n CMD Command line\n ETIME Elapsed time since process start\n F Process flags (PF_*) from linux source file include/sched.h\n (in octal rather than hex because posix)\n GID Group id\n GROUP Group name\n NI Niceness of process (lower niceness is higher priority)\n PCPU Percentage of CPU time used\n PGID Process Group ID\n PID Process ID\n PPID Parent Process ID\n PRI Priority\n RGID Real (before sgid) group ID\n RGROUP Real (before sgid) group name\n RSS Resident Set Size (memory currently used)\n RUID Real (before suid) user ID\n RUSER Real (before suid) user name\n S Process state:\n R (running) S (sleeping) D (disk sleep) T (stopped) t (traced)\n Z (zombie) X (dead) x (dead) K (wakekill) W (waking)\n STAT Process state (S) plus:\n < high priority N low priority L locked memory\n s session leader + foreground l multithreaded\n STIME Start time of process in hh:mm (size :19 shows yyyy-mm-dd hh:mm:ss)\n SZ Memory Size (4k pages needed to completely swap out process)\n TIME CPU time consumed\n TTY Controlling terminal\n UID User id\n USER User name\n VSZ Virtual memory size (1k units)\n WCHAN Waiting in kernel for\n\n"
-
#define help_ping "usage: ping [OPTIONS] HOST\n\nCheck network connectivity by sending packets to a host and reporting\nits response.\n\nSend ICMP ECHO_REQUEST packets to ipv4 or ipv6 addresses and prints each\necho it receives back, with round trip time.\n\nOptions:\n-4, -6 Force IPv4 or IPv6\n-c CNT Send CNT many packets\n-I IFACE/IP Source interface or address\n-q Quiet, only displays output at start and when finished\n-s SIZE Packet SIZE in bytes (default 56)\n-t TTL Set Time (number of hops) To Live\n-W SEC Seconds to wait for response after all packets sent (default 10)\n-w SEC Exit after this many seconds\n\n"
#define help_pgrep "usage: pgrep [-flnovx] [-s SID|-P PPID|PATTERN]\n pkill [-l|-SIGNAL] [-fnovx] [-s SID|-P PPID|PATTERN]\n\n-l Show command name too / List all signals\n-f Match against entire command line\n-n Show/Signal the newest process only\n-o Show/Signal the oldest process only\n-v Negate the match\n-x Match whole name (not substring)\n-s Match session ID (0 for current)\n-P Match parent process ID\n\n"
#define help_pwd "usage: pwd [-L|-P]\n\nPrint working (current) directory.\n\n-L Use shell's path from $PWD (when applicable)\n-P Print cannonical absolute path\n\n"
+#define help_ps "usage: ps [-Aadeflw] [-gG GROUP] [-o FIELD] [-p PID] [-t TTY] [-uU USER]\n\nList processes.\n\nWhich processes to show (selections may be comma separated lists):\n\n-A All processes\n-a Processes with terminals that aren't session leaders\n-d All processes that aren't session leaders\n-e Same as -A\n-g belonging to GROUPs\n-G belonging to real GROUPs (before sgid)\n-p PIDs\n-s in session IDs\n-t attached to selected TTYs\n-u owned by USERs\n-U owned by real USERs (before suid)\n-w Wide output (don't truncate at terminal width)\n\nWhich FIELDs to show. (Default = -o PID,TTY,TIME,CMD)\n\n-f Full listing (-o USER:8=UID,PID,PPID,C,STIME,TTY,TIME,CMD)\n-l Long listing (-o F,S,UID,PID,PPID,C,PRI,NI,ADDR,SZ,WCHAN,TTY,TIME,CMD)\n-o Output the listed FIELDs, each with optional :size and/or =title\n\nAvailable -o FIELDs:\n\n ADDR Instruction pointer\n CMD Command line\n ETIME Elapsed time since process start\n F Process flags (PF_*) from linux source file include/sched.h\n (in octal rather than hex because posix)\n GID Group id\n GROUP Group name\n MAJFL Major page faults\n MINFL Minor page faults\n NI Niceness of process (lower niceness is higher priority)\n PCPU Percentage of CPU time used\n PGID Process Group ID\n PID Process ID\n PPID Parent Process ID\n PRI Priority\n RGID Real (before sgid) group ID\n RGROUP Real (before sgid) group name\n RSS Resident Set Size (memory currently used)\n RUID Real (before suid) user ID\n RUSER Real (before suid) user name\n S Process state:\n R (running) S (sleeping) D (disk sleep) T (stopped) t (traced)\n Z (zombie) X (dead) x (dead) K (wakekill) W (waking)\n STAT Process state (S) plus:\n < high priority N low priority L locked memory\n s session leader + foreground l multithreaded\n STIME Start time of process in hh:mm (size :19 shows yyyy-mm-dd hh:mm:ss)\n SZ Memory Size (4k pages needed to completely swap out process)\n TIME CPU time consumed\n TTY Controlling terminal\n UID User id\n USER User name\n VSZ Virtual memory size (1k units)\n WCHAN Waiting in kernel for\n\n"
+
#define help_printf "usage: printf FORMAT [ARGUMENT...]\n\nFormat and print ARGUMENT(s) according to FORMAT, using C printf syntax\n(% escapes for cdeEfgGiosuxX, \\ escapes for abefnrtv0 or \\OCTAL or \\xHEX).\n\n"
#define help_patch "usage: patch [-i file] [-p depth] [-Ru]\n\nApply a unified diff to one or more files.\n\n-i Input file (defaults=stdin)\n-l Loose match (ignore whitespace)\n-p Number of '/' to strip from start of file paths (default=all)\n-R Reverse patch.\n-u Ignored (only handles \"unified\" diffs)\n\nThis version of patch only handles unified diffs, and only modifies\na file when all all hunks to that file apply. Patch prints failed\nhunks to stderr, and exits with nonzero status if any hunks fail.\n\nA file compared against /dev/null (or with a date <= the epoch) is\ncreated/deleted as appropriate.\n\n"
USE_REBOOT(OLDTOY(poweroff, reboot, TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
USE_PRINTENV(NEWTOY(printenv, "0(null)", TOYFLAG_USR|TOYFLAG_BIN))
USE_PRINTF(NEWTOY(printf, "<1?^", TOYFLAG_USR|TOYFLAG_BIN))
-USE_PS(NEWTOY(ps, "aAdeflo*p*t*u*U*g*G*w[!ol][+Ae]", TOYFLAG_USR|TOYFLAG_BIN))
+USE_PS(NEWTOY(ps, "aAdeflo*p*s*t*u*U*g*G*w[!ol][+Ae]", TOYFLAG_USR|TOYFLAG_BIN))
USE_PWD(NEWTOY(pwd, ">0LP[-LP]", TOYFLAG_BIN))
USE_PWDX(NEWTOY(pwdx, "<1a", TOYFLAG_USR|TOYFLAG_BIN))
USE_READAHEAD(NEWTOY(readahead, NULL, TOYFLAG_BIN))