about summary refs log tree commit diff
path: root/src/libstd/sys/common
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-01-29 08:19:28 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-02-01 14:41:38 +0100
commitfcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae (patch)
tree055fbf1fe9f0b9bd89481f29105fef90370d7789 /src/libstd/sys/common
parentf1f9cb705df95171fce4e575374c959509e58dea (diff)
downloadrust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.tar.gz
rust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.zip
openbsd support
Diffstat (limited to 'src/libstd/sys/common')
-rw-r--r--src/libstd/sys/common/net.rs10
-rw-r--r--src/libstd/sys/common/stack.rs11
2 files changed, 19 insertions, 2 deletions
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
+    }
 }