Skip to content

gh-127688: Add SCHED_DEADLINE and SCHED_NORMAL constants to os module #127689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Dec 19, 2024
Merged
12 changes: 12 additions & 0 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
to the :mod:`os` module.
10 changes: 10 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2928,7 +2928,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 \
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading