ps: add -o tty and -o rss support

1373      14      24    1411     583 busybox.t1/procps/ps.o
   1462      14      24    1500     5dc busybox.t2/procps/ps.o
This commit is contained in:
Denis Vlasenko
2007-04-19 14:46:14 +00:00
parent c34d35557b
commit 516a0ca2dc
4 changed files with 80 additions and 48 deletions

View File

@@ -805,7 +805,7 @@ typedef struct {
DIR *dir;
/* Fields are set to 0/NULL if failed to determine (or not requested) */
char *cmd;
unsigned long vsz;
unsigned vsz, rss; /* we round it to kbytes */
unsigned long stime, utime;
unsigned pid;
unsigned ppid;
@@ -813,9 +813,10 @@ typedef struct {
unsigned sid;
unsigned uid;
unsigned gid;
/* basename of executable file in call to exec(2), size from */
/* sizeof(task_struct.comm) in /usr/include/linux/sched.h */
char state[4];
char tty_str[8]; /* "maj,min" or "?" */
/* basename of executable in exec(2), read from /proc/N/stat, */
/* size from sizeof(task_struct.comm) in /usr/include/linux/sched.h */
char comm[COMM_LEN];
/* user/group? - use passwd/group parsing functions */
} procps_status_t;
@@ -829,12 +830,16 @@ enum {
PSSCAN_CMD = 1 << 6,
PSSCAN_STATE = 1 << 7,
PSSCAN_VSZ = 1 << 8,
PSSCAN_STIME = 1 << 9,
PSSCAN_UTIME = 1 << 10,
PSSCAN_RSS = 1 << 9,
PSSCAN_STIME = 1 << 10,
PSSCAN_UTIME = 1 << 11,
PSSCAN_TTY = 1 << 12,
/* These are all retrieved from proc/NN/stat in one go: */
PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID
| PSSCAN_COMM | PSSCAN_STATE
| PSSCAN_VSZ | PSSCAN_STIME | PSSCAN_UTIME,
| PSSCAN_VSZ | PSSCAN_RSS
| PSSCAN_STIME | PSSCAN_UTIME
| PSSCAN_TTY,
};
procps_status_t* alloc_procps_scan(int flags);
void free_procps_scan(procps_status_t* sp);