Added information on function name added to LogRecord, and the 'extra' keyword parameter.
[python.git] / Modules / sgimodule.c
blobf7e12635c153441485df8436f52ce89d3007495f
2 /* SGI module -- random SGI-specific things */
4 #include "Python.h"
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <fcntl.h>
10 static PyObject *
11 sgi_nap(PyObject *self, PyObject *args)
13 long ticks;
14 if (!PyArg_ParseTuple(args, "l:nap", &ticks))
15 return NULL;
16 Py_BEGIN_ALLOW_THREADS
17 sginap(ticks);
18 Py_END_ALLOW_THREADS
19 Py_INCREF(Py_None);
20 return Py_None;
23 extern char *_getpty(int *, int, mode_t, int);
25 static PyObject *
26 sgi__getpty(PyObject *self, PyObject *args)
28 int oflag;
29 int mode;
30 int nofork;
31 char *name;
32 int fildes;
33 if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork))
34 return NULL;
35 errno = 0;
36 name = _getpty(&fildes, oflag, (mode_t)mode, nofork);
37 if (name == NULL) {
38 PyErr_SetFromErrno(PyExc_IOError);
39 return NULL;
41 return Py_BuildValue("(si)", name, fildes);
44 static PyMethodDef sgi_methods[] = {
45 {"nap", sgi_nap, METH_VARARGS},
46 {"_getpty", sgi__getpty, METH_VARARGS},
47 {NULL, NULL} /* sentinel */
51 void
52 initsgi(void)
54 Py_InitModule("sgi", sgi_methods);