diff --git a/cache_side_channel/Cargo.toml b/cache_side_channel/Cargo.toml index 551e884..59687d8 100644 --- a/cache_side_channel/Cargo.toml +++ b/cache_side_channel/Cargo.toml @@ -7,4 +7,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -nix = "0.18.0" +nix = "0.20.0" diff --git a/cache_side_channel/src/lib.rs b/cache_side_channel/src/lib.rs index ebb0e29..2841bf8 100644 --- a/cache_side_channel/src/lib.rs +++ b/cache_side_channel/src/lib.rs @@ -41,10 +41,10 @@ pub fn restore_affinity(cpu_set: &CpuSet) { } #[must_use = "This result must be used to restore affinity"] -pub fn set_affinity(cpu_set: &CpuSet) -> CpuSet { - let old = sched_getaffinity(Pid::from_raw(0)).unwrap(); - sched_setaffinity(Pid::from_raw(0), &cpu_set).unwrap(); - old +pub fn set_affinity(cpu_set: &CpuSet) -> Result { + let old = sched_getaffinity(Pid::from_raw(0))?; + sched_setaffinity(Pid::from_raw(0), &cpu_set)?; + Ok(old) } pub trait SingleAddrCacheSideChannel: CoreSpec + Debug {