4 #include <asm/unistd.h>
8 chfscontext(PyObject *self, PyObject *args)
13 if (!PyArg_ParseTuple(args, "s", &filepath))
16 int fd = open(filepath, O_RDONLY);
28 return Py_BuildValue("i", sts);
32 proc_mount(PyObject *self, PyObject *args)
35 sts = mount("none","/proc","proc",0,NULL);
37 return Py_BuildValue("i", sts);
41 proc_umount(PyObject *self, PyObject *args)
44 sts = umount("/proc");
46 return Py_BuildValue("i", sts);
51 chcontext(PyObject *self, PyObject *args)
56 if (!PyArg_ParseTuple(args, "s", &filepath))
59 int fd = open(filepath, O_RDONLY);
71 return Py_BuildValue("i", sts);
74 static PyMethodDef SetnsMethods[] =
76 {"proc_mount", proc_mount, METH_VARARGS, "Mount a volume via the mount system call."},
77 {"proc_umount", proc_umount, METH_VARARGS, "Umount a volume via the umount system call."},
78 {"chcontext", chcontext, METH_VARARGS, "Switch into an lxc container."},
79 {"chfscontext", chfscontext, METH_VARARGS, "Switch into an lxc container."},
87 (void) Py_InitModule("setns", SetnsMethods);