Skip to content

Commit be0e381

Browse files
authored
Merge pull request #42 from Wind-River/master_003
vxWorks: remove all code related to UNIX socket as it is not supporte…
2 parents caa1f8d + 8995974 commit be0e381

File tree

3 files changed

+60
-1828
lines changed

3 files changed

+60
-1828
lines changed

src/libstd/sys/vxworks/ext/io.rs

+60-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use crate::fs;
66
use crate::os::raw;
77
use crate::sys;
88
use crate::io;
9-
use crate::sys_common::{AsInner, FromInner, IntoInner};
9+
use crate::sys_common::{self, AsInner, FromInner, IntoInner};
10+
use crate::net;
1011

1112
/// Raw file descriptors.
1213
#[stable(feature = "rust1", since = "1.0.0")]
@@ -110,3 +111,61 @@ impl<'a> AsRawFd for io::StdoutLock<'a> {
110111
impl<'a> AsRawFd for io::StderrLock<'a> {
111112
fn as_raw_fd(&self) -> RawFd { libc::STDERR_FILENO }
112113
}
114+
115+
#[stable(feature = "rust1", since = "1.0.0")]
116+
impl AsRawFd for net::TcpStream {
117+
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
118+
}
119+
120+
#[stable(feature = "rust1", since = "1.0.0")]
121+
impl AsRawFd for net::TcpListener {
122+
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
123+
}
124+
125+
#[stable(feature = "rust1", since = "1.0.0")]
126+
impl AsRawFd for net::UdpSocket {
127+
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
128+
}
129+
130+
#[stable(feature = "from_raw_os", since = "1.1.0")]
131+
impl FromRawFd for net::TcpStream {
132+
unsafe fn from_raw_fd(fd: RawFd) -> net::TcpStream {
133+
let socket = sys::net::Socket::from_inner(fd);
134+
net::TcpStream::from_inner(sys_common::net::TcpStream::from_inner(socket))
135+
}
136+
}
137+
138+
#[stable(feature = "from_raw_os", since = "1.1.0")]
139+
impl FromRawFd for net::TcpListener {
140+
unsafe fn from_raw_fd(fd: RawFd) -> net::TcpListener {
141+
let socket = sys::net::Socket::from_inner(fd);
142+
net::TcpListener::from_inner(sys_common::net::TcpListener::from_inner(socket))
143+
}
144+
}
145+
146+
#[stable(feature = "from_raw_os", since = "1.1.0")]
147+
impl FromRawFd for net::UdpSocket {
148+
unsafe fn from_raw_fd(fd: RawFd) -> net::UdpSocket {
149+
let socket = sys::net::Socket::from_inner(fd);
150+
net::UdpSocket::from_inner(sys_common::net::UdpSocket::from_inner(socket))
151+
}
152+
}
153+
154+
#[stable(feature = "into_raw_os", since = "1.4.0")]
155+
impl IntoRawFd for net::TcpStream {
156+
fn into_raw_fd(self) -> RawFd {
157+
self.into_inner().into_socket().into_inner()
158+
}
159+
}
160+
#[stable(feature = "into_raw_os", since = "1.4.0")]
161+
impl IntoRawFd for net::TcpListener {
162+
fn into_raw_fd(self) -> RawFd {
163+
self.into_inner().into_socket().into_inner()
164+
}
165+
}
166+
#[stable(feature = "into_raw_os", since = "1.4.0")]
167+
impl IntoRawFd for net::UdpSocket {
168+
fn into_raw_fd(self) -> RawFd {
169+
self.into_inner().into_socket().into_inner()
170+
}
171+
}

src/libstd/sys/vxworks/ext/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Uhhh
21
#![stable(feature = "rust1", since = "1.0.0")]
32
#![allow(missing_docs)]
43

@@ -7,7 +6,6 @@ pub mod ffi;
76
pub mod fs;
87
pub mod raw;
98
pub mod process;
10-
pub mod net;
119

1210
#[stable(feature = "rust1", since = "1.0.0")]
1311
pub mod prelude {

0 commit comments

Comments
 (0)