Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 4/8] Fix undefined variable: RLIMIT_NOFILE
Date: Wed, 02 Apr 2014 20:30:16
Message-Id: 1396470583-8756-4-git-send-email-dolsen@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 2/8] Initial separation and creation of contents.py by Brian Dolbec
1 It was not imported from resource, it was also not used correctly.
2 ---
3 catalyst/support.py | 12 +++++++-----
4 1 file changed, 7 insertions(+), 5 deletions(-)
5
6 diff --git a/catalyst/support.py b/catalyst/support.py
7 index e25394e..5abf614 100644
8 --- a/catalyst/support.py
9 +++ b/catalyst/support.py
10 @@ -6,14 +6,16 @@ selinux_capable = False
11 #fakeroot_capable = False
12 BASH_BINARY = "/bin/bash"
13
14 +# set it to 0 for the soft limit, 1 for the hard limit
15 +DESIRED_RLIMIT = 0
16 try:
17 - import resource
18 - max_fd_limit=resource.getrlimit(RLIMIT_NOFILE)
19 + import resource
20 + max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)[DESIRED_RLIMIT]
21 except SystemExit, e:
22 - raise
23 + raise
24 except:
25 - # hokay, no resource module.
26 - max_fd_limit=256
27 + # hokay, no resource module.
28 + max_fd_limit=256
29
30 # pids this process knows of.
31 spawned_pids = []
32 --
33 1.8.5.3