pgrep: introduce support for namespaces

A PID should be specified with --ns:
	$ pgrep --ns 12345
which will only match the processes which belong to to the same 6
namespaces. It is also possible to specify which namespaces to test:
	$ pgrep --ns 12345 --nslist mnt,net,ipc
which will match processes that belong to the same mount, network and
IPC namespaces as PID 12345.

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
This commit is contained in:
Aristeu Rozanski
2013-04-12 14:40:27 -04:00
parent a01ee3c0b3
commit de7b3b9222
5 changed files with 117 additions and 4 deletions

7
include/nsutils.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef PROCPS_NG_NSUTILS
#define PROCPS_NG_NSUTILS
#include "proc/readproc.h"
int ns_read(pid_t pid, proc_t *ns_task);
#endif