getrlimit(p1)
public
Gets the resource limit of the process. cur_limit means current
(soft) limit and max_limit means maximum (hard) limit.
resource indicates the kind of resource to limit: such as
Process::RLIMIT_CORE, Process::RLIMIT_CPU, etc. See Process.setrlimit for details.
cur_limit and max_limit may be
Process::RLIM_INFINITY, Process::RLIM_SAVED_MAX or
Process::RLIM_SAVED_CUR. See Process.setrlimit and the system
getrlimit(2) manual for details.
Show source
/*
* call-seq:
* Process.getrlimit(resource) => [cur_limit, max_limit]
*
* Gets the resource limit of the process.
* _cur_limit_ means current (soft) limit and
* _max_limit_ means maximum (hard) limit.
*
* _resource_ indicates the kind of resource to limit:
* such as <code>Process::RLIMIT_CORE</code>,
* <code>Process::RLIMIT_CPU</code>, etc.
* See Process.setrlimit for details.
*
* _cur_limit_ and _max_limit_ may be <code>Process::RLIM_INFINITY</code>,
* <code>Process::RLIM_SAVED_MAX</code> or
* <code>Process::RLIM_SAVED_CUR</code>.
* See Process.setrlimit and the system getrlimit(2) manual for details.
*/
static VALUE
proc_getrlimit(VALUE obj, VALUE resource)
{
#if defined(HAVE_GETRLIMIT) && defined(RLIM2NUM)
struct rlimit rlim;
rb_secure(2);
if (getrlimit(NUM2INT(resource), &rlim) < 0) {
rb_sys_fail("getrlimit");
}
return rb_assoc_new(RLIM2NUM(rlim.rlim_cur), RLIM2NUM(rlim.rlim_max));
#else
rb_notimplement();
#endif
}