We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here's a simple patch:
diff --git a/src/lib.rs b/src/lib.rs index ea221b3..b378b51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -405,13 +406,15 @@ fn rand_int() -> AtomicUsize { } fn get_pid() -> u32 { + #[allow(unused_mut)] let mut pid = process::id(); // If /proc/self/cpuset exists and is not /, we can assume that we are in a // form of container and use the content of cpuset xor-ed with the PID in // order get a reasonable machine global unique PID. + #[cfg(target_os = "linux")] match fs::read("/proc/self/cpuset") { - Err(_) => pid, + Err(_) => {}, Ok(buff) => { let mut hasher = Hasher::new(); @@ -419,10 +422,10 @@ fn get_pid() -> u32 { let checksum = hasher.finalize(); pid ^= checksum; - - pid } } + + pid } fn read_machine_id() -> [u8; 3] { @@ -461,6 +464,10 @@ fn platform_machine_id() -> Result<String, io::Error> { Ok(contents) } +#[cfg(not(target_os = "linux"))] +fn platform_machine_id() -> Result<String, io::Error> { + Err(io::Error::new(io::ErrorKind::NotFound, "unsupported")) +} fn hostname() -> String { gethostname()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here's a simple patch:
The text was updated successfully, but these errors were encountered: