about summary refs log tree commit diff
path: root/library/std/src/os/linux/net.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-11 07:46:01 +0000
committerbors <bors@rust-lang.org>2024-03-11 07:46:01 +0000
commit66396725541ac7920439876fc79cbc7b604b82e0 (patch)
treeaa85460d353495c0388e86419eff9fed91d35a70 /library/std/src/os/linux/net.rs
parenta6d93acf5fdeb020ab86cc0d30d5672c23a7dba6 (diff)
parent93f2f2c8ee44a8cb469fd7e656599c2b9546a1af (diff)
downloadrust-66396725541ac7920439876fc79cbc7b604b82e0.tar.gz
rust-66396725541ac7920439876fc79cbc7b604b82e0.zip
Auto merge of #117156 - jmillikin:os-unix-socket-ext, r=Amanieu,dtolnay
Convert `Unix{Datagram,Stream}::{set_}passcred()` to per-OS traits

These methods are the pre-stabilized API for obtaining peer credentials from an `AF_UNIX` socket, part of the `unix_socket_ancillary_data` feature.

Their current behavior is to get/set one of the `SO_PASSCRED` (Linux), `LOCAL_CREDS_PERSISTENT` (FreeBSD), or `LOCAL_CREDS` (NetBSD) socket options. On other targets the `{set_}passcred()` methods do not exist.

There are two problems with this approach:

1. Having public methods only exist for certain targets isn't permitted in a stable `std` API.

2. These options have generally similar purposes, but they are non-POSIX and their details can differ in subtle and surprising ways (such as whether they continue to be set after the next call to `recvmsg()`).

Splitting into OS-specific extension traits is the preferred solution to both problems.
Diffstat (limited to 'library/std/src/os/linux/net.rs')
-rw-r--r--library/std/src/os/linux/net.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/os/linux/net.rs b/library/std/src/os/linux/net.rs
index c8e734d740b..f898e705487 100644
--- a/library/std/src/os/linux/net.rs
+++ b/library/std/src/os/linux/net.rs
@@ -5,5 +5,8 @@
 #[stable(feature = "unix_socket_abstract", since = "1.70.0")]
 pub use crate::os::net::linux_ext::addr::SocketAddrExt;
 
+#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
+pub use crate::os::net::linux_ext::socket::UnixSocketExt;
+
 #[unstable(feature = "tcp_quickack", issue = "96256")]
 pub use crate::os::net::linux_ext::tcp::TcpStreamExt;