12
/* Function Prototypes */
13
static PyObject * osutils_set_process_name (PyObject *self, PyObject *args);
15
/* Function Mapping Table */
16
static PyMethodDef py_osutils_functions[] =
18
{ "set_process_name", osutils_set_process_name, METH_VARARGS, "" },
19
{ NULL, NULL, 0, NULL }
25
Py_InitModule ("_osutils", py_osutils_functions);
29
osutils_set_process_name (PyObject *self, PyObject *args)
33
if (!PyArg_ParseTuple (args, "s", &name))
35
PyErr_SetString (PyExc_TypeError, "set_process_name needs a string as argument");
40
if (prctl (PR_SET_NAME, (unsigned long) name, 0, 0, 0))
42
PyErr_SetString (PyExc_IOError, "prctl() failed");
49
PyErr_SetString (PyExc_IOError, "prctl unavailable");