mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Move ptsname module under tools/python.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
fb4f0a0421
commit
d7ee1f5383
5 files changed
+8
-35
No files matched your search
@@ -0,0 +1,44 @@
|
||||
/******************************************************************************
|
||||
* ptsname.c
|
||||
*
|
||||
* A python extension to expose the POSIX ptsname() function.
|
||||
*
|
||||
* Copyright (C) 2007 XenSource Ltd
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Needed for Python versions earlier than 2.3. */
|
||||
#ifndef PyMODINIT_FUNC
|
||||
#define PyMODINIT_FUNC DL_EXPORT(void)
|
||||
#endif
|
||||
|
||||
static PyObject *do_ptsname(PyObject *self, PyObject *args)
|
||||
{
|
||||
int fd;
|
||||
char *path;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i", &fd))
|
||||
return NULL;
|
||||
|
||||
path = ptsname(fd);
|
||||
|
||||
if (!path)
|
||||
{
|
||||
PyErr_SetFromErrno(PyExc_IOError);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyString_FromString(path);
|
||||
}
|
||||
|
||||
static PyMethodDef ptsname_methods[] = {
|
||||
{ "ptsname", do_ptsname, METH_VARARGS },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC initptsname(void)
|
||||
{
|
||||
Py_InitModule("ptsname", ptsname_methods);
|
||||
}
|
||||
@@ -44,7 +44,14 @@ acm = Extension("acm",
|
||||
libraries = libraries,
|
||||
sources = [ "xen/lowlevel/acm/acm.c" ])
|
||||
|
||||
modules = [ xc, xs, acm ]
|
||||
ptsname = Extension("ptsname",
|
||||
extra_compile_args = extra_compile_args,
|
||||
include_dirs = include_dirs + [ "ptsname" ],
|
||||
library_dirs = library_dirs,
|
||||
libraries = libraries,
|
||||
sources = [ "ptsname/ptsname.c" ])
|
||||
|
||||
modules = [ xc, xs, acm, ptsname ]
|
||||
if os.uname()[0] == 'SunOS':
|
||||
modules.append(scf)
|
||||
|
||||
|
||||