summaryrefslogtreecommitdiff
path: root/Doc/library/resource.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/resource.rst')
-rw-r--r--Doc/library/resource.rst29
1 files changed, 22 insertions, 7 deletions
diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst
index c16b01301e..ed858505a7 100644
--- a/Doc/library/resource.rst
+++ b/Doc/library/resource.rst
@@ -14,13 +14,15 @@ resources utilized by a program.
Symbolic constants are used to specify particular system resources and to
request usage information about either the current process or its children.
-A single exception is defined for errors:
+An :exc:`OSError` is raised on syscall failure.
.. exception:: error
- The functions described below may raise this error if the underlying system call
- failures unexpectedly.
+ A deprecated alias of :exc:`OSError`.
+
+ .. versionchanged:: 3.3
+ Following :pep:`3151`, this class was made an alias of :exc:`OSError`.
Resource Limits
@@ -41,6 +43,11 @@ which cannot be checked or controlled by the operating system are not defined in
this module for those platforms.
+.. data:: RLIM_INFINITY
+
+ Constant used to represent the the limit for an unlimited resource.
+
+
.. function:: getrlimit(resource)
Returns a tuple ``(soft, hard)`` with the current soft and hard limits of
@@ -52,12 +59,20 @@ this module for those platforms.
Sets new limits of consumption of *resource*. The *limits* argument must be a
tuple ``(soft, hard)`` of two integers describing the new limits. A value of
- ``-1`` can be used to specify the maximum possible upper limit.
+ :data:`~resource.RLIM_INFINITY` can be used to request a limit that is
+ unlimited.
Raises :exc:`ValueError` if an invalid resource is specified, if the new soft
- limit exceeds the hard limit, or if a process tries to raise its hard limit
- (unless the process has an effective UID of super-user). Can also raise
- :exc:`error` if the underlying system call fails.
+ limit exceeds the hard limit, or if a process tries to raise its hard limit.
+ Specifying a limit of :data:`~resource.RLIM_INFINITY` when the hard or
+ system limit for that resource is not unlimited will result in a
+ :exc:`ValueError`. A process with the effective UID of super-user can
+ request any valid limit value, including unlimited, but :exc:`ValueError`
+ will still be raised if the requested limit exceeds the system imposed
+ limit.
+
+ ``setrlimit`` may also raise :exc:`error` if the underlying system call
+ fails.
These symbols define resources whose consumption can be controlled using the
:func:`setrlimit` and :func:`getrlimit` functions described below. The values of