diff options
author | Charles-François Natali <neologix@free.fr> | 2011-09-06 17:03:35 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-09-06 17:03:35 (GMT) |
commit | ea0d5fcb4a6ba8f7fa7691a9e92cbec4918dcce8 (patch) | |
tree | 3e3c3175335b22c3e1189dc97be47ac396f9402c /Modules/posixmodule.c | |
parent | e0afb16a317b71df0c538369a9fe223685d57b95 (diff) | |
download | cpython-ea0d5fcb4a6ba8f7fa7691a9e92cbec4918dcce8.zip cpython-ea0d5fcb4a6ba8f7fa7691a9e92cbec4918dcce8.tar.gz cpython-ea0d5fcb4a6ba8f7fa7691a9e92cbec4918dcce8.tar.bz2 |
Issue #12871: sched_get_priority_(min|max) might not be defined even though
<sched.h> is available (most notably on OpenBSD when built without pthread):
add an explicit configure check.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 1416a7c..9019415 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4555,6 +4555,8 @@ posix_fork(PyObject *self, PyObject *noargs) #ifdef HAVE_SCHED_H +#ifdef HAVE_SCHED_GET_PRIORITY_MAX + PyDoc_STRVAR(posix_sched_get_priority_max__doc__, "sched_get_priority_max(policy)\n\n\ Get the maximum scheduling priority for *policy*."); @@ -4589,6 +4591,8 @@ posix_sched_get_priority_min(PyObject *self, PyObject *args) return PyLong_FromLong(min); } +#endif /* HAVE_SCHED_GET_PRIORITY_MAX */ + #ifdef HAVE_SCHED_SETSCHEDULER PyDoc_STRVAR(posix_sched_getscheduler__doc__, @@ -10452,8 +10456,10 @@ static PyMethodDef posix_methods[] = { {"fork", posix_fork, METH_NOARGS, posix_fork__doc__}, #endif /* HAVE_FORK */ #ifdef HAVE_SCHED_H +#ifdef HAVE_SCHED_GET_PRIORITY_MAX {"sched_get_priority_max", posix_sched_get_priority_max, METH_VARARGS, posix_sched_get_priority_max__doc__}, {"sched_get_priority_min", posix_sched_get_priority_min, METH_VARARGS, posix_sched_get_priority_min__doc__}, +#endif #ifdef HAVE_SCHED_SETPARAM {"sched_getparam", posix_sched_getparam, METH_VARARGS, posix_sched_getparam__doc__}, #endif @@ -10474,7 +10480,7 @@ static PyMethodDef posix_methods[] = { {"sched_setaffinity", posix_sched_setaffinity, METH_VARARGS, posix_sched_setaffinity__doc__}, {"sched_getaffinity", posix_sched_getaffinity, METH_VARARGS, posix_sched_getaffinity__doc__}, #endif -#endif +#endif /* HAVE_SCHED_H */ #if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) {"openpty", posix_openpty, METH_NOARGS, posix_openpty__doc__}, #endif /* HAVE_OPENPTY || HAVE__GETPTY || HAVE_DEV_PTMX */ |