From fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae Mon Sep 17 00:00:00 2001 From: Sébastien Marie Date: Thu, 29 Jan 2015 08:19:28 +0100 Subject: openbsd support --- src/libstd/sys/common/net.rs | 10 ++++++++-- src/libstd/sys/common/stack.rs | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src/libstd/sys/common') diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 51b6e0a1c1e..c826522e5d1 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. // @@ -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/stack.rs b/src/libstd/sys/common/stack.rs index 88bb9395cf1..cd5458a2109 100644 --- a/src/libstd/sys/common/stack.rs +++ b/src/libstd/sys/common/stack.rs @@ -241,6 +241,11 @@ pub unsafe fn record_sp_limit(limit: uint) { #[cfg(all(target_arch = "arm", target_os = "ios"))] #[inline(always)] unsafe fn target_record_sp_limit(_: uint) { } + + #[cfg(target_os = "openbsd")] #[inline(always)] + unsafe fn target_record_sp_limit(_: uint) { + // segmented stack is disabled + } } /// The counterpart of the function above, this function will fetch the current @@ -345,4 +350,10 @@ pub unsafe fn get_sp_limit() -> uint { unsafe fn target_get_sp_limit() -> uint { 1024 } + + #[cfg(target_os = "openbsd")] #[inline(always)] + unsafe fn target_get_sp_limit() -> uint { + // segmented stack is disabled + 1024 + } } -- cgit 1.4.1-3-g733a5