Skip to content

Commit ea578fc

Browse files
authored
pythongh-127688: Add SCHED_DEADLINE and SCHED_NORMAL constants to os module (pythonGH-127689)
1 parent 19c5134 commit ea578fc

File tree

7 files changed

+38
-1
lines changed

7 files changed

+38
-1
lines changed

Doc/library/os.rst

+12
Original file line numberDiff line numberDiff line change
@@ -5420,10 +5420,22 @@ operating system.
54205420
Scheduling policy for CPU-intensive processes that tries to preserve
54215421
interactivity on the rest of the computer.
54225422

5423+
.. data:: SCHED_DEADLINE
5424+
5425+
Scheduling policy for tasks with deadline constraints.
5426+
5427+
.. versionadded:: next
5428+
54235429
.. data:: SCHED_IDLE
54245430

54255431
Scheduling policy for extremely low priority background tasks.
54265432

5433+
.. data:: SCHED_NORMAL
5434+
5435+
Alias for :data:`SCHED_OTHER`.
5436+
5437+
.. versionadded:: next
5438+
54275439
.. data:: SCHED_SPORADIC
54285440

54295441
Scheduling policy for sporadic server programs.

Doc/whatsnew/3.14.rst

+4
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ os
525525
same process.
526526
(Contributed by Victor Stinner in :gh:`120057`.)
527527

528+
* Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
529+
to the :mod:`os` module.
530+
(Contributed by James Roy in :gh:`127688`.)
531+
528532

529533
pathlib
530534
-------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
2+
to the :mod:`os` module.

Modules/posixmodule.c

+10
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ corresponding Unix manual entries for more information on calls.");
311311
# include <sched.h>
312312
#endif
313313

314+
#ifdef HAVE_LINUX_SCHED_H
315+
# include <linux/sched.h>
316+
#endif
317+
314318
#if !defined(CPU_ALLOC) && defined(HAVE_SCHED_SETAFFINITY)
315319
# undef HAVE_SCHED_SETAFFINITY
316320
#endif
@@ -17523,9 +17527,15 @@ all_ins(PyObject *m)
1752317527
#ifdef SCHED_OTHER
1752417528
if (PyModule_AddIntMacro(m, SCHED_OTHER)) return -1;
1752517529
#endif
17530+
#ifdef SCHED_DEADLINE
17531+
if (PyModule_AddIntMacro(m, SCHED_DEADLINE)) return -1;
17532+
#endif
1752617533
#ifdef SCHED_FIFO
1752717534
if (PyModule_AddIntMacro(m, SCHED_FIFO)) return -1;
1752817535
#endif
17536+
#ifdef SCHED_NORMAL
17537+
if (PyModule_AddIntMacro(m, SCHED_NORMAL)) return -1;
17538+
#endif
1752917539
#ifdef SCHED_RR
1753017540
if (PyModule_AddIntMacro(m, SCHED_RR)) return -1;
1753117541
#endif

configure

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -2931,7 +2931,7 @@ AC_DEFINE([STDC_HEADERS], [1],
29312931
AC_CHECK_HEADERS([ \
29322932
alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \
29332933
io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \
2934-
linux/netfilter_ipv4.h linux/random.h linux/soundcard.h \
2934+
linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \
29352935
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 \
29362936
sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
29372937
sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \

pyconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,9 @@
744744
/* Define to 1 if you have the <linux/random.h> header file. */
745745
#undef HAVE_LINUX_RANDOM_H
746746

747+
/* Define to 1 if you have the <linux/sched.h> header file. */
748+
#undef HAVE_LINUX_SCHED_H
749+
747750
/* Define to 1 if you have the <linux/soundcard.h> header file. */
748751
#undef HAVE_LINUX_SOUNDCARD_H
749752

0 commit comments

Comments
 (0)