library: normalize recently added namespaces interface
While 'invisible' thread subdirectories are accessible
under /proc/ with stat/opendir calls, they have always
been treated as non-existent, as is true with readdir.
This patch trades the /proc/#/ns access convention for
the more proper /proc/#/task/#/ns approach when thread
access is desired. In addition some namespace code has
been simplified and made slightly more efficient given
the calloc nature of proc_t acquisition and its reuse.
Reference(s):
commit a01ee3c0b3
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -31,14 +31,14 @@ EXTERN_C_BEGIN
|
||||
// neither tgid nor tid seemed correct. (in other words, FIXME)
|
||||
#define XXXID tid
|
||||
|
||||
#define NUM_NS 6
|
||||
enum ns_type {
|
||||
IPCNS = 0,
|
||||
MNTNS,
|
||||
NETNS,
|
||||
PIDNS,
|
||||
USERNS,
|
||||
UTSNS
|
||||
UTSNS,
|
||||
NUM_NS // total namespaces (fencepost)
|
||||
};
|
||||
extern const char *get_ns_name(int id);
|
||||
extern int get_ns_id(const char *name);
|
||||
@ -169,8 +169,8 @@ typedef struct proc_t {
|
||||
oom_score, // oom_score (badness for OOM killer)
|
||||
oom_adj; // oom_adj (adjustment to OOM score)
|
||||
#endif
|
||||
ino_t
|
||||
ns[NUM_NS]; // ns/* inode number of /proc/<pid>/ns/*
|
||||
long
|
||||
ns[NUM_NS]; // (ns subdir) inode number of namespaces
|
||||
} proc_t;
|
||||
|
||||
// PROCTAB: data structure holding the persistent information readproc needs
|
||||
|
Reference in New Issue
Block a user