diff options
| author | bors <bors@rust-lang.org> | 2015-02-03 03:44:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-03 03:44:05 +0000 |
| commit | 7858cb432d3f2efc0374424cb2b51518f697c172 (patch) | |
| tree | bccd460a861e61f758d2d459cb9da02b1ad8792b /src/libstd/sys/common | |
| parent | eaf4c5c784637f3df8bdebc6ec21dbd4bc69420a (diff) | |
| parent | 9ece22ee00033cdf0b6b418c451112c92c8ad922 (diff) | |
| download | rust-7858cb432d3f2efc0374424cb2b51518f697c172.tar.gz rust-7858cb432d3f2efc0374424cb2b51518f697c172.zip | |
Auto merge of #21872 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/libstd/sys/common')
| -rw-r--r-- | src/libstd/sys/common/mutex.rs | 7 | ||||
| -rw-r--r-- | src/libstd/sys/common/net.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sys/common/rwlock.rs | 7 | ||||
| -rw-r--r-- | src/libstd/sys/common/stack.rs | 43 | ||||
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 13 |
5 files changed, 27 insertions, 55 deletions
diff --git a/src/libstd/sys/common/mutex.rs b/src/libstd/sys/common/mutex.rs index 9aea0fb3b31..0ca22826700 100644 --- a/src/libstd/sys/common/mutex.rs +++ b/src/libstd/sys/common/mutex.rs @@ -24,13 +24,6 @@ unsafe impl Sync for Mutex {} pub const MUTEX_INIT: Mutex = Mutex(imp::MUTEX_INIT); impl Mutex { - /// Creates a newly initialized mutex. - /// - /// Behavior is undefined if the mutex is moved after the first method is - /// called on the mutex. - #[inline] - pub unsafe fn new() -> Mutex { Mutex(imp::Mutex::new()) } - /// Lock the mutex blocking the current thread until it is available. /// /// Behavior is undefined if the mutex has been moved between this and any diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 51b6e0a1c1e..833de8adda4 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -1,4 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -554,7 +554,7 @@ pub fn await(fds: &[sock_t], deadline: Option<u64>, status: SocketStatus) -> IoResult<()> { let mut set: c::fd_set = unsafe { mem::zeroed() }; let mut max = 0; - for &fd in fds.iter() { + for &fd in fds { c::fd_set(&mut set, fd); max = cmp::max(max, fd + 1); } @@ -694,10 +694,16 @@ impl TcpStream { setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, seconds as libc::c_int) } + #[cfg(target_os = "openbsd")] + fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> { + setsockopt(self.fd(), libc::IPPROTO_TCP, libc::SO_KEEPALIVE, + seconds as libc::c_int) + } #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "freebsd", - target_os = "dragonfly")))] + target_os = "dragonfly", + target_os = "openbsd")))] fn set_tcp_keepalive(&mut self, _seconds: uint) -> IoResult<()> { Ok(()) } diff --git a/src/libstd/sys/common/rwlock.rs b/src/libstd/sys/common/rwlock.rs index df016b9e293..fe374e1fd78 100644 --- a/src/libstd/sys/common/rwlock.rs +++ b/src/libstd/sys/common/rwlock.rs @@ -21,13 +21,6 @@ pub struct RWLock(imp::RWLock); pub const RWLOCK_INIT: RWLock = RWLock(imp::RWLOCK_INIT); impl RWLock { - /// Creates a new instance of an RWLock. - /// - /// Usage of an RWLock is undefined if it is moved after its first use (any - /// function calls below). - #[inline] - pub unsafe fn new() -> RWLock { RWLock(imp::RWLock::new()) } - /// Acquire shared access to the underlying lock, blocking the current /// thread to do so. /// diff --git a/src/libstd/sys/common/stack.rs b/src/libstd/sys/common/stack.rs index 88bb9395cf1..8dd2f154fa8 100644 --- a/src/libstd/sys/common/stack.rs +++ b/src/libstd/sys/common/stack.rs @@ -227,18 +227,13 @@ pub unsafe fn record_sp_limit(limit: uint) { } // aarch64 - FIXME(AARCH64): missing... - #[cfg(target_arch = "aarch64")] - unsafe fn target_record_sp_limit(_: uint) { - } - // powerpc - FIXME(POWERPC): missing... - #[cfg(target_arch = "powerpc")] - unsafe fn target_record_sp_limit(_: uint) { - } - - - // iOS segmented stack is disabled for now, see related notes - #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)] + // arm-ios - iOS segmented stack is disabled for now, see related notes + // openbsd - segmented stack is disabled + #[cfg(any(target_arch = "aarch64", + target_arch = "powerpc", + all(target_arch = "arm", target_os = "ios"), + target_os = "openbsd"))] unsafe fn target_record_sp_limit(_: uint) { } } @@ -327,21 +322,17 @@ pub unsafe fn get_sp_limit() -> uint { } // aarch64 - FIXME(AARCH64): missing... - #[cfg(target_arch = "aarch64")] - unsafe fn target_get_sp_limit() -> uint { - 1024 - } - - // powepc - FIXME(POWERPC): missing... - #[cfg(target_arch = "powerpc")] - unsafe fn target_get_sp_limit() -> uint { - 1024 - } - - // iOS doesn't support segmented stacks yet. This function might - // be called by runtime though so it is unsafe to mark it as - // unreachable, let's return a fixed constant. - #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)] + // powerpc - FIXME(POWERPC): missing... + // arm-ios - iOS doesn't support segmented stacks yet. + // openbsd - OpenBSD doesn't support segmented stacks. + // + // This function might be called by runtime though + // so it is unsafe to unreachable, let's return a fixed constant. + #[cfg(any(target_arch = "aarch64", + target_arch = "powerpc", + all(target_arch = "arm", target_os = "ios"), + target_os = "openbsd"))] + #[inline(always)] unsafe fn target_get_sp_limit() -> uint { 1024 } diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index fdcb0c19f30..b30af10986b 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -366,7 +366,7 @@ impl FromIterator<CodePoint> for Wtf8Buf { /// This replaces surrogate code point pairs with supplementary code points, /// like concatenating ill-formed UTF-16 strings effectively would. impl Extend<CodePoint> for Wtf8Buf { - fn extend<T: Iterator<Item=CodePoint>>(&mut self, mut iterator: T) { + fn extend<T: Iterator<Item=CodePoint>>(&mut self, iterator: T) { let (low, _high) = iterator.size_hint(); // Lower bound of one byte per code point (ASCII only) self.bytes.reserve(low); @@ -680,17 +680,6 @@ impl ops::Index<ops::RangeTo<usize>> for Wtf8 { } } -#[cfg(stage0)] -impl ops::Index<ops::FullRange> for Wtf8 { - type Output = Wtf8; - - #[inline] - fn index(&self, _range: &ops::FullRange) -> &Wtf8 { - self - } -} - -#[cfg(not(stage0))] impl ops::Index<ops::RangeFull> for Wtf8 { type Output = Wtf8; |
