library: correct the #define FALSE_THREADS, <PIDS> api

Awhile back, that former QUICK_THREADS #define evolved
into the development (only) FALSE_THREADS which can be
used to ensure a 'duplicate ENUM' convention is output
when certain string fields can't be easily duplicated.

Unfortunately, that original implementation was marred
with zeros being displayed for /proc/$$/meminfo fields
in all the child threads for a multi-threaded process.

So this commit corrects that zero memory field buglet.

Reference(s):
. QUICK_THREADS becomes FALSE_THREADS
commit c546d9dd4409ee11cd466c99a820a3b5dadfe3f4

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2017-06-13 00:00:00 -05:00 committed by Craig Small
parent 105de6264c
commit 876aff8584

View File

@ -989,11 +989,9 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, const proc_t *restric
MK_THREAD(t); MK_THREAD(t);
#endif #endif
#ifndef FALSE_THREADS
if (flags & PROC_FILLMEM) // read /proc/#/task/#statm if (flags & PROC_FILLMEM) // read /proc/#/task/#statm
if (file2str(path, "statm", &ub) != -1) if (file2str(path, "statm", &ub) != -1)
statm2proc(ub.buf, t); statm2proc(ub.buf, t);
#endif
if (flags & PROC_FILLSTATUS) { // read /proc/#/task/#/status if (flags & PROC_FILLSTATUS) { // read /proc/#/task/#/status
if (file2str(path, "status", &ub) != -1) { if (file2str(path, "status", &ub) != -1) {
@ -1029,10 +1027,6 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, const proc_t *restric
#ifdef FALSE_THREADS #ifdef FALSE_THREADS
if (!p) { if (!p) {
if (flags & PROC_FILLMEM)
if (file2str(path, "statm", &ub) != -1)
statm2proc(ub.buf, t);
if (flags & PROC_FILLSUPGRP) if (flags & PROC_FILLSUPGRP)
supgrps_from_supgids(t); supgrps_from_supgids(t);
#endif #endif
@ -1056,31 +1050,22 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, const proc_t *restric
#ifdef FALSE_THREADS #ifdef FALSE_THREADS
} else { } else {
if (t != p) { t->cmdline = NULL;
t->size = p->size; t->cmdline_v = NULL;
t->resident = p->resident; t->environ = NULL;
t->share = p->share; t->environ_v = NULL;
t->trs = p->trs; t->cgname = NULL;
t->lrs = p->lrs; t->cgroup = NULL;
t->drs = p->drs; t->cgroup_v = NULL;
t->dt = p->dt; t->supgid = NULL;
t->cmdline = NULL; t->supgrp = NULL;
t->cmdline_v = NULL; t->sd_mach = NULL;
t->environ = NULL; t->sd_ouid = NULL;
t->environ_v = NULL; t->sd_seat = NULL;
t->cgname = NULL; t->sd_sess = NULL;
t->cgroup = NULL; t->sd_slice = NULL;
t->cgroup_v = NULL; t->sd_unit = NULL;
t->supgid = NULL; t->sd_uunit = NULL;
t->supgrp = NULL;
t->sd_mach = NULL;
t->sd_ouid = NULL;
t->sd_seat = NULL;
t->sd_sess = NULL;
t->sd_slice = NULL;
t->sd_unit = NULL;
t->sd_uunit = NULL;
}
} }
#endif #endif