Skip to contentSkip to conversation

Add -P <pid-file> option to ns_exec

PATCH Serge E. Hallyn 1 participant 1 message May 21, 2009

lore
Share & tools
lore
#0 lore raw
Quoted 30 lines · Quoting [email protected]…

From: Sukadev Bhattiprolu <[email protected]>

ns_exec knows the pid of the container-init in its own namespace (this is usually the global pid since we normally run ns_exec in init-pid-ns). If ns_exec writes out this "global" pid to a file, wrapper scripts can find the process they created more easily.

killall and pidof assume that all previous instances of the test program have thawed and exited gracefully :-) As such they are not very friendly during early testing and/or complicate the wrapper scripts.

---
 ns_exec.c |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
ns_exec.c +1 -1
index 5d5cca3..d15daa0 100644
@@ -24,7 +24,7 @@ static const char* procname;
 
 static void usage(const char *name)
 {
-	printf("usage: %s [-h] [-c] [-muip]"
+	printf("usage: %s [-h] [-c] [-muip] [-P <pid-file>]"
 			"[command [arg ..]]\n", name);
 	printf("\n");
 	printf("  -h		this message\n");

ns_exec.c static void usage(const char *name) · line 36

Quoted 4 lines
ns_exec.c +1 -0
@@ -33,6 +33,7 @@ static void usage(const char *name)
 	printf("  -m		mount namespace\n");
 	printf("  -u		utsname namespace\n");
 	printf("  -i		ipc namespace\n");
+	printf("  -P <pid-file>	File in which to write global pid of cinit\n");

We probably don't care, but it's not necessarily the global pid.

Applying as is, bc I can't think of a better adjective.

thanks,
-serge