4 #include <asm-generic/unistd.h>
7 chfscontext(PyObject *self, PyObject *args)
12 if (!PyArg_ParseTuple(args, "s", &filepath))
15 int fd = open(filepath, O_RDONLY);
17 //printf("Could not open ns file\n");
28 return Py_BuildValue("i", sts);
31 chcontext(PyObject *self, PyObject *args)
36 if (!PyArg_ParseTuple(args, "s", &filepath))
39 int fd = open(filepath, O_RDONLY);
41 // printf("Could not open ns file\n");
52 return Py_BuildValue("i", sts);
55 static PyMethodDef SetnsMethods[] =
57 {"chcontext", chcontext, METH_VARARGS, "Switch into an lxc container."},
58 {"chfscontext", chfscontext, METH_VARARGS, "Switch into an lxc container."},
66 (void) Py_InitModule("setns", SetnsMethods);