]> granicus.if.org Git - procps-ng/commitdiff
library: extend ITEMTABLE_DEBUG just a tad, <PIDS> api
authorJim Warner <james.warner@comcast.net>
Mon, 21 Dec 2020 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Mon, 28 Dec 2020 21:48:23 +0000 (08:48 +1100)
Under the above #define this commit now also addresses
2 additional possible toe stubbers involving 'select'.

If some readproc.h constants were uncoupled from their
pids.h enumerators a 'make check-lib' will now detect.

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

index 4ac4efe51ecac5d9413c59de03f82e7f029849ba..50b27d27d3313ebec70a27e72c0f59a91804f750 100644 (file)
@@ -1139,6 +1139,16 @@ PROCPS_EXPORT int procps_pids_new (
             failed = 1;
         }
     }
+    if (PIDS_SELECT_PID != PROC_PID) {
+        fprintf(stderr, "%s: header error: PIDS_SELECT_PID = 0x%04x, PROC_PID = 0x%04x\n"
+            , __FILE__, PIDS_SELECT_PID, PROC_PID);
+        failed = 1;
+    }
+    if (PIDS_SELECT_UID != PROC_UID) {
+        fprintf(stderr, "%s: header error: PIDS_SELECT_UID = 0x%04x, PROC_UID = 0x%04x\n"
+            , __FILE__, PIDS_SELECT_UID, PROC_UID);
+        failed = 1;
+    }
     if (failed) _Exit(EXIT_FAILURE);
 #endif
 
index 576fed4f0b0083e450c9b2bf6f28fdc7372c1904..fea120a673e8851b3440cd573fea8926aac9515e 100644 (file)
@@ -220,6 +220,7 @@ typedef struct PROCTAB {
 // consider only processes with one of the passed:
 #define PROC_PID             0x1000  // process id numbers ( 0   terminated)
 #define PROC_UID             0x4000  // user id numbers    ( length needed )
+// Note: the above 2 values must NOT change without also changing pids.h !!!
 
 #define PROC_EDITCGRPCVT    0x10000 // edit `cgroup' as regular string
 #define PROC_EDITCMDLCVT    0x20000 // edit `cmdline' as regular string