aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h48
1 files changed, 36 insertions, 12 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 7b5221d87..607433118 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -501,23 +501,47 @@ enum { COMM_LEN = 16 };
501#endif 501#endif
502#endif 502#endif
503typedef struct { 503typedef struct {
504 int pid, ppid; 504 DIR *dir;
505 char user[9]; 505/* Fields are set to 0/NULL if failed to determine (or not requested) */
506 char state[4]; 506 char *cmd;
507 unsigned long rss; 507 unsigned long rss;
508#ifdef CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE
509 unsigned pcpu;
510 unsigned long stime, utime; 508 unsigned long stime, utime;
511#endif 509 unsigned pid;
512 char *cmd; 510 unsigned ppid;
513 511 unsigned pgid;
514 /* basename of executable file in call to exec(2), 512 unsigned sid;
515 size from kernel headers */ 513 unsigned uid;
516 char short_cmd[COMM_LEN]; 514 unsigned gid;
515 /* basename of executable file in call to exec(2), size from */
516 /* sizeof(task_struct.comm) in /usr/include/linux/sched.h */
517 char state[4];
518 char comm[COMM_LEN];
519// user/group? - use passwd/group parsing functions
517} procps_status_t; 520} procps_status_t;
518procps_status_t* procps_scan(int save_user_arg0); 521enum {
522 PSSCAN_PID = 1 << 0,
523 PSSCAN_PPID = 1 << 1,
524 PSSCAN_PGID = 1 << 2,
525 PSSCAN_SID = 1 << 3,
526 PSSCAN_UIDGID = 1 << 4,
527 PSSCAN_COMM = 1 << 5,
528 PSSCAN_CMD = 1 << 6,
529 PSSCAN_STATE = 1 << 7,
530 PSSCAN_RSS = 1 << 8,
531 PSSCAN_STIME = 1 << 9,
532 PSSCAN_UTIME = 1 << 10,
533 /* These are all retrieved from proc/NN/stat in one go: */
534 PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID
535 | PSSCAN_COMM | PSSCAN_STATE
536 | PSSCAN_RSS | PSSCAN_STIME | PSSCAN_UTIME,
537};
538procps_status_t* alloc_procps_scan(int flags);
539void free_procps_scan(procps_status_t* sp);
540procps_status_t* procps_scan(procps_status_t* sp, int flags);
519pid_t *find_pid_by_name(const char* procName); 541pid_t *find_pid_by_name(const char* procName);
520pid_t *pidlist_reverse(pid_t *pidList); 542pid_t *pidlist_reverse(pid_t *pidList);
543void clear_username_cache(void);
544const char* get_cached_username(uid_t uid);
521 545
522 546
523extern const char bb_uuenc_tbl_base64[]; 547extern const char bb_uuenc_tbl_base64[];