pub fn pid_priority(pid: Pid) -> ProcessResult<libc::c_int> {
    // Since `getpriority()` can legitimately return the value `-1`,
    // it is necessary to clear the external variable `errno` prior to the call,
    // then check it afterward to determine if `-1` is an error or a legitimate value.
    set_errno(0);
    let result = unsafe { libc::getpriority(PRIO_PROCESS, pid as libc::id_t) };

    match errno() {
        0 => Ok(result),
        libc::ESRCH => Err(ProcessError::NoSuchProcess(pid)),
        libc::EACCES | libc::EPERM => Err(ProcessError::AccessDenied(pid)),
        other => Err(Error::from_raw_os_error(other)
            .with_ffi("getpriority")
            .into()),
    }
}
/// Safe wrapper for POSIX `getpriority`
Safe wrapper for POSIX `getpriority`
Safe wrapper for POSIX ` getpriority `
pub fn pid_priority(pid: Pid) -> ProcessResult<libc::c_int> {
    // Since `getpriority()` can legitimately return the value `-1`,
    // it is necessary to clear the external variable `errno` prior to the call,
    // then check it afterward to determine if `-1` is an error or a legitimate value.
    set_errno(0);
    let result = unsafe { libc::getpriority(PRIO_PROCESS, pid as libc::id_t) };
    match errno() {
        0 => Ok(result),
        libc::ESRCH => Err(ProcessError::NoSuchProcess(pid)),
        libc::EACCES | libc::EPERM => Err(ProcessError::AccessDenied(pid)),
        other => Err(Error::from_raw_os_error(other)
            .with_ffi("getpriority")
            .into()),
    }
}
pub fn pid_priority ( pid : Pid ) -> ProcessResult < libc :: c_int > { // Since `getpriority()` can legitimately return the value `-1`, // it is necessary to clear the external variable `errno` prior to the call, // then check it afterward to determine if `-1` is an error or a legitimate value. set_errno ( 0 ) ; let result = unsafe { libc :: getpriority ( PRIO_PROCESS , pid as libc :: id_t ) } ; match errno ( ) { 0 => Ok ( result ) , libc :: ESRCH => Err ( ProcessError :: NoSuchProcess ( pid ) ) , libc :: EACCES | libc :: EPERM => Err ( ProcessError :: AccessDenied ( pid ) ) , other => Err ( Error :: from_raw_os_error ( other ) . with_ffi ( " " ) . into ( ) ) , } }
Safe wrapper for POSIX `getpriority`
Safe wrapper for POSIX ` getpriority `
pid
Pid
pid
Pid