summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/os.rst12
-rw-r--r--Doc/whatsnew/3.14.rst4
-rw-r--r--Misc/NEWS.d/next/Library/2024-12-06-21-03-11.gh-issue-127688.NJqtc-.rst2
-rw-r--r--Modules/posixmodule.c10
-rwxr-xr-xconfigure6
-rw-r--r--configure.ac2
-rw-r--r--pyconfig.h.in3
7 files changed, 38 insertions, 1 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index dfe5ef0..69e6192 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -5420,10 +5420,22 @@ operating system.
Scheduling policy for CPU-intensive processes that tries to preserve
interactivity on the rest of the computer.
+.. data:: SCHED_DEADLINE
+
+ Scheduling policy for tasks with deadline constraints.
+
+ .. versionadded:: next
+
.. data:: SCHED_IDLE
Scheduling policy for extremely low priority background tasks.
+.. data:: SCHED_NORMAL
+
+ Alias for :data:`SCHED_OTHER`.
+
+ .. versionadded:: next
+
.. data:: SCHED_SPORADIC
Scheduling policy for sporadic server programs.
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 342456c..2e43dce 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -525,6 +525,10 @@ os
same process.
(Contributed by Victor Stinner in :gh:`120057`.)
+* Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
+ to the :mod:`os` module.
+ (Contributed by James Roy in :gh:`127688`.)
+
pathlib
-------
diff --git a/Misc/NEWS.d/next/Library/2024-12-06-21-03-11.gh-issue-127688.NJqtc-.rst b/Misc/NEWS.d/next/Library/2024-12-06-21-03-11.gh-issue-127688.NJqtc-.rst
new file mode 100644
index 0000000..a22b136
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-12-06-21-03-11.gh-issue-127688.NJqtc-.rst
@@ -0,0 +1,2 @@
+Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
+to the :mod:`os` module.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2045c60..151d469 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -311,6 +311,10 @@ corresponding Unix manual entries for more information on calls.");
# include <sched.h>
#endif
+#ifdef HAVE_LINUX_SCHED_H
+# include <linux/sched.h>
+#endif
+
#if !defined(CPU_ALLOC) && defined(HAVE_SCHED_SETAFFINITY)
# undef HAVE_SCHED_SETAFFINITY
#endif
@@ -17523,9 +17527,15 @@ all_ins(PyObject *m)
#ifdef SCHED_OTHER
if (PyModule_AddIntMacro(m, SCHED_OTHER)) return -1;
#endif
+#ifdef SCHED_DEADLINE
+ if (PyModule_AddIntMacro(m, SCHED_DEADLINE)) return -1;
+#endif
#ifdef SCHED_FIFO
if (PyModule_AddIntMacro(m, SCHED_FIFO)) return -1;
#endif
+#ifdef SCHED_NORMAL
+ if (PyModule_AddIntMacro(m, SCHED_NORMAL)) return -1;
+#endif
#ifdef SCHED_RR
if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
#endif
diff --git a/configure b/configure
index 6df1116..e59c704 100755
--- a/configure
+++ b/configure
@@ -10985,6 +10985,12 @@ then :
printf "%s\n" "#define HAVE_LINUX_SOUNDCARD_H 1" >>confdefs.h
fi
+ac_fn_c_check_header_compile "$LINENO" "linux/sched.h" "ac_cv_header_linux_sched_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_sched_h" = xyes
+then :
+ printf "%s\n" "#define HAVE_LINUX_SCHED_H 1" >>confdefs.h
+
+fi
ac_fn_c_check_header_compile "$LINENO" "linux/tipc.h" "ac_cv_header_linux_tipc_h" "$ac_includes_default"
if test "x$ac_cv_header_linux_tipc_h" = xyes
then :
diff --git a/configure.ac b/configure.ac
index 8295b59..074e2ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2931,7 +2931,7 @@ AC_DEFINE([STDC_HEADERS], [1],
AC_CHECK_HEADERS([ \
alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \
io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \
- linux/netfilter_ipv4.h linux/random.h linux/soundcard.h \
+ linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \
linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \
sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 166c195..1ca83fd 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -744,6 +744,9 @@
/* Define to 1 if you have the <linux/random.h> header file. */
#undef HAVE_LINUX_RANDOM_H
+/* Define to 1 if you have the <linux/sched.h> header file. */
+#undef HAVE_LINUX_SCHED_H
+
/* Define to 1 if you have the <linux/soundcard.h> header file. */
#undef HAVE_LINUX_SOUNDCARD_H