1
Fork 0

Change name of struct to SocketCred

This commit is contained in:
LinkTed 2020-09-16 20:30:59 +02:00
parent eeea5c23b4
commit 1902711f38
2 changed files with 9 additions and 9 deletions

View file

@ -180,7 +180,7 @@ impl<'a, T> Iterator for AncillaryDataIter<'a, T> {
))] ))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "none")] #[unstable(feature = "unix_socket_ancillary_data", issue = "none")]
#[derive(Clone)] #[derive(Clone)]
pub struct UCred(libc::ucred); pub struct SocketCred(libc::ucred);
#[cfg(any( #[cfg(any(
doc, doc,
@ -196,13 +196,13 @@ pub struct UCred(libc::ucred);
target_os = "openbsd", target_os = "openbsd",
target_env = "uclibc", target_env = "uclibc",
))] ))]
impl UCred { impl SocketCred {
/// Create a Unix credential struct. /// Create a Unix credential struct.
/// ///
/// PID, UID and GID is set to 0. /// PID, UID and GID is set to 0.
#[unstable(feature = "unix_socket_ancillary_data", issue = "none")] #[unstable(feature = "unix_socket_ancillary_data", issue = "none")]
pub fn new() -> UCred { pub fn new() -> SocketCred {
UCred(libc::ucred { pid: 0, uid: 0, gid: 0 }) SocketCred(libc::ucred { pid: 0, uid: 0, gid: 0 })
} }
/// Set the PID. /// Set the PID.
@ -293,10 +293,10 @@ pub struct ScmCredentials<'a>(AncillaryDataIter<'a, libc::ucred>);
))] ))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "none")] #[unstable(feature = "unix_socket_ancillary_data", issue = "none")]
impl<'a> Iterator for ScmCredentials<'a> { impl<'a> Iterator for ScmCredentials<'a> {
type Item = UCred; type Item = SocketCred;
fn next(&mut self) -> Option<UCred> { fn next(&mut self) -> Option<SocketCred> {
Some(UCred(self.0.next()?)) Some(SocketCred(self.0.next()?))
} }
} }
@ -606,7 +606,7 @@ impl<'a> SocketAncillary<'a> {
target_env = "uclibc", target_env = "uclibc",
))] ))]
#[unstable(feature = "unix_socket_ancillary_data", issue = "none")] #[unstable(feature = "unix_socket_ancillary_data", issue = "none")]
pub fn add_creds(&mut self, creds: &[UCred]) -> bool { pub fn add_creds(&mut self, creds: &[SocketCred]) -> bool {
self.truncated = false; self.truncated = false;
add_to_ancillary_data( add_to_ancillary_data(
&mut self.buffer, &mut self.buffer,

View file

@ -519,7 +519,7 @@ fn test_send_vectored_with_ancillary_to_unix_datagram() {
let mut ancillary1_buffer = [0; 128]; let mut ancillary1_buffer = [0; 128];
let mut ancillary1 = SocketAncillary::new(&mut ancillary1_buffer[..]); let mut ancillary1 = SocketAncillary::new(&mut ancillary1_buffer[..]);
let mut cred1 = UCred::new(); let mut cred1 = SocketCred::new();
cred1.set_pid(getpid()); cred1.set_pid(getpid());
cred1.set_uid(getuid()); cred1.set_uid(getuid());
cred1.set_gid(getgid()); cred1.set_gid(getgid());