File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,6 +151,52 @@ platform.
151151 The maximum area (in bytes) of address space which may be taken by the process.
152152
153153
154+ .. data :: RLIMIT_MSGQUEUE
155+
156+ The number of bytes that can be allocated for POSIX message queues.
157+
158+ Availability: Linux 2.6.8 or later.
159+
160+ .. versionadded :: 3.4
161+
162+
163+ .. data :: RLIMIT_NICE
164+
165+ The ceiling for the process's nice level (calculated as 20 - rlim_cur).
166+
167+ Availability: Linux 2.6.12 or later.
168+
169+ .. versionadded :: 3.4
170+
171+
172+ .. data :: RLIMIT_RTPRIO
173+
174+ The ceiling of the real-time priority.
175+
176+ Availability: Linux 2.6.12 or later.
177+
178+ .. versionadded :: 3.4
179+
180+
181+ .. data :: RLIMIT_RTTIME
182+
183+ The time limit (in microseconds) on CPU time that a process can spend
184+ under real-time scheduling without making a blocking syscall.
185+
186+ Availability: Linux 2.6.25 or later.
187+
188+ .. versionadded :: 3.4
189+
190+
191+ .. data :: RLIMIT_SIGPENDING
192+
193+ The number of signals which the process may queue.
194+
195+ Availability: Linux 2.6.8 or later.
196+
197+ .. versionadded :: 3.4
198+
199+
154200Resource Usage
155201--------------
156202
Original file line number Diff line number Diff line change 1+ import sys
12import unittest
23from test import support
34import time
@@ -129,6 +130,15 @@ def test_pagesize(self):
129130 self .assertIsInstance (pagesize , int )
130131 self .assertGreaterEqual (pagesize , 0 )
131132
133+ @unittest .skipUnless (sys .platform == 'linux' , 'test requires Linux' )
134+ def test_linux_constants (self ):
135+ self .assertIsInstance (resource .RLIMIT_MSGQUEUE , int )
136+ self .assertIsInstance (resource .RLIMIT_NICE , int )
137+ self .assertIsInstance (resource .RLIMIT_RTPRIO , int )
138+ self .assertIsInstance (resource .RLIMIT_RTTIME , int )
139+ self .assertIsInstance (resource .RLIMIT_SIGPENDING , int )
140+
141+
132142def test_main (verbose = None ):
133143 support .run_unittest (ResourceTest )
134144
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ Core and Builtins
1919Library
2020-------
2121
22+ - Issue #19324: Expose Linux-specific constants in resource module.
23+
2224- Issue #17400: ipaddress should make it easy to identify rfc6598 addresses.
2325
2426- Load SSL's error strings in hashlib.
Original file line number Diff line number Diff line change @@ -326,6 +326,28 @@ PyInit_resource(void)
326326 PyModule_AddIntMacro (m , RLIMIT_SBSIZE );
327327#endif
328328
329+ /* Linux specific */
330+ #ifdef RLIMIT_MSGQUEUE
331+ PyModule_AddIntMacro (m , RLIMIT_MSGQUEUE );
332+ #endif
333+
334+ #ifdef RLIMIT_NICE
335+ PyModule_AddIntMacro (m , RLIMIT_NICE );
336+ #endif
337+
338+ #ifdef RLIMIT_RTPRIO
339+ PyModule_AddIntMacro (m , RLIMIT_RTPRIO );
340+ #endif
341+
342+ #ifdef RLIMIT_RTTIME
343+ PyModule_AddIntMacro (m , RLIMIT_RTTIME );
344+ #endif
345+
346+ #ifdef RLIMIT_SIGPENDING
347+ PyModule_AddIntMacro (m , RLIMIT_SIGPENDING );
348+ #endif
349+
350+ /* target */
329351#ifdef RUSAGE_SELF
330352 PyModule_AddIntMacro (m , RUSAGE_SELF );
331353#endif
You can’t perform that action at this time.
0 commit comments