4 #include <asm/unistd.h>
9 proc_mount(PyObject *self, PyObject *args)
12 sts = mount("none","/proc","proc",0,NULL);
14 return Py_BuildValue("i", sts);
18 proc_umount(PyObject *self, PyObject *args)
21 sts = umount("/proc");
23 return Py_BuildValue("i", sts);
27 chfscontext(PyObject *self, PyObject *args)
32 if (!PyArg_ParseTuple(args, "s", &filepath))
35 int fd = open(filepath, O_RDONLY);
48 return Py_BuildValue("i", sts);
52 chcontext(PyObject *self, PyObject *args)
57 if (!PyArg_ParseTuple(args, "s", &filepath))
60 int fd = open(filepath, O_RDONLY);
73 return Py_BuildValue("i", sts);
76 static PyMethodDef SetnsMethods[] =
78 {"proc_mount", proc_mount, METH_VARARGS, "Mount a volume via the mount system call."},
79 {"proc_umount", proc_umount, METH_VARARGS, "Umount a volume via the umount system call."},
80 {"chcontext", chcontext, METH_VARARGS, "Switch into an lxc container."},
81 {"chfscontext", chfscontext, METH_VARARGS, "Switch into an lxc container."},
89 (void) Py_InitModule("setns", SetnsMethods);