library: rework namespace calls

Functions related to namespaces were half-in half-out of the
procps library and didn't fit the standard naming scheme.

While struct { long ns[x]} is a bit clunky, its the only way
to "lock in" x. The alternative is to use ns_* variables.

This work was needed before pgrep could be converted.
This commit is contained in:
Craig Small
2015-09-03 22:32:19 +10:00
parent d9caf0980e
commit a61f78d6e0
16 changed files with 297 additions and 134 deletions

View File

@ -12,6 +12,7 @@
#include <proc/procps.h>
#include <proc/pwcache.h>
#include <proc/namespace.h>
#define SIGNAL_STRING
//#define QUICK_THREADS /* copy (vs. read) some thread info from parent proc_t */
@ -163,8 +164,7 @@ typedef struct proc_t {
int
oom_score, // oom_score (badness for OOM killer)
oom_adj; // oom_adj (adjustment to OOM score)
long
ns[NUM_NS]; // (ns subdir) inode number of namespaces
struct procps_namespaces ns; // (ns subdir) inode number of namespaces
char
*sd_mach, // n/a systemd vm/container name
*sd_ouid, // n/a systemd session owner uid