diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-05 22:58:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-05 22:58:54 +0200 |
| commit | d2e1e6dc759ef6c56e68382a148ed7181ab3a18f (patch) | |
| tree | 32b27de4f33c898d5a2b0de8ea8812375d1dabe1 /library/std/src/sys | |
| parent | f262ca12aac76152c4b46cefcf8300f0249a5eb2 (diff) | |
| parent | 23e6314a31383d69038314a926626e3d8a4056e7 (diff) | |
| download | rust-d2e1e6dc759ef6c56e68382a148ed7181ab3a18f.tar.gz rust-d2e1e6dc759ef6c56e68382a148ed7181ab3a18f.zip | |
Rollup merge of #88025 - devnexen:netbsd_scm_creds, r=Amanieu
ScmCredentials netbsd implementation.
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/unix/net.rs | 11 |
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; |
