diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-10-23 19:57:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 19:57:17 +0200 |
commit | 89ae354ab7704db69a3f6c880234d21719558511 (patch) | |
tree | b8a87ef018d4f0e7cef48111bfe001390224ba8c /psutil/_psbsd.py | |
parent | ba083a0eea87331b67b57c3c83e8cc53faa12b10 (diff) | |
download | psutil-89ae354ab7704db69a3f6c880234d21719558511.tar.gz |
[FreeBSD] process resource limits (#1859) (#809)
Diffstat (limited to 'psutil/_psbsd.py')
-rw-r--r-- | psutil/_psbsd.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index 9565406b..428c8bde 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -904,3 +904,15 @@ class Process(object): @wrap_exceptions def memory_maps(self): return cext.proc_memory_maps(self.pid) + + @wrap_exceptions + def rlimit(self, resource, limits=None): + if limits is None: + return cext.proc_getrlimit(self.pid, resource) + else: + if len(limits) != 2: + raise ValueError( + "second argument must be a (soft, hard) tuple, " + "got %s" % repr(limits)) + soft, hard = limits + return cext.proc_setrlimit(self.pid, resource, soft, hard) |