Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/resource.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Set and get program scheduling priority
use errno::{Errno, errno, set_errno};
use libc::{PRIO_PROCESS,PRIO_PGRP,PRIO_USER,setpriority,getpriority, id_t};
use libc::{PRIO_PROCESS,PRIO_PGRP,PRIO_USER,setpriority,getpriority,id_t,c_int};

/// Which identifier type to use (`pid`, `gid`, or `uid`)
#[allow(missing_docs)]
Expand All @@ -27,7 +27,7 @@ pub fn set_priority(which: Which, who: i32, priority: i32) -> Result<(), ()> {
Which::User => PRIO_USER,
};

match unsafe { setpriority(c_which as u32, who as id_t, priority) } {
match unsafe { setpriority(c_which as c_int, who as id_t, priority) } {
0 => Ok(()),
_ => Err(()),
}
Expand All @@ -47,7 +47,7 @@ pub fn get_priority(which: Which, who: i32) -> Result<i32, ()> {
};

set_errno(Errno(0));
let priority = unsafe { getpriority(c_which as u32, who as id_t) };
let priority = unsafe { getpriority(c_which as c_int, who as id_t) };
match errno().0 {
0 => Ok(priority),
_ => Err(()),
Expand Down