Move ptsname module under tools/python.

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-03-05 18:54:26 +00:00
1 parent fb4f0a0421
commit d7ee1f5383
5 files changed
+8 -35

No files matched your search

+44
View File
@@ -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);
}
+8 -1
View File
@@ -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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.