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.
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 @@
#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 @@
return PyLong_FromLong(min);
}
+#endif /* HAVE_SCHED_GET_PRIORITY_MAX */
+
#ifdef HAVE_SCHED_SETSCHEDULER
PyDoc_STRVAR(posix_sched_getscheduler__doc__,
@@ -10452,8 +10456,10 @@
{"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 @@
{"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 */