summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/resource.rst21
-rw-r--r--Doc/whatsnew/3.4.rst6
2 files changed, 27 insertions, 0 deletions
diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst
index 1c0fa9f..d49e13c 100644
--- a/Doc/library/resource.rst
+++ b/Doc/library/resource.rst
@@ -74,6 +74,27 @@ this module for those platforms.
``setrlimit`` may also raise :exc:`error` if the underlying system call
fails.
+.. function:: prlimit(pid, resource[, limits])
+
+ Combines :func:`setrlimit` and :func:`getrlimit` in one function and
+ supports to get and set the resources limits of an arbitrary process. If
+ *pid* is 0, then the call applies to the current process. *resource* and
+ *limits* have the same meaning as in :func:`setrlimit`, except that
+ *limits* is optional.
+
+ When *limits* is not given the function returns the *resource* limit of the
+ process *pid*. When *limits* is given the *resource* limit of the process is
+ set and the former resource limit is returned.
+
+ Raises :exc:`ProcessLookupError` when *pid* can't be found and
+ :exc:`PermissionError` when the user doesn't have ``CAP_SYS_RESOURCE`` for
+ the process.
+
+ Availability: Linux (glibc 2.13+)
+
+ .. versionadded:: 3.4
+
+
These symbols define resources whose consumption can be controlled using the
:func:`setrlimit` and :func:`getrlimit` functions described below. The values of
these symbols are exactly the constants used by C programs.
diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
index e978fcb..8e4f8e6 100644
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -438,6 +438,12 @@ The :mod:`pprint` module now supports *compact* mode for formatting long
sequences (:issue:`19132`).
+resource
+--------
+
+New :func:`resource.prlimit` function and Linux specific constants.
+(Contributed by Christian Heimes in :issue:`16595` and :issue:`19324`.)
+
smtplib
-------