use std::{fs, process};
use crc32fast::Hasher;
#[allow(clippy::cast_possible_truncation)]
pub fn get() -> u16 {
let pid = match fs::read("/proc/self/cpuset") {
Ok(buff) if buff.len() > 1 => process::id() ^ crc32(&buff),
_ => process::id(),
};
pid as u16
}
fn crc32(buff: &[u8]) -> u32 {
let mut hasher = Hasher::new();
hasher.update(buff);
hasher.finalize()
}