36 lines
1.5 KiB
Text
36 lines
1.5 KiB
Text
|
OpenBSD doesn't support RLIMIT_AS
|
||
|
|
||
|
Index: logilab/common/proc.py
|
||
|
--- logilab/common/proc.py.orig
|
||
|
+++ logilab/common/proc.py
|
||
|
@@ -30,7 +30,7 @@ __docformat__ = "restructuredtext en"
|
||
|
|
||
|
import os
|
||
|
import stat
|
||
|
-from resource import getrlimit, setrlimit, RLIMIT_CPU, RLIMIT_AS
|
||
|
+from resource import getrlimit, setrlimit, RLIMIT_CPU, RLIMIT_DATA
|
||
|
from signal import signal, SIGXCPU, SIGKILL, SIGUSR2, SIGUSR1
|
||
|
from threading import Timer, currentThread, Thread, Event
|
||
|
from time import time
|
||
|
@@ -253,10 +253,10 @@ class ResourceController:
|
||
|
setrlimit(RLIMIT_CPU, cpu_limit)
|
||
|
if self.max_memory is not None:
|
||
|
self._msentinel = MemorySentinel(1, int(self.max_memory))
|
||
|
- self._old_max_memory = getrlimit(RLIMIT_AS)
|
||
|
+ self._old_max_memory = getrlimit(RLIMIT_DATA)
|
||
|
self._old_usr1_hdlr = signal(SIGUSR1, self._hangle_sig_memory)
|
||
|
as_limit = (int(self.max_memory), self._old_max_memory[1])
|
||
|
- setrlimit(RLIMIT_AS, as_limit)
|
||
|
+ setrlimit(RLIMIT_DATA, as_limit)
|
||
|
self._msentinel.start()
|
||
|
self._limit_set += 1
|
||
|
|
||
|
@@ -274,6 +274,6 @@ class ResourceController:
|
||
|
if self.max_memory is not None:
|
||
|
self._msentinel.stop()
|
||
|
self._msentinel = None
|
||
|
- setrlimit(RLIMIT_AS, self._old_max_memory)
|
||
|
+ setrlimit(RLIMIT_DATA, self._old_max_memory)
|
||
|
signal(SIGUSR1, self._old_usr1_hdlr)
|
||
|
self._limit_set -= 1
|