https://github.com/python/cpython/commit/ea578fc6d310c85538aefbb900a326c5c3424dd5
commit: ea578fc6d310c85538aefbb900a326c5c3424dd5
branch: main
author: RUANG (James Roy) <[email protected]>
committer: encukou <[email protected]>
date: 2024-12-19T14:51:21+01:00
summary:

gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module 
(GH-127689)

files:
A Misc/NEWS.d/next/Library/2024-12-06-21-03-11.gh-issue-127688.NJqtc-.rst
M Doc/library/os.rst
M Doc/whatsnew/3.14.rst
M Modules/posixmodule.c
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index dfe5ef0726ff7d..69e6192038ab2b 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 342456cbc397f3..2e43dce5e061b4 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 00000000000000..a22b136da72faf
--- /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 2045c6065b8e7a..151d469983fafb 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 6df1116fc600f2..e59c7046305d46 100755
--- a/configure
+++ b/configure
@@ -10984,6 +10984,12 @@ if test "x$ac_cv_header_linux_soundcard_h" = xyes
 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
diff --git a/configure.ac b/configure.ac
index 8295b59b8e45fb..074e2ce3dd3024 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 166c195a8c66fc..1ca83fd2f2ca1b 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
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to