summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-06-24 18:45:43 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2019-06-25 12:21:43 +0530
commit9b95a2e81564d875cd93d65f2ab0777503f08b25 (patch)
tree6318046e921ad66161d0267eece61b60b32a31ef
parentce880d204d7995fd84690e44b4a629991ad8849d (diff)
cerbero: Increase the open-files limit if needed
Fixes https://gitlab.freedesktop.org/gstreamer/cerbero/issues/165
-rw-r--r--cerbero/config.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/cerbero/config.py b/cerbero/config.py
index 3b2698e3..5cee3ee6 100644
--- a/cerbero/config.py
+++ b/cerbero/config.py
@@ -51,6 +51,23 @@ DistroVersion = enums.DistroVersion
License = enums.License
LibraryType = enums.LibraryType
+def set_nofile_ulimit():
+ '''
+ Some newer toolchains such as our GCC 8.2 cross toolchain exceed the
+ 1024 file ulimit, so let's increase it.
+ See: https://gitlab.freedesktop.org/gstreamer/cerbero/issues/165
+ '''
+ try:
+ import resource
+ except ModuleNotFoundError:
+ return
+ want = 10240
+ soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
+ if soft < want or hard < want:
+ try:
+ resource.setrlimit(resource.RLIMIT_NOFILE, (want, want))
+ except OSError:
+ print('Failed to increase file ulimit, you may see linker failures')
class Variants(object):
@@ -425,6 +442,8 @@ class Config (object):
self.set_property('extra_properties', {})
self.set_property('extra_mirrors', [])
self.set_property('extra_bootstrap_packages', {})
+ # Increase open-files limits
+ set_nofile_ulimit()
def set_property(self, name, value, force=False):
if name not in self._properties: