diff options
| author | bors <bors@rust-lang.org> | 2017-02-25 12:29:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-02-25 12:29:32 +0000 |
| commit | 1572bf104dbf65d58bd6b889fa46229c9b92d6f9 (patch) | |
| tree | 0cd0f02c7a7634ab5e86d2e14f74aeaf4758382e /src/libstd/sys | |
| parent | e78aa5d7546d5db493ec12328368ab0c249c2a94 (diff) | |
| parent | 207c76306037776c0e72456d5a0497e430c6753c (diff) | |
| download | rust-1572bf104dbf65d58bd6b889fa46229c9b92d6f9.tar.gz rust-1572bf104dbf65d58bd6b889fa46229c9b92d6f9.zip | |
Auto merge of #40091 - eddyb:rollup, r=eddyb
Rollup of 28 pull requests - Successful merges: #39859, #39864, #39888, #39903, #39905, #39914, #39945, #39950, #39953, #39961, #39980, #39988, #39993, #39995, #40019, #40020, #40022, #40024, #40025, #40026, #40027, #40031, #40035, #40037, #40038, #40064, #40069, #40086 - Failed merges: #39927, #40008, #40047
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/redox/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/redox/net/tcp.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/redox/net/udp.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 27 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/process/magenta.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/process/process_fuchsia.rs | 4 |
7 files changed, 31 insertions, 18 deletions
diff --git a/src/libstd/sys/redox/mod.rs b/src/libstd/sys/redox/mod.rs index 5982bdd6549..31c40ea58b1 100644 --- a/src/libstd/sys/redox/mod.rs +++ b/src/libstd/sys/redox/mod.rs @@ -13,7 +13,7 @@ use io::{self, ErrorKind}; pub mod args; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod env; diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index a3f202ccd97..936097d7fb2 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -63,6 +63,10 @@ impl TcpStream { Ok(path_to_local_addr(path.to_str().unwrap_or(""))) } + pub fn peek(&self, _buf: &mut [u8]) -> Result<usize> { + Err(Error::new(ErrorKind::Other, "TcpStream::peek not implemented")) + } + pub fn shutdown(&self, _how: Shutdown) -> Result<()> { Err(Error::new(ErrorKind::Other, "TcpStream::shutdown not implemented")) } diff --git a/src/libstd/sys/redox/net/udp.rs b/src/libstd/sys/redox/net/udp.rs index 36f0819d308..93ebcc95fd0 100644 --- a/src/libstd/sys/redox/net/udp.rs +++ b/src/libstd/sys/redox/net/udp.rs @@ -87,6 +87,14 @@ impl UdpSocket { Ok(path_to_local_addr(path.to_str().unwrap_or(""))) } + pub fn peek(&self, _buf: &mut [u8]) -> Result<usize> { + Err(Error::new(ErrorKind::Other, "UdpSocket::peek not implemented")) + } + + pub fn peek_from(&self, _buf: &mut [u8]) -> Result<(usize, SocketAddr)> { + Err(Error::new(ErrorKind::Other, "UdpSocket::peek_from not implemented")) + } + pub fn broadcast(&self) -> Result<bool> { Err(Error::new(ErrorKind::Other, "UdpSocket::broadcast not implemented")) } diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 8b5c0c04276..d0fb96b1ff1 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -35,7 +35,8 @@ use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t, ftruncate as ftruncate64, lseek as lseek64, dirent as dirent64, open as open64}; #[cfg(not(any(target_os = "linux", target_os = "emscripten", - target_os = "solaris")))] + target_os = "solaris", + target_os = "fuchsia")))] use libc::{readdir_r as readdir64_r}; pub struct File(FileDesc); @@ -59,10 +60,10 @@ pub struct DirEntry { entry: dirent64, root: Arc<PathBuf>, // We need to store an owned copy of the directory name - // on Solaris because a) it uses a zero-length array to - // store the name, b) its lifetime between readdir calls - // is not guaranteed. - #[cfg(target_os = "solaris")] + // on Solaris and Fuchsia because a) it uses a zero-length + // array to store the name, b) its lifetime between readdir + // calls is not guaranteed. + #[cfg(any(target_os = "solaris", target_os = "fuchsia"))] name: Box<[u8]> } @@ -205,14 +206,14 @@ impl fmt::Debug for ReadDir { impl Iterator for ReadDir { type Item = io::Result<DirEntry>; - #[cfg(target_os = "solaris")] + #[cfg(any(target_os = "solaris", target_os = "fuchsia"))] fn next(&mut self) -> Option<io::Result<DirEntry>> { unsafe { loop { // Although readdir_r(3) would be a correct function to use here because - // of the thread safety, on Illumos the readdir(3C) function is safe to use - // in threaded applications and it is generally preferred over the - // readdir_r(3C) function. + // of the thread safety, on Illumos and Fuchsia the readdir(3C) function + // is safe to use in threaded applications and it is generally preferred + // over the readdir_r(3C) function. super::os::set_errno(0); let entry_ptr = libc::readdir(self.dirp.0); if entry_ptr.is_null() { @@ -240,7 +241,7 @@ impl Iterator for ReadDir { } } - #[cfg(not(target_os = "solaris"))] + #[cfg(not(any(target_os = "solaris", target_os = "fuchsia")))] fn next(&mut self) -> Option<io::Result<DirEntry>> { unsafe { let mut ret = DirEntry { @@ -344,14 +345,14 @@ impl DirEntry { #[cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", - target_os = "haiku", - target_os = "fuchsia"))] + target_os = "haiku"))] fn name_bytes(&self) -> &[u8] { unsafe { CStr::from_ptr(self.entry.d_name.as_ptr()).to_bytes() } } - #[cfg(target_os = "solaris")] + #[cfg(any(target_os = "solaris", + target_os = "fuchsia"))] fn name_bytes(&self) -> &[u8] { &*self.name } diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index e78928c2667..36928696c40 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -64,7 +64,7 @@ pub fn errno() -> i32 { } /// Sets the platform-specific value of errno -#[cfg(target_os = "solaris")] // only needed for readdir so far +#[cfg(any(target_os = "solaris", target_os = "fuchsia"))] // only needed for readdir so far pub fn set_errno(e: i32) { unsafe { *errno_location() = e as c_int diff --git a/src/libstd/sys/unix/process/magenta.rs b/src/libstd/sys/unix/process/magenta.rs index a81bedcad22..08a827ce081 100644 --- a/src/libstd/sys/unix/process/magenta.rs +++ b/src/libstd/sys/unix/process/magenta.rs @@ -111,7 +111,7 @@ extern { pub fn mx_handle_duplicate(handle: mx_handle_t, rights: mx_rights_t, out: *const mx_handle_t) -> mx_handle_t; - pub fn mx_handle_wait_one(handle: mx_handle_t, signals: mx_signals_t, timeout: mx_time_t, + pub fn mx_object_wait_one(handle: mx_handle_t, signals: mx_signals_t, timeout: mx_time_t, pending: *mut mx_signals_t) -> mx_status_t; pub fn mx_object_get_info(handle: mx_handle_t, topic: u32, buffer: *mut c_void, diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 0bb2e0c1a83..608e44ca9e8 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -151,7 +151,7 @@ impl Process { let mut avail: mx_size_t = 0; unsafe { - mx_cvt(mx_handle_wait_one(self.handle.raw(), MX_TASK_TERMINATED, + mx_cvt(mx_object_wait_one(self.handle.raw(), MX_TASK_TERMINATED, MX_TIME_INFINITE, ptr::null_mut()))?; mx_cvt(mx_object_get_info(self.handle.raw(), MX_INFO_PROCESS, &mut proc_info as *mut _ as *mut libc::c_void, @@ -174,7 +174,7 @@ impl Process { let mut avail: mx_size_t = 0; unsafe { - let status = mx_handle_wait_one(self.handle.raw(), MX_TASK_TERMINATED, + let status = mx_object_wait_one(self.handle.raw(), MX_TASK_TERMINATED, 0, ptr::null_mut()); match status { 0 => { }, // Success |
