Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0724e032
Commit
0724e032
authored
Oct 22, 2013
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19324: Expose Linux-specific constants in resource module
parent
71949392
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
0 deletions
+80
-0
Doc/library/resource.rst
Doc/library/resource.rst
+46
-0
Lib/test/test_resource.py
Lib/test/test_resource.py
+10
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/resource.c
Modules/resource.c
+22
-0
No files found.
Doc/library/resource.rst
View file @
0724e032
...
...
@@ -151,6 +151,52 @@ platform.
The maximum area (in bytes) of address space which may be taken by the process.
.. data:: RLIMIT_MSGQUEUE
The number of bytes that can be allocated for POSIX message queues.
Availability: Linux 2.6.8 or later.
.. versionadded:: 3.4
.. data:: RLIMIT_NICE
The ceiling for the process's nice level (calculated as 20 - rlim_cur).
Availability: Linux 2.6.12 or later.
.. versionadded:: 3.4
.. data:: RLIMIT_RTPRIO
The ceiling of the real-time priority.
Availability: Linux 2.6.12 or later.
.. versionadded:: 3.4
.. data:: RLIMIT_RTTIME
The time limit (in microseconds) on CPU time that a process can spend
under real-time scheduling without making a blocking syscall.
Availability: Linux 2.6.25 or later.
.. versionadded:: 3.4
.. data:: RLIMIT_SIGPENDING
The number of signals which the process may queue.
Availability: Linux 2.6.8 or later.
.. versionadded:: 3.4
Resource Usage
--------------
...
...
Lib/test/test_resource.py
View file @
0724e032
import
sys
import
unittest
from
test
import
support
import
time
...
...
@@ -129,6 +130,15 @@ class ResourceTest(unittest.TestCase):
self
.
assertIsInstance
(
pagesize
,
int
)
self
.
assertGreaterEqual
(
pagesize
,
0
)
@
unittest
.
skipUnless
(
sys
.
platform
==
'linux'
,
'test requires Linux'
)
def
test_linux_constants
(
self
):
self
.
assertIsInstance
(
resource
.
RLIMIT_MSGQUEUE
,
int
)
self
.
assertIsInstance
(
resource
.
RLIMIT_NICE
,
int
)
self
.
assertIsInstance
(
resource
.
RLIMIT_RTPRIO
,
int
)
self
.
assertIsInstance
(
resource
.
RLIMIT_RTTIME
,
int
)
self
.
assertIsInstance
(
resource
.
RLIMIT_SIGPENDING
,
int
)
def
test_main
(
verbose
=
None
):
support
.
run_unittest
(
ResourceTest
)
...
...
Misc/NEWS
View file @
0724e032
...
...
@@ -19,6 +19,8 @@ Core and Builtins
Library
-------
- Issue #19324: Expose Linux-specific constants in resource module.
- Issue #17400: ipaddress should make it easy to identify rfc6598 addresses.
- Load SSL'
s
error
strings
in
hashlib
.
...
...
Modules/resource.c
View file @
0724e032
...
...
@@ -326,6 +326,28 @@ PyInit_resource(void)
PyModule_AddIntMacro
(
m
,
RLIMIT_SBSIZE
);
#endif
/* Linux specific */
#ifdef RLIMIT_MSGQUEUE
PyModule_AddIntMacro
(
m
,
RLIMIT_MSGQUEUE
);
#endif
#ifdef RLIMIT_NICE
PyModule_AddIntMacro
(
m
,
RLIMIT_NICE
);
#endif
#ifdef RLIMIT_RTPRIO
PyModule_AddIntMacro
(
m
,
RLIMIT_RTPRIO
);
#endif
#ifdef RLIMIT_RTTIME
PyModule_AddIntMacro
(
m
,
RLIMIT_RTTIME
);
#endif
#ifdef RLIMIT_SIGPENDING
PyModule_AddIntMacro
(
m
,
RLIMIT_SIGPENDING
);
#endif
/* target */
#ifdef RUSAGE_SELF
PyModule_AddIntMacro
(
m
,
RUSAGE_SELF
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment