diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs index 8f28c75641f..f27786dbf79 100644 --- a/library/std/src/sys/unix/net.rs +++ b/library/std/src/sys/unix/net.rs @@ -341,10 +341,12 @@ impl Socket { Ok(raw != 0) } + #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))] pub fn set_passcred(&self, passcred: bool) -> io::Result<()> { setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, passcred as libc::c_int) } + #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))] pub fn passcred(&self) -> io::Result { let passcred: libc::c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED)?; Ok(passcred != 0)