* (unknown),
@ 2010-02-15 22:58 Serge Hallyn
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Serge Hallyn @ 2010-02-15 22:58 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
We've currently got ns_exec both in user-cr and cr_tests. Let's
give the user-cr version all features of the cr_tests one, and
get rid of the cr_tests one.
I'm also renaming it nsexec bc nsexecwp is stupid and ns_exec is
annoying, whereas nsexec lets you type 'nse<tab>'.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] rename and install nsexec
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2010-02-15 22:58 ` Serge Hallyn
2010-02-15 22:58 ` [PATCH 2/3] ignore -eexist for mkdir of a cgroup Serge Hallyn
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Serge Hallyn @ 2010-02-15 22:58 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Rename nsexeccwp to nsexec, and have it installed into /bin.
Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
Makefile | 6 +++---
nsexeccwp.c => nsexec.c | 0
2 files changed, 3 insertions(+), 3 deletions(-)
rename nsexeccwp.c => nsexec.c (100%)
diff --git a/Makefile b/Makefile
index 3281f47..b312358 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ CFLAGS += -g $(WARNS) $(CKPT_INCLUDE) $(DEBUG)
BIN_INSTALL_DIR = /bin
LIB_INSTALL_DIR = /lib
-ECLONE_PROGS = restart nsexeccwp
+ECLONE_PROGS = restart nsexec
PROGS = checkpoint ckptinfo $(ECLONE_PROGS)
LIB_ECLONE = libeclone.a
@@ -67,8 +67,8 @@ ckptinfo_types.c: $(CKPT_HEADERS) ckptinfo.py
cat $(CKPT_HEADERS) | ./ckptinfo.py > ckptinfo_types.c
install:
- @echo /usr/bin/install -m 755 checkpoint restart ckptinfo $(BIN_INSTALL_DIR)
- @/usr/bin/install -m 755 checkpoint restart ckptinfo $(BIN_INSTALL_DIR)
+ @echo /usr/bin/install -m 755 checkpoint restart nsexec ckptinfo $(BIN_INSTALL_DIR)
+ @/usr/bin/install -m 755 checkpoint restart ckptinfo nsexec $(BIN_INSTALL_DIR)
@echo /usr/bin/install -m 755 $(LIB_ECLONE) $(LIB_INSTALL_DIR)
@/usr/bin/install -m 755 $(LIB_ECLONE) $(LIB_INSTALL_DIR)
diff --git a/nsexeccwp.c b/nsexec.c
similarity index 100%
rename from nsexeccwp.c
rename to nsexec.c
--
1.6.0.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] ignore -eexist for mkdir of a cgroup
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-15 22:58 ` [PATCH 1/3] rename and install nsexec Serge Hallyn
@ 2010-02-15 22:58 ` Serge Hallyn
2010-02-15 22:58 ` [PATCH 3/3] nsexec: remount proc and devpts Serge Hallyn
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Serge Hallyn @ 2010-02-15 22:58 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
nsexec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nsexec.c b/nsexec.c
index 859b6c3..8b96bc9 100644
--- a/nsexec.c
+++ b/nsexec.c
@@ -146,7 +146,7 @@ int move_to_new_cgroup(int newcgroup)
snprintf(cgroupname, 150, "%s/%d", cgroupbase, newcgroup);
ret = mkdir(cgroupname, 0755);
- if (ret)
+ if (ret && errno != EEXIST)
return 0;
snprintf(tasksfname, 200, "%s/tasks", cgroupname);
fout = fopen(tasksfname, "w");
--
1.6.0.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] nsexec: remount proc and devpts
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-15 22:58 ` [PATCH 1/3] rename and install nsexec Serge Hallyn
2010-02-15 22:58 ` [PATCH 2/3] ignore -eexist for mkdir of a cgroup Serge Hallyn
@ 2010-02-15 22:58 ` Serge Hallyn
[not found] ` <1266274696-23018-4-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-16 0:35 ` your mail Matt Helsley
2010-02-16 9:26 ` Oren Laadan
4 siblings, 1 reply; 9+ messages in thread
From: Serge Hallyn @ 2010-02-15 22:58 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Add -t as an nsexec option to request new devpts.
Automatically remount /proc if we are starting a new pidns.
Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
nsexec.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/nsexec.c b/nsexec.c
index 8b96bc9..3a825f1 100644
--- a/nsexec.c
+++ b/nsexec.c
@@ -15,6 +15,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/mount.h>
#include "clone.h"
#include "eclone.h"
@@ -43,6 +44,7 @@ static void usage(const char *name)
printf(" -i ipc namespace\n");
printf(" -P <pid-file> File in which to write global pid of cinit\n");
printf(" -p pid namespace\n");
+ printf(" -t mount new devpts\n");
printf(" -f <flag> extra clone flags\n");
printf("\n");
printf("(C) Copyright IBM Corp. 2006\n");
@@ -189,6 +191,38 @@ int do_child(void *vargv)
if (check_newcgrp())
return 1;
+ /* if pid == 1 then remount /proc */
+ /* But if the container has no /proc don't fret */
+ if (getpid() == 1) {
+ umount2("/proc", MNT_DETACH);
+ mount("proc", "/proc", "proc", 0, NULL);
+ }
+
+ /* check if we should remount devpts */
+ if (strcmp(argv[0], "newpts") == 0) {
+ struct stat ptystat;
+ argv++;
+ if (lstat("/dev/ptmx", &ptystat) < 0) {
+ perror("stat /dev/ptmx");
+ return -1;
+ }
+ if ((ptystat.st_mode & S_IFMT) != S_IFLNK) {
+ printf("Error: /dev/ptmx must be a link to /dev/pts/ptmx\n");
+ printf(" do: chmod 666 /dev/pts/ptmx\n");
+ printf(" rm /dev/ptmx\n");
+ printf(" ln -s /dev/pts/ptmx /dev/ptmx\n");
+ return -1;
+ }
+
+ /* if container had no /dev/pts mounted don't fret */
+ umount2("/dev/pts", MNT_DETACH);
+
+ if (mount("pts", "/dev/pts", "devpts", 0, "ptmxmode=666,newinstance") < 0) {
+ perror("mount -t devpts -o newinstance");
+ return -1;
+ }
+ }
+
execve(argv[0], argv, __environ);
perror("execve");
return 1;
@@ -217,18 +251,19 @@ int main(int argc, char *argv[])
unsigned long flags = 0, eflags = 0;
char ttyname[256];
int status;
- int ret, use_clone = 0;
+ int ret, use_clone = 0, newpts = 0;
int pid;
char *pid_file = NULL;
size_t nr_pids = 1;
pid_t chosen_pid = 0;
+ char **newargv;
procname = basename(argv[0]);
memset(ttyname, '\0', sizeof(ttyname));
readlink("/proc/self/fd/0", ttyname, sizeof(ttyname));
- while ((c = getopt(argc, argv, "+mguUiphz:cnf:P:")) != EOF) {
+ while ((c = getopt(argc, argv, "+mguUiphz:cntf:P:")) != EOF) {
switch (c) {
case 'g': do_newcgrp = getpid(); break;
case 'm': flags |= CLONE_NEWNS; break;
@@ -239,6 +274,7 @@ int main(int argc, char *argv[])
case 'U': flags |= CLONE_NEWUSER; break;
case 'n': flags |= CLONE_NEWNET; break;
case 'p': flags |= CLONE_NEWNS|CLONE_NEWPID; break;
+ case 't': newpts = 1; flags |= CLONE_NEWNS; break;
case 'z': chosen_pid = atoi(optarg); break;
case 'f': if (!string_to_ul(optarg, &eflags)) {
flags |= eflags;
@@ -259,6 +295,16 @@ int main(int argc, char *argv[])
}
argv = &argv[optind];
argc = argc - optind;
+ if (newpts) {
+ /* tell do_child about newpts through first arg */
+ int i;
+ newargv = (char **) malloc(sizeof(char *) * (argc+2));
+ newargv[0] = "newpts";
+ newargv[argc+1] = NULL;
+ for (i=0; i<argc; i++)
+ newargv[i+1] = argv[i];
+ argv = newargv;
+ }
if (do_newcgrp) {
ret = pipe(pipefd);
--
1.6.0.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: your mail
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (2 preceding siblings ...)
2010-02-15 22:58 ` [PATCH 3/3] nsexec: remount proc and devpts Serge Hallyn
@ 2010-02-16 0:35 ` Matt Helsley
[not found] ` <20100216003531.GL3714-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-02-16 9:26 ` Oren Laadan
4 siblings, 1 reply; 9+ messages in thread
From: Matt Helsley @ 2010-02-16 0:35 UTC (permalink / raw)
To: Serge Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
On Mon, Feb 15, 2010 at 04:58:13PM -0600, Serge Hallyn wrote:
> We've currently got ns_exec both in user-cr and cr_tests. Let's
> give the user-cr version all features of the cr_tests one, and
> get rid of the cr_tests one.
>
> I'm also renaming it nsexec bc nsexecwp is stupid and ns_exec is
> annoying, whereas nsexec lets you type 'nse<tab>'.
For the series:
Acked-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cheers,
-Matt Helsley
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re:
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
` (3 preceding siblings ...)
2010-02-16 0:35 ` your mail Matt Helsley
@ 2010-02-16 9:26 ` Oren Laadan
4 siblings, 0 replies; 9+ messages in thread
From: Oren Laadan @ 2010-02-16 9:26 UTC (permalink / raw)
To: Serge Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Series applied, thanks.
Oren.
Serge Hallyn wrote:
> We've currently got ns_exec both in user-cr and cr_tests. Let's
> give the user-cr version all features of the cr_tests one, and
> get rid of the cr_tests one.
>
> I'm also renaming it nsexec bc nsexecwp is stupid and ns_exec is
> annoying, whereas nsexec lets you type 'nse<tab>'.
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] nsexec: remount proc and devpts
[not found] ` <1266274696-23018-4-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2010-02-16 11:38 ` Michael Tokarev
[not found] ` <4B7A83CB.4070009-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Michael Tokarev @ 2010-02-16 11:38 UTC (permalink / raw)
To: Serge Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Serge Hallyn wrote:
> From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> Add -t as an nsexec option to request new devpts.
>
> Automatically remount /proc if we are starting a new pidns.
>
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
> nsexec.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 files changed, 48 insertions(+), 2 deletions(-)
>
> diff --git a/nsexec.c b/nsexec.c
> index 8b96bc9..3a825f1 100644
> --- a/nsexec.c
> +++ b/nsexec.c
..
Please execuse my silly question, but for _what_ this patch is? :)
It does not look like lxc-utils, and it's not in kernel either...
Thanks!
/mjt
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] nsexec: remount proc and devpts
[not found] ` <4B7A83CB.4070009-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
@ 2010-02-16 14:19 ` Serge E. Hallyn
0 siblings, 0 replies; 9+ messages in thread
From: Serge E. Hallyn @ 2010-02-16 14:19 UTC (permalink / raw)
To: Michael Tokarev; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Quoting Michael Tokarev (mjt-XAri/EZa3C4vJsYlp49lxw@public.gmane.org):
> Serge Hallyn wrote:
> > From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> >
> > Add -t as an nsexec option to request new devpts.
> >
> > Automatically remount /proc if we are starting a new pidns.
> >
> > Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > ---
> > nsexec.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
> > 1 files changed, 48 insertions(+), 2 deletions(-)
> >
> > diff --git a/nsexec.c b/nsexec.c
> > index 8b96bc9..3a825f1 100644
> > --- a/nsexec.c
> > +++ b/nsexec.c
> ..
>
>
> Please execuse my silly question, but for _what_ this patch is? :)
>
> It does not look like lxc-utils, and it's not in kernel either...
>
> Thanks!
Oops, sorry, my intro message mentioned it but I forgot to put
it in the [PATCH] description in the Subject.
This is for user-cr,
http://git.ncl.cs.columbia.edu/?p=user-cr.git;a=summary
the user-space code making use of the checkpoint/restart
syscalls.
I wonder if there is a clever way to have git auto-insert
those.
-serge
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: your mail
[not found] ` <20100216003531.GL3714-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
@ 2010-02-16 19:04 ` Sukadev Bhattiprolu
0 siblings, 0 replies; 9+ messages in thread
From: Sukadev Bhattiprolu @ 2010-02-16 19:04 UTC (permalink / raw)
To: Matt Helsley; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Matt Helsley [matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org] wrote:
| On Mon, Feb 15, 2010 at 04:58:13PM -0600, Serge Hallyn wrote:
| > We've currently got ns_exec both in user-cr and cr_tests. Let's
| > give the user-cr version all features of the cr_tests one, and
| > get rid of the cr_tests one.
| >
| > I'm also renaming it nsexec bc nsexecwp is stupid and ns_exec is
| > annoying, whereas nsexec lets you type 'nse<tab>'.
To further simplify typing, how about having nsexec clone() all namespaces
by default ? Or maybe with "-a" option ?
But this patch set looks good.
|
| For the series:
|
| Acked-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Acked-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
|
| Cheers,
| -Matt Helsley
| _______________________________________________
| Containers mailing list
| Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
| https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-02-16 19:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-15 22:58 (unknown), Serge Hallyn
[not found] ` <1266274696-23018-1-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-15 22:58 ` [PATCH 1/3] rename and install nsexec Serge Hallyn
2010-02-15 22:58 ` [PATCH 2/3] ignore -eexist for mkdir of a cgroup Serge Hallyn
2010-02-15 22:58 ` [PATCH 3/3] nsexec: remount proc and devpts Serge Hallyn
[not found] ` <1266274696-23018-4-git-send-email-serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-16 11:38 ` Michael Tokarev
[not found] ` <4B7A83CB.4070009-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
2010-02-16 14:19 ` Serge E. Hallyn
2010-02-16 0:35 ` your mail Matt Helsley
[not found] ` <20100216003531.GL3714-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-02-16 19:04 ` Sukadev Bhattiprolu
2010-02-16 9:26 ` Oren Laadan
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.