Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 16/17] Fix undefined variable: RLIMIT_NOFILE
Date: Sat, 22 Mar 2014 17:04:56
Message-Id: 1395507795-13754-17-git-send-email-dolsen@gentoo.org
In Reply to: [gentoo-catalyst] 2.X bugfixes by Brian Dolbec
1 It was not imported from resource, it was also not used correctly.
2 ---
3 modules/catalyst_support.py | 12 +++++++-----
4 1 file changed, 7 insertions(+), 5 deletions(-)
5
6 diff --git a/modules/catalyst_support.py b/modules/catalyst_support.py
7 index 316dfa3..d493f88 100644
8 --- a/modules/catalyst_support.py
9 +++ b/modules/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