]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-127688: Add `SCHED_DEADLINE` and `SCHED_NORMAL` constants to `os` module (GH-127689)
authorRUANG (James Roy) <rruuaanng@outlook.com>
Thu, 19 Dec 2024 13:51:21 +0000 (21:51 +0800)
committerGitHub <noreply@github.com>
Thu, 19 Dec 2024 13:51:21 +0000 (14:51 +0100)
Doc/library/os.rst
Doc/whatsnew/3.14.rst
Misc/NEWS.d/next/Library/2024-12-06-21-03-11.gh-issue-127688.NJqtc-.rst [new file with mode: 0644]
Modules/posixmodule.c
configure
configure.ac
pyconfig.h.in

index dfe5ef0726ff7d4cd748a0530002196c1c33b701..69e6192038ab2bc22db64202fa3747d85951ba9b 100644 (file)
@@ -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.
index 342456cbc397f3c4c5564c6fd944a6af3aac17a4..2e43dce5e061b4aca89eb8d1e1f79c1d175bfe6b 100644 (file)
@@ -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 (file)
index 0000000..a22b136
--- /dev/null
@@ -0,0 +1,2 @@
+Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
+to the :mod:`os` module.
index 2045c6065b8e7a54ba8d6906a1fce08e98750e07..151d469983fafb9fc3930a579e5d54a106ce33c0 100644 (file)
@@ -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
index 6df1116fc600f2a6c93348ca0725551f9b6eec83..e59c7046305d466e5bc1ea19e329562fa6a07526 100755 (executable)
--- 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
index 8295b59b8e45fb90a0342bb2cfc3752fd54d0a8d..074e2ce3dd3024aa19271a2dc240f71625fd6860 100644 (file)
@@ -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 \
index 166c195a8c66fc95626d03c4de4ee961e031d975..1ca83fd2f2ca1b6ad3eceb25712d10c93bd70de1 100644 (file)
 /* 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