Skip to content

Commit

Permalink
Rollup merge of rust-lang#66005 - Wind-River:master_base, r=alexcrichton
Browse files Browse the repository at this point in the history
vxWorks: remove code related unix socket

r? @alexcrichton
  • Loading branch information
tmandry authored Oct 31, 2019
2 parents 88ceb95 + be0e381 commit 1c5156a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1,828 deletions.
61 changes: 60 additions & 1 deletion src/libstd/sys/vxworks/ext/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use crate::fs;
use crate::os::raw;
use crate::sys;
use crate::io;
use crate::sys_common::{AsInner, FromInner, IntoInner};
use crate::sys_common::{self, AsInner, FromInner, IntoInner};
use crate::net;

/// Raw file descriptors.
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -110,3 +111,61 @@ impl<'a> AsRawFd for io::StdoutLock<'a> {
impl<'a> AsRawFd for io::StderrLock<'a> {
fn as_raw_fd(&self) -> RawFd { libc::STDERR_FILENO }
}

#[stable(feature = "rust1", since = "1.0.0")]
impl AsRawFd for net::TcpStream {
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
}

#[stable(feature = "rust1", since = "1.0.0")]
impl AsRawFd for net::TcpListener {
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
}

#[stable(feature = "rust1", since = "1.0.0")]
impl AsRawFd for net::UdpSocket {
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
}

#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for net::TcpStream {
unsafe fn from_raw_fd(fd: RawFd) -> net::TcpStream {
let socket = sys::net::Socket::from_inner(fd);
net::TcpStream::from_inner(sys_common::net::TcpStream::from_inner(socket))
}
}

#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for net::TcpListener {
unsafe fn from_raw_fd(fd: RawFd) -> net::TcpListener {
let socket = sys::net::Socket::from_inner(fd);
net::TcpListener::from_inner(sys_common::net::TcpListener::from_inner(socket))
}
}

#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for net::UdpSocket {
unsafe fn from_raw_fd(fd: RawFd) -> net::UdpSocket {
let socket = sys::net::Socket::from_inner(fd);
net::UdpSocket::from_inner(sys_common::net::UdpSocket::from_inner(socket))
}
}

#[stable(feature = "into_raw_os", since = "1.4.0")]
impl IntoRawFd for net::TcpStream {
fn into_raw_fd(self) -> RawFd {
self.into_inner().into_socket().into_inner()
}
}
#[stable(feature = "into_raw_os", since = "1.4.0")]
impl IntoRawFd for net::TcpListener {
fn into_raw_fd(self) -> RawFd {
self.into_inner().into_socket().into_inner()
}
}
#[stable(feature = "into_raw_os", since = "1.4.0")]
impl IntoRawFd for net::UdpSocket {
fn into_raw_fd(self) -> RawFd {
self.into_inner().into_socket().into_inner()
}
}
2 changes: 0 additions & 2 deletions src/libstd/sys/vxworks/ext/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Uhhh
#![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)]

Expand All @@ -7,7 +6,6 @@ pub mod ffi;
pub mod fs;
pub mod raw;
pub mod process;
pub mod net;

#[stable(feature = "rust1", since = "1.0.0")]
pub mod prelude {
Expand Down
Loading

0 comments on commit 1c5156a

Please sign in to comment.