Mercurial > cpython-lru_cache-weakref
annotate Modules/sgimodule.c @ 54294:dba767bc3155 legacy-trunk
remove mention of old ctypes version
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 23 May 2009 20:59:09 +0000 |
| parents | 59d3913a29c4 |
| children | fd25030223b0 |
| rev | line source |
|---|---|
| 862 | 1 |
| 2 /* SGI module -- random SGI-specific things */ | |
| 3 | |
| 4650 | 4 #include "Python.h" |
| 862 | 5 |
|
1878
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
6 #include <sys/types.h> |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
7 #include <sys/stat.h> |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
8 #include <fcntl.h> |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
9 |
| 4650 | 10 static PyObject * |
|
13502
7348cceee8fa
ANSI-fication
Peter Schneider-Kamp <nowonder@nowonder.de>
parents:
13256
diff
changeset
|
11 sgi_nap(PyObject *self, PyObject *args) |
| 862 | 12 { |
| 13 long ticks; | |
|
22772
59d3913a29c4
Convert more METH_OLDARGS & PyArg_Parse()
Neal Norwitz <nnorwitz@gmail.com>
parents:
21757
diff
changeset
|
14 if (!PyArg_ParseTuple(args, "l:nap", &ticks)) |
| 862 | 15 return NULL; |
| 4650 | 16 Py_BEGIN_ALLOW_THREADS |
| 862 | 17 sginap(ticks); |
| 4650 | 18 Py_END_ALLOW_THREADS |
| 19 Py_INCREF(Py_None); | |
| 20 return Py_None; | |
| 862 | 21 } |
| 22 | |
|
1878
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
23 extern char *_getpty(int *, int, mode_t, int); |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
24 |
| 4650 | 25 static PyObject * |
|
13502
7348cceee8fa
ANSI-fication
Peter Schneider-Kamp <nowonder@nowonder.de>
parents:
13256
diff
changeset
|
26 sgi__getpty(PyObject *self, PyObject *args) |
|
1878
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
27 { |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
28 int oflag; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
29 int mode; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
30 int nofork; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
31 char *name; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
32 int fildes; |
|
22772
59d3913a29c4
Convert more METH_OLDARGS & PyArg_Parse()
Neal Norwitz <nnorwitz@gmail.com>
parents:
21757
diff
changeset
|
33 if (!PyArg_ParseTuple(args, "iii:_getpty", &oflag, &mode, &nofork)) |
|
1878
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
34 return NULL; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
35 errno = 0; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
36 name = _getpty(&fildes, oflag, (mode_t)mode, nofork); |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
37 if (name == NULL) { |
| 4650 | 38 PyErr_SetFromErrno(PyExc_IOError); |
|
1878
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
39 return NULL; |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
40 } |
| 4650 | 41 return Py_BuildValue("(si)", name, fildes); |
|
1878
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
42 } |
|
27d4f1f9346c
Added _getpty interface.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
43 |
| 4650 | 44 static PyMethodDef sgi_methods[] = { |
|
22772
59d3913a29c4
Convert more METH_OLDARGS & PyArg_Parse()
Neal Norwitz <nnorwitz@gmail.com>
parents:
21757
diff
changeset
|
45 {"nap", sgi_nap, METH_VARARGS}, |
|
59d3913a29c4
Convert more METH_OLDARGS & PyArg_Parse()
Neal Norwitz <nnorwitz@gmail.com>
parents:
21757
diff
changeset
|
46 {"_getpty", sgi__getpty, METH_VARARGS}, |
| 862 | 47 {NULL, NULL} /* sentinel */ |
| 48 }; | |
| 49 | |
| 50 | |
| 51 void | |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13502
diff
changeset
|
52 initsgi(void) |
| 862 | 53 { |
| 4650 | 54 Py_InitModule("sgi", sgi_methods); |
| 862 | 55 } |
