From: Bill Kelly Date: 2005-09-27T13:35:19+09:00 Subject: Re: Relative speed of Ruby vs Java for a large compiled app like Freenet From: "Tanaka Akira" > In article <019301c5c2f2$c9431ca0$6442a8c0@musicbox>, > "Bill Kelly" writes: > > > Note that it should also be possible to call setrlimit() > > directly from ruby, using the built-in 'dl' library. > > Also note that Ruby 1.9 has Process.setrlimit. Sweet!! =D Incidentally, does anyone know what I'm doing wrong here? I tried to make the call with 'dl', but I'm getting an error: (eval):2:in `setrlimit': undefined method `[]' for nil:NilClass (NoMethodError) from rlimit2.rb:16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #!/usr/bin/env ruby require 'dl/import' module LIBC extend DL::Importable dlload "libc.so" RLIMIT_STACK = 3 RLIM_INFINITY = -1 extern "int setrlimit(int, const void *)" end include LIBC rlimit = [RLIM_INFINITY,RLIM_INFINITY].pack('LL').to_ptr result = setrlimit(RLIMIT_STACK, rlimit) # this is line 16 puts result ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ According to http://www.jbrowse.com/text/rdl_en.html I thought my code should work? Thanks, Regards, Bill