library: try to minimize the results types, <PIDS> api

This is just beginning an effort to minimize/normalize
the sheer variety of results types in use for our API.

In taking these first baby steps, a few anomalies were
found. There'll no doubt be many more yet to discover.

. the _FLT_ (fault) fields were already signed long in
the proc_t (even though their sscanf format used %lu).

. although strtoul will alway return an unsigned long,
all of the _VM_ fields were made signed long just like
other memory fields (& signed sorts more efficiently).

Reference(s):
http://www.freelists.org/post/procps/newlib-drip-drip,4

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-05-15 00:00:00 -05:00
committed by Craig Small
parent 56def1cbac
commit 540342620b
4 changed files with 76 additions and 76 deletions

View File

@@ -43,7 +43,7 @@ typedef struct proc_t {
int
tid, // (special) task id, the POSIX thread ID (see also: tgid)
ppid; // stat,status pid of parent process
unsigned long // next 2 fields are NOT filled in by readproc
long // next 2 fields are NOT filled in by readproc
maj_delta, // stat (special) major page faults since last update
min_delta; // stat (special) minor page faults since last update
unsigned
@@ -102,7 +102,7 @@ typedef struct proc_t {
lrs, // statm library resident set (always 0 w/ 2.6)
drs, // statm data+stack resident set (as # pages)
dt; // statm dirty pages (always 0 w/ 2.6)
unsigned long
long
vm_size, // status equals 'size' (as kb)
vm_lock, // status locked pages (as kb)
vm_rss, // status equals 'rss' and/or 'resident' (as kb)