/* * call-seq: * Process.getpriority(kind, integer) => fixnum * * Gets the scheduling priority for specified process, process group, * or user. <em>kind</em> indicates the kind of entity to find: one * of <code>Process::PRIO_PGRP</code>, * <code>Process::PRIO_USER</code>, or * <code>Process::PRIO_PROCESS</code>. _integer_ is an id * indicating the particular process, process group, or user (an id * of 0 means _current_). Lower priorities are more favorable * for scheduling. Not available on all platforms. * * Process.getpriority(Process::PRIO_USER, 0) #=> 19 * Process.getpriority(Process::PRIO_PROCESS, 0) #=> 19 */ static VALUE proc_getpriority(obj, which, who) VALUE obj, which, who; { #ifdef HAVE_GETPRIORITY int prio, iwhich, iwho; rb_secure(2); iwhich = NUM2INT(which); iwho = NUM2INT(who); errno = 0; prio = getpriority(iwhich, iwho); if (errno) rb_sys_fail(0); return INT2FIX(prio); #else rb_notimplement(); #endif }