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 <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2019-05-20 21:52:13 +02:00
parent 727e560920
commit f3da99c4ee
1 changed files with 10 additions and 10 deletions

View File

@ -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