Add minijail_run_pid() to return the pid of the jailed child process.
This is needed when sandboxing processes whose pid's are needed
by the parent process (starting with dhcpcd and shill).
BUG=None
TEST=security_Minijail0 still works.
Change-Id: I3e6c5b19b9c7e70aea8230e6c1395097fb697b4f
Reviewed-on: https://gerrit.chromium.org/gerrit/20413
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>
diff --git a/libminijail.h b/libminijail.h
index aaba43f..e3828af 100644
--- a/libminijail.h
+++ b/libminijail.h
@@ -101,6 +101,12 @@
int minijail_run(struct minijail *j, const char *filename,
char *const argv[]);
+/* Run the specified command in the given minijail, execve(3)-style.
+ * Update |*pchild_pid| with the pid of the child.
+ */
+int minijail_run_pid(struct minijail *j, const char *filename,
+ char *const argv[], pid_t *pchild_pid);
+
/* Kill the specified minijail. The minijail must have been created with pid
* namespacing; if it was, all processes inside it are atomically killed.
*/