if (not args.pidns):
setns.chcontext('/proc/%s/ns/pid'%pid)
+ proc_mounted = False
if (not os.access('/proc/self',0)):
+ proc_mounted = True
setns.proc_mount()
+
+
# cgroups is not yet LXC-safe, so we need to use the course grained access control
# strategy of unmounting the filesystem
if debug: print 'lxcsu-internal:execv:','/usr/bin/setarch',exec_args
os.execv('/usr/bin/setarch',exec_args)
else:
+ setns.proc_umount()
_,status = os.waitpid(pid,0)
exit(os.WEXITSTATUS(status))
return Py_BuildValue("i", sts);
}
+static PyObject *
+proc_umount(PyObject *self, PyObject *args)
+{
+ int sts;
+ sts = umount("/proc");
+
+ return Py_BuildValue("i", sts);
+
+}
+
static PyObject *
chcontext(PyObject *self, PyObject *args)
{
static PyMethodDef SetnsMethods[] =
{
{"proc_mount", proc_mount, METH_VARARGS, "Mount a volume via the mount system call."},
+ {"proc_umount", proc_umount, METH_VARARGS, "Umount a volume via the umount system call."},
{"chcontext", chcontext, METH_VARARGS, "Switch into an lxc container."},
{"chfscontext", chfscontext, METH_VARARGS, "Switch into an lxc container."},
{NULL, NULL, 0, NULL}