about summary refs log tree commit diff
path: root/library/std/src/sys/unix/net.rs
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2021-08-14 10:42:17 +0100
committerDavid Carlier <devnexen@gmail.com>2022-04-04 04:09:31 +0100
commit23e6314a31383d69038314a926626e3d8a4056e7 (patch)
tree9a68efe0c3e54df93a5a939be47d91ab8bd47857 /library/std/src/sys/unix/net.rs
parente730969b0d433d66d4f1c0bbd9ff70050c274ad5 (diff)
downloadrust-23e6314a31383d69038314a926626e3d8a4056e7.tar.gz
rust-23e6314a31383d69038314a926626e3d8a4056e7.zip
ScmCredentials netbsd implementation.
Diffstat (limited to 'library/std/src/sys/unix/net.rs')
-rw-r--r--library/std/src/sys/unix/net.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index e6fd9a0c827..9bf9607a63e 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -419,6 +419,17 @@ impl Socket {
         Ok(passcred != 0)
     }
 
+    #[cfg(target_os = "netbsd")]
+    pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
+        setsockopt(self, 0 as libc::c_int, libc::LOCAL_CREDS, passcred as libc::c_int)
+    }
+
+    #[cfg(target_os = "netbsd")]
+    pub fn passcred(&self) -> io::Result<bool> {
+        let passcred: libc::c_int = getsockopt(self, 0 as libc::c_int, libc::LOCAL_CREDS)?;
+        Ok(passcred != 0)
+    }
+
     #[cfg(not(any(target_os = "solaris", target_os = "illumos")))]
     pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
         let mut nonblocking = nonblocking as libc::c_int;