1
Fork 0

socket ancillary data implementation for dragonflybsd.

This commit is contained in:
David Carlier 2021-12-05 13:36:06 +00:00
parent cafc4582e6
commit e68887e67c
3 changed files with 92 additions and 8 deletions

View file

@ -408,12 +408,12 @@ impl Socket {
Ok(raw != 0)
}
#[cfg(any(target_os = "android", target_os = "linux",))]
#[cfg(any(target_os = "android", target_os = "linux", target_os = "dragonfly",))]
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 = "linux",))]
#[cfg(any(target_os = "android", target_os = "linux", target_os = "dragonfly",))]
pub fn passcred(&self) -> io::Result<bool> {
let passcred: libc::c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED)?;
Ok(passcred != 0)