/// Get program scheduling priority.
///
/// # Examples
///
/// ```
/// let ret = unsafe { nc::getpriority(nc::PRIO_PROCESS, nc::getpid()) };
/// assert!(ret.is_ok());
/// ```
pub unsafe fn getpriority(which: i32, who: i32) -> Result<i32, Errno> {
    let which = which as usize;
    let who = who as usize;
    unsafe {
        syscall2(SYS_GETPRIORITY, which, who).map(|ret| {
            let ret = ret as i32;
            if ret > PRIO_MAX {
                return PRIO_MAX - ret;
            }
            ret
        })
    }
}
