From a46e1af6610f9d9aa260e552c207f3db569ad0cb Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Tue, 28 Nov 2017 14:06:36 +0100 Subject: [PATCH] Define Process::RLIMIT_* constants only if they are available --- src/main/ruby/core/process.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/ruby/core/process.rb b/src/main/ruby/core/process.rb index 3017333a2ecc..07a5deb11d10 100644 --- a/src/main/ruby/core/process.rb +++ b/src/main/ruby/core/process.rb @@ -50,15 +50,15 @@ module Constants RLIMIT_CPU = Rubinius::Config['rbx.platform.process.RLIMIT_CPU'] RLIMIT_DATA = Rubinius::Config['rbx.platform.process.RLIMIT_DATA'] RLIMIT_FSIZE = Rubinius::Config['rbx.platform.process.RLIMIT_FSIZE'] - RLIMIT_MEMLOCK = Rubinius::Config['rbx.platform.process.RLIMIT_MEMLOCK'] RLIMIT_NOFILE = Rubinius::Config['rbx.platform.process.RLIMIT_NOFILE'] - RLIMIT_NPROC = Rubinius::Config['rbx.platform.process.RLIMIT_NPROC'] - RLIMIT_RSS = Rubinius::Config['rbx.platform.process.RLIMIT_RSS'] - if value = Rubinius::Config.lookup('rbx.platform.process.RLIMIT_SBSIZE') - RLIMIT_SBSIZE = value - end RLIMIT_STACK = Rubinius::Config['rbx.platform.process.RLIMIT_STACK'] + %i[RLIMIT_MEMLOCK RLIMIT_NPROC RLIMIT_RSS RLIMIT_SBSIZE].each do |limit| + if value = Rubinius::Config.lookup("rbx.platform.process.#{limit}") + const_set limit, value + end + end + if Rubinius::Config.lookup('rbx.platform.process.RLIMIT_RTPRIO') RLIMIT_RTPRIO = Rubinius::Config['rbx.platform.process.RLIMIT_RTPRIO'] RLIMIT_RTTIME = Rubinius::Config['rbx.platform.process.RLIMIT_RTTIME']