Skip to content

Commit

Permalink
Define Process::RLIMIT_* constants only if they are available
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Nov 28, 2017
1 parent 6699994 commit a46e1af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/ruby/core/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit a46e1af

Please sign in to comment.