]> granicus.if.org Git - procps-ng/commitdiff
library: a couple of miscellaneous changes, <PIDS> api
authorJim Warner <james.warner@comcast.net>
Sat, 18 Jun 2016 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Tue, 21 Jun 2016 10:58:09 +0000 (20:58 +1000)
This patch represents the following minor adjustments:

. old PROCTAB used with select & reap more descriptive

. reformatted PROCPS_PIDS_VAL macro like other 3rd gen

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/pids.c
proc/pids.h

index 1bb5df4de7097a665aa6426d0627587972f0f980..d5758d38646e1ab32393fea45a3b7d80114ac330 100644 (file)
@@ -79,10 +79,10 @@ struct procps_pidsinfo {
     proc_t*(*read_something)(PROCTAB*, proc_t*); // readproc/readeither via which
     unsigned pgs2k_shift;              // to convert some proc vaules
     unsigned oldflags;                 // the old library PROC_FILL flagss
-    PROCTAB *PT;                       // the old library essential interface
+    PROCTAB *fetch_PT;                 // oldlib interface for 'select' & 'reap'
     unsigned long hertz;               // for TIME_ALL & TIME_ELAPSED calculations
     unsigned long long boot_seconds;   // for TIME_ELAPSED calculation
-    PROCTAB *get_PT;                   // old library interface for active 'get'
+    PROCTAB *get_PT;                   // oldlib interface for active 'get'
     struct stacks_extent *get_ext;     // an extent used for active 'get'
     enum pids_fetch_type get_type;     // last known type of 'get' request
 };
@@ -1077,7 +1077,7 @@ static int stacks_fetch (
 
     // iterate stuff --------------------------------------
     n_inuse = 0;
-    while (info->read_something(info->PT, &task)) {
+    while (info->read_something(info->fetch_PT, &task)) {
         if (!(n_inuse < n_alloc)) {
             n_alloc += MEMORY_INCR;
             if ((!(info->fetch.anchor = realloc(info->fetch.anchor, sizeof(void *) * n_alloc)))
@@ -1337,13 +1337,13 @@ PROCPS_EXPORT struct pids_fetch *procps_pids_reap (
     if (!info->curitems)
         return NULL;
 
-    if (!oldproc_open(&info->PT, info->oldflags))
+    if (!oldproc_open(&info->fetch_PT, info->oldflags))
         return NULL;
     info->read_something = which ? readeither : readproc;
 
     rc = stacks_fetch(info);
 
-    oldproc_close(&info->PT);
+    oldproc_close(&info->fetch_PT);
     // we better have found at least 1 pid
     return (rc > 0) ? &info->fetch.results : NULL;
 } // end: procps_pids_reap
@@ -1421,13 +1421,13 @@ PROCPS_EXPORT struct pids_fetch *procps_pids_select (
     memcpy(ids, these, sizeof(unsigned) * numthese);
     ids[numthese] = 0;
 
-    if (!oldproc_open(&info->PT, (info->oldflags | which), ids, numthese))
+    if (!oldproc_open(&info->fetch_PT, (info->oldflags | which), ids, numthese))
         return NULL;
     info->read_something = readproc;
 
     rc = stacks_fetch(info);
 
-    oldproc_close(&info->PT);
+    oldproc_close(&info->fetch_PT);
     // no guarantee any pids/uids were found
     return (rc > -1) ? &info->fetch.results : NULL;
 } // end: procps_pids_select
index b978a5df3feb152f56fb9f760af01bd6f3e75389..a3285fc5591770639f7a79ede597a75d17abeefa 100644 (file)
@@ -192,8 +192,8 @@ struct pids_fetch {
 };
 
 
-#define PROCPS_PIDS_VAL(rel_enum,type,stack) \
-    stack -> head [ rel_enum ] . result . type
+#define PROCPS_PIDS_VAL( relative_enum, type, stack ) \
+    stack -> head [ relative_enum ] . result . type
 
 
 struct procps_pidsinfo;