diff options
Diffstat (limited to 'test/sys/test_sockopt.rs')
-rw-r--r-- | test/sys/test_sockopt.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/sys/test_sockopt.rs b/test/sys/test_sockopt.rs index 34bef945..bf791688 100644 --- a/test/sys/test_sockopt.rs +++ b/test/sys/test_sockopt.rs @@ -54,6 +54,22 @@ pub fn test_local_peercred_stream() { assert_eq!(Gid::from_raw(xucred.groups()[0]), Gid::current()); } +#[cfg(target_os = "macos")] +#[test] +pub fn test_local_peer_pid() { + use nix::sys::socket::socketpair; + + let (fd1, _fd2) = socketpair( + AddressFamily::Unix, + SockType::Stream, + None, + SockFlag::empty(), + ) + .unwrap(); + let pid = getsockopt(fd1, sockopt::LocalPeerPid).unwrap(); + assert_eq!(pid, std::process::id() as _); +} + #[cfg(target_os = "linux")] #[test] fn is_so_mark_functional() { |