openbsd-ports/devel/py-logilab-common/patches/patch-proc_py
2011-08-31 12:39:19 +00:00

38 lines
1.5 KiB
Plaintext

$OpenBSD: patch-proc_py,v 1.1 2011/08/31 12:39:19 mpi Exp $
OpenBSD doesn't support RLIMIT_AS
--- proc.py.orig Tue Apr 26 09:44:22 2011
+++ proc.py Fri Jul 29 17:03:55 2011
@@ -30,7 +30,7 @@
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
@@ -251,10 +251,10 @@
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)
+ data_limit = (int(self.max_memory), self._old_max_memory[1])
+ setrlimit(RLIMIT_DATA, data_limit)
self._msentinel.start()
self._limit_set += 1
@@ -272,6 +272,6 @@
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