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

This commit is contained in:
RUANG (James Roy) 2024-12-19 21:51:21 +08:00 committed by GitHub
parent 19c5134d57
commit ea578fc6d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 38 additions and 1 deletions

View 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.

View 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
-------

View File

@ -0,0 +1,2 @@
Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
to the :mod:`os` module.

View 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

6
configure vendored
View File

@ -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

View 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 \

View File

@ -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