Skip to content

Commit 4e9714b

Browse files
committed
Remove SocketCred for emscripten
1 parent 168d063 commit 4e9714b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

library/std/src/sys/unix/ext/net/ancillary.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::slice::from_raw_parts;
99
use crate::sys::unix::ext::net::addr::{sockaddr_un, SocketAddr};
1010
use crate::sys::unix::net::Socket;
1111

12-
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux",))]
12+
#[cfg(any(target_os = "android", target_os = "linux",))]
1313
use libc::{gid_t, pid_t, uid_t};
1414

1515
pub(super) fn recv_vectored_with_ancillary_from(
@@ -167,12 +167,12 @@ impl<'a, T> Iterator for AncillaryDataIter<'a, T> {
167167
}
168168

169169
/// Unix credential.
170-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
170+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
171171
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
172172
#[derive(Clone)]
173173
pub struct SocketCred(libc::ucred);
174174

175-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
175+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
176176
impl SocketCred {
177177
/// Create a Unix credential struct.
178178
///
@@ -237,11 +237,11 @@ impl<'a> Iterator for ScmRights<'a> {
237237
/// This control message contains unix credentials.
238238
///
239239
/// The level is equal to `SOL_SOCKET` and the type is equal to `SCM_CREDENTIALS` or `SCM_CREDS`.
240-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
240+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
241241
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
242242
pub struct ScmCredentials<'a>(AncillaryDataIter<'a, libc::ucred>);
243243

244-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
244+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
245245
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
246246
impl<'a> Iterator for ScmCredentials<'a> {
247247
type Item = SocketCred;
@@ -263,7 +263,7 @@ pub enum AncillaryError {
263263
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
264264
pub enum AncillaryData<'a> {
265265
ScmRights(ScmRights<'a>),
266-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
266+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
267267
ScmCredentials(ScmCredentials<'a>),
268268
}
269269

@@ -286,7 +286,7 @@ impl<'a> AncillaryData<'a> {
286286
///
287287
/// `data` must contain a valid control message and the control message must be type of
288288
/// `SOL_SOCKET` and level of `SCM_CREDENTIALS` or `SCM_CREDENTIALS`.
289-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
289+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
290290
unsafe fn as_credentials(data: &'a [u8]) -> Self {
291291
let ancillary_data_iter = AncillaryDataIter::new(data);
292292
let scm_credentials = ScmCredentials(ancillary_data_iter);
@@ -303,11 +303,7 @@ impl<'a> AncillaryData<'a> {
303303
match (*cmsg).cmsg_level {
304304
libc::SOL_SOCKET => match (*cmsg).cmsg_type {
305305
libc::SCM_RIGHTS => Ok(AncillaryData::as_rights(data)),
306-
#[cfg(any(
307-
target_os = "android",
308-
target_os = "emscripten",
309-
target_os = "linux",
310-
))]
306+
#[cfg(any(target_os = "android", target_os = "linux",))]
311307
libc::SCM_CREDENTIALS => Ok(AncillaryData::as_credentials(data)),
312308
cmsg_type => {
313309
Err(AncillaryError::Unknown { cmsg_level: libc::SOL_SOCKET, cmsg_type })
@@ -505,7 +501,7 @@ impl<'a> SocketAncillary<'a> {
505501
/// Technically, that means this operation adds a control message with the level `SOL_SOCKET`
506502
/// and type `SCM_CREDENTIALS` or `SCM_CREDS`.
507503
///
508-
#[cfg(any(doc, target_os = "android", target_os = "emscripten", target_os = "linux",))]
504+
#[cfg(any(doc, target_os = "android", target_os = "linux",))]
509505
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
510506
pub fn add_creds(&mut self, creds: &[SocketCred]) -> bool {
511507
self.truncated = false;

0 commit comments

Comments
 (0)