module Process
def getpriority(kind, int)
32768 => Process::ABOVE_NORMAL_PRIORITY_CLASS
16384 => Process::BELOW_NORMAL_PRIORITY_CLASS
256 => Process::REALTIME_PRIORITY_CLASS
128 => Process::HIGH_PRIORITY_CLASS
64 => Process::IDLE_PRIORITY_CLASS
32 => Process::NORMAL_PRIORITY_CLASS
Possible return values are:
information, so it is effectively always Process::PRIO_PROCESS.
You can only retrieve process information, not process group or user
The +kind+ parameter is ignored but required for API compatibility.
correspond to higher priority classes.
the default implementation, lower return values do not necessarily
Retrieves the priority class for the specified process id +int+. Unlike
def getpriority(kind, int) raise TypeError, kind unless kind.is_a?(Integer) # Match spec raise TypeError, int unless int.is_a?(Integer) # Match spec int = Process.pid if int == 0 # Match spec handle = OpenProcess(PROCESS_QUERY_INFORMATION, 0, int) if handle == 0 raise SystemCallError, FFI.errno, "OpenProcess" end begin priority = GetPriorityClass(handle) if priority == 0 raise SystemCallError, FFI.errno, "GetPriorityClass" end ensure CloseHandle(handle) end priority end