library: some miscellaneous tweaks before smaps_rollup

This commit is strictly cosmetic. It was an attempt to
normalize/standardize/alphabetize those #define/#undef
statements. Some missing #undef's were added plus some
comments regarding sources corrected/standardized too.

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-04-26 00:00:00 -05:00 committed by Craig Small
parent 4153e72921
commit b921776dad
2 changed files with 17 additions and 14 deletions

View File

@ -346,9 +346,9 @@ srtDECL(noop) {
#define f_either PROC_SPARE_1 // either status or stat (favor stat)
#define f_exe PROC_FILL_EXE
#define f_grp PROC_FILLGRP
#define f_io PROC_FILLIO
#define f_login PROC_FILL_LUID
#define f_lxc PROC_FILL_LXC
#define f_io PROC_FILLIO
#define f_ns PROC_FILLNS
#define f_oom PROC_FILLOOM
#define f_stat PROC_FILLSTAT
@ -356,14 +356,14 @@ srtDECL(noop) {
#define f_status PROC_FILLSTATUS
#define f_systemd PROC_FILLSYSTEMD
#define f_usr PROC_FILLUSR
// these next three will yield a single string (never vectorized)
#define x_cgroup PROC_EDITCGRPCVT
#define x_cmdline PROC_EDITCMDLCVT
#define x_environ PROC_EDITENVRCVT
// these next three will yield true verctorized strings
#define v_arg PROC_FILLARG
#define v_cgroup PROC_FILLCGROUP
#define v_env PROC_FILLENV
// these next three will yield a single string (never vectorized)
#define x_cgroup PROC_EDITCGRPCVT
#define x_cmdline PROC_EDITCMDLCVT
#define x_environ PROC_EDITENVRCVT
// these next three will also force PROC_FILLSTATUS
#define x_ogroup PROC_FILL_OGROUPS
#define x_ouser PROC_FILL_OUSERS
@ -544,7 +544,10 @@ enum pids_item PIDS_logical_end = MAXTABLE(Item_table);
#undef QS
//#undef f_either // needed later
#undef f_exe
#undef f_grp
#undef f_io
#undef f_login
#undef f_lxc
#undef f_ns
#undef f_oom

View File

@ -1158,22 +1158,22 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, proc_t *restrict cons
t->euid = sb.st_uid; /* need a way to get real uid */
t->egid = sb.st_gid; /* need a way to get real gid */
if (flags & PROC_FILLSTAT) { // read /proc/#/task/#/stat
if (flags & PROC_FILLSTAT) { // read /proc/#/task/#/stat
if (file2str(path, "stat", &ub) == -1)
goto next_task;
rc += stat2proc(ub.buf, t);
}
if (flags & PROC_FILLIO) { // read /proc/#/io
if (flags & PROC_FILLIO) { // read /proc/#/task/#/io
if (file2str(path, "io", &ub) != -1)
io2proc(ub.buf, t);
}
if (flags & PROC_FILLMEM) { // read /proc/#/task/#statm
if (flags & PROC_FILLMEM) { // read /proc/#/task/#/statm
if (file2str(path, "statm", &ub) != -1)
statm2proc(ub.buf, t);
}
if (flags & PROC_FILLSTATUS) { // read /proc/#/task/#/status
if (flags & PROC_FILLSTATUS) { // read /proc/#/task/#/status
if (file2str(path, "status", &ub) != -1) {
rc += status2proc(ub.buf, t, 0);
if (flags & (PROC_FILL_SUPGRP & ~PROC_FILLSTATUS))
@ -1201,25 +1201,25 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, proc_t *restrict cons
#ifdef FALSE_THREADS
if (!IS_THREAD(t)) {
#endif
if (flags & PROC_FILLARG) // read /proc/#/task/#/cmdline
if (flags & PROC_FILLARG) // read /proc/#/task/#/cmdline
if (!(t->cmdline_v = file2strvec(path, "cmdline")))
rc += vectorize_dash_rc(&t->cmdline_v);
if (flags & PROC_EDITCMDLCVT)
rc += fill_cmdline_cvt(path, t);
if (flags & PROC_FILLENV) // read /proc/#/task/#/environ
if (flags & PROC_FILLENV) // read /proc/#/task/#/environ
if (!(t->environ_v = file2strvec(path, "environ")))
rc += vectorize_dash_rc(&t->environ_v);
if (flags & PROC_EDITENVRCVT)
rc += fill_environ_cvt(path, t);
if ((flags & PROC_FILLCGROUP)) // read /proc/#/task/#/cgroup
if ((flags & PROC_FILLCGROUP)) // read /proc/#/task/#/cgroup
if (!(t->cgroup_v = file2strvec(path, "cgroup")))
rc += vectorize_dash_rc(&t->cgroup_v);
if (flags & PROC_EDITCGRPCVT)
rc += fill_cgroup_cvt(path, t);
if (flags & PROC_FILLSYSTEMD) // get sd-login.h stuff
if (flags & PROC_FILLSYSTEMD) // get sd-login.h stuff
rc += sd2proc(t);
if (flags & PROC_FILL_EXE) {
@ -1236,7 +1236,7 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, proc_t *restrict cons
if (file2str(path, "oom_score_adj", &ub) != -1)
oomadj2proc(ub.buf, t);
}
if (flags & PROC_FILLNS) // read /proc/#/task/#/ns/*
if (flags & PROC_FILLNS) // read /proc/#/task/#/ns/*
procps_ns_read_pid(t->tid, &(t->ns));
if (flags & PROC_FILL_LXC)