All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers
	<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH lxc 2/2] lxc-unshare: make CLONE_NEWPID imply CLONE_NEWNS
Date: Thu, 13 May 2010 14:34:47 -0500	[thread overview]
Message-ID: <20100513193447.GA15830@us.ibm.com> (raw)
In-Reply-To: <20100513193412.GA15433-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

I would like to also automatically have /proc remounted, but
that would require digging deeper into lxc_clone.

Mind you perhaps having NEWPID imply NEWNS should be done there,
at src/lxc/namespace.c:lxc_clone anyway.  I'm starting here...
Won't be offended if it's rejected on those grounds :)

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 src/lxc/lxc_unshare.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/lxc/lxc_unshare.c b/src/lxc/lxc_unshare.c
index 8db1cb7..8531b59 100644
--- a/src/lxc/lxc_unshare.c
+++ b/src/lxc/lxc_unshare.c
@@ -49,6 +49,7 @@ void usage(char *cmd)
 			"\t           MOUNT, PID, UTSNAME, IPC, USER, NETWORK\n");
 	fprintf(stderr, "\t -u <id> : new id to be set if -s USER is specified\n");
 	fprintf(stderr, "\t if -s PID is specified, <command> is mandatory)\n");
+	fprintf(stderr, "\t If -s PID is specified, then -s MOUNT is implied\n");
 	_exit(1);
 }
 
@@ -213,6 +214,9 @@ int main(int argc, char *argv[])
  	if (ret)
 		usage(argv[0]);
 
+	if (flags & CLONE_NEWPID)
+		flags |= CLONE_NEWNS;
+
 	if (!(flags & CLONE_NEWUSER) && uid != -1) {
 		ERROR("-u <uid> needs -s USER option");
 		return 1;
-- 
1.6.3.3

  parent reply	other threads:[~2010-05-13 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 19:34 [PATCH lxc 1/2] lxc-unshare: accept multiple -s options Serge E. Hallyn
     [not found] ` <20100513193412.GA15433-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-05-13 19:34   ` Serge E. Hallyn [this message]
     [not found]     ` <20100513193447.GA15830-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-05-18 16:01       ` [PATCH lxc 2/2] lxc-unshare: make CLONE_NEWPID imply CLONE_NEWNS Daniel Lezcano
2010-05-18 15:49   ` [PATCH lxc 1/2] lxc-unshare: accept multiple -s options Daniel Lezcano
     [not found]     ` <4BF2B71A.8020906-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2010-05-18 16:07       ` Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100513193447.GA15830@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.