Skip to content

Commit 72eef61

Browse files
author
Joe Ellis
committed
Conditionally compile peer credentials feature for supported platforms
1 parent fa697df commit 72eef61

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

library/std/src/sys/unix/ext/net.rs

+9
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,15 @@ impl UnixStream {
443443
/// }
444444
/// ```
445445
#[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
446+
#[cfg(any(
447+
target_os = "android",
448+
target_os = "linux",
449+
target_os = "dragonfly",
450+
target_os = "freebsd",
451+
target_os = "ios",
452+
target_os = "macos",
453+
target_os = "openbsd"
454+
))]
446455
pub fn peer_cred(&self) -> io::Result<UCred> {
447456
ucred::peer_cred(self)
448457
}

library/std/src/sys/unix/ext/ucred/tests.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ use crate::os::unix::net::UnixStream;
22
use libc::{getegid, geteuid};
33

44
#[test]
5+
#[cfg(any(
6+
target_os = "android",
7+
target_os = "linux",
8+
target_os = "dragonfly",
9+
target_os = "freebsd",
10+
target_os = "ios",
11+
target_os = "macos",
12+
target_os = "openbsd"
13+
))]
514
fn test_socket_pair() {
615
// Create two connected sockets and get their peer credentials. They should be equal.
716
let (sock_a, sock_b) = UnixStream::pair().unwrap();

0 commit comments

Comments
 (0)