Bug #3813: Add Missing RLIMIT_ Constants to Process [Patch]
http://redmine.ruby-lang.org/issues/show/3813

Author: Run Paint Run Run
Status: Open, Priority: Low
Category: core
ruby -v: ruby 1.9.3dev (2010-09-10 trunk 29207) [i686-linux]

This patch adds the five missing RLIMIT_* constants to Process. As of Lin=
ux 2.6.32, `man 2 getrlimit` defines 16 RLIMIT_* constants. 1 of those is=
 obsolete. With this patch, Process knows these 15 plus the FreeBSD-speci=
fic RLIMIT_SBSIZE. My kernel isn't configured for RLIMIT_RTTIME, but the =
following shows that the remaining 14 work:

>> pp Hash[*Process.constants.grep(/RLIMIT/).
     flat_map{|c| [c, Process.getrlimit(Process.const_get(c))]}]
{:RLIMIT_AS=3D>[18446744073709551615, 18446744073709551615],
 :RLIMIT_CORE=3D>[0, 18446744073709551615],
 :RLIMIT_CPU=3D>[18446744073709551615, 18446744073709551615],
 :RLIMIT_DATA=3D>[18446744073709551615, 18446744073709551615],
 :RLIMIT_FSIZE=3D>[18446744073709551615, 18446744073709551615],
 :RLIMIT_MEMLOCK=3D>[65536, 65536],
 :RLIMIT_MSGQUEUE=3D>[819200, 819200],
 :RLIMIT_NICE=3D>[20, 20],
 :RLIMIT_NOFILE=3D>[1024, 1024],
 :RLIMIT_NPROC=3D>[18446744073709551615, 18446744073709551615],
 :RLIMIT_RSS=3D>[18446744073709551615, 18446744073709551615],
 :RLIMIT_RTPRIO=3D>[0, 0],
 :RLIMIT_SIGPENDING=3D>[16382, 16382],
 :RLIMIT_STACK=3D>[8388608, 18446744073709551615]}

The second patch, 'rlimit-constants-sorted.patch', adds the new constants=
 and sorts the list alphabetically.


----------------------------------------
http://redmine.ruby-lang.org
ZGlmZiAtLWdpdCBhL3Byb2Nlc3MuYyBiL3Byb2Nlc3MuYwppbmRleCBlMTdm
YTU4Li4yNjUyM2NiIDEwMDY0NAotLS0gYS9wcm9jZXNzLmMKKysrIGIvcHJv
Y2Vzcy5jCkBAIC01NjE4LDYgKzU2MTgsMjEgQEAgSW5pdF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