From f3da99c4eec54028b41879216e9540a6f1f3965e Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Mon, 20 May 2019 21:52:13 +0200 Subject: [PATCH] cgroup_namespaces.7: In the example shell session, give second shell a different prompt Give the shell in the second cgroup namespace a different prompt, so as to clearly distinguish the two namespaces. Signed-off-by: Michael Kerrisk --- man7/cgroup_namespaces.7 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/man7/cgroup_namespaces.7 b/man7/cgroup_namespaces.7 index 42c70f7c5..a1f8d1073 100644 --- a/man7/cgroup_namespaces.7 +++ b/man7/cgroup_namespaces.7 @@ -104,7 +104,7 @@ to create a process running a new shell in new cgroup and mount namespaces: .PP .EX .in +4n -# \fBunshare \-Cm bash\fP +# \fBPS1="sh2# " unshare \-Cm bash\fP .in .EE .PP @@ -120,11 +120,11 @@ with PID 1), and the process in the sibling cgroup .PP .EX .in +4n -# \fBcat /proc/self/cgroup | grep freezer\fP +sh2# \fBcat /proc/self/cgroup | grep freezer\fP 7:freezer:/ -# \fBcat /proc/1/cgroup | grep freezer\fP +sh2# \fBcat /proc/1/cgroup | grep freezer\fP 7:freezer:/.. -# \fBcat /proc/20124/cgroup | grep freezer\fP +sh2# \fBcat /proc/20124/cgroup | grep freezer\fP 7:freezer:/../sub2 .in .EE @@ -149,7 +149,7 @@ we see the following anomaly: .PP .EX .in +4n -# \fBcat /proc/self/mountinfo | grep freezer\fP +sh2# \fBcat /proc/self/mountinfo | grep freezer\fP 155 145 0:32 /.. /sys/fs/cgroup/freezer ... .in .EE @@ -171,11 +171,11 @@ new cgroup namespace), after which we see the expected results: .PP .EX .in +4n -# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events - # to other namespaces -# \fBumount /sys/fs/cgroup/freezer\fP -# \fBmount \-t cgroup \-o freezer freezer /sys/fs/cgroup/freezer\fP -# \fBcat /proc/self/mountinfo | grep freezer\fP +sh2# \fBmount \-\-make\-rslave /\fP # Don't propagate mount events + # to other namespaces +sh2# \fBumount /sys/fs/cgroup/freezer\fP +sh2# \fBmount \-t cgroup \-o freezer freezer /sys/fs/cgroup/freezer\fP +sh2# \fBcat /proc/self/mountinfo | grep freezer\fP 155 145 0:32 / /sys/fs/cgroup/freezer rw,relatime ... .in .EE