about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-02-05 18:56:10 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-02-05 19:04:30 +0100
commitcb4965ef3a826af8150ef863e98709b4ffa83767 (patch)
treeb0d9c7e279dfc3913f42786c5ceb6e00b4f4ffc4 /src/libstd
parent5ad3488f29bbccfcee074bb0f3971acec97cfc45 (diff)
downloadrust-cb4965ef3a826af8150ef863e98709b4ffa83767.tar.gz
rust-cb4965ef3a826af8150ef863e98709b4ffa83767.zip
complete openbsd support for `std::env`
- add `std::env:consts`
- deprecating `std::os::consts`
- refactoring errno_location()
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/env.rs32
-rw-r--r--src/libstd/os.rs2
-rw-r--r--src/libstd/sys/unix/os.rs10
3 files changed, 37 insertions, 7 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 559a68542ef..c3aacf6f6b0 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -563,6 +563,38 @@ pub mod consts {
 }
 
 /// Constants associated with the current target
+#[cfg(target_os = "openbsd")]
+pub mod consts {
+    pub use super::arch_consts::ARCH;
+
+    pub const FAMILY: &'static str = "unix";
+
+    /// A string describing the specific operating system in use: in this
+    /// case, `dragonfly`.
+    pub const OS: &'static str = "openbsd";
+
+    /// Specifies the filename prefix used for shared libraries on this
+    /// platform: in this case, `lib`.
+    pub const DLL_PREFIX: &'static str = "lib";
+
+    /// Specifies the filename suffix used for shared libraries on this
+    /// platform: in this case, `.so`.
+    pub const DLL_SUFFIX: &'static str = ".so";
+
+    /// Specifies the file extension used for shared libraries on this
+    /// platform that goes after the dot: in this case, `so`.
+    pub const DLL_EXTENSION: &'static str = "so";
+
+    /// Specifies the filename suffix used for executable binaries on this
+    /// platform: in this case, the empty string.
+    pub const EXE_SUFFIX: &'static str = "";
+
+    /// Specifies the file extension, if any, used for executable binaries
+    /// on this platform: in this case, the empty string.
+    pub const EXE_EXTENSION: &'static str = "";
+}
+
+/// Constants associated with the current target
 #[cfg(target_os = "android")]
 pub mod consts {
     pub use super::arch_consts::ARCH;
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 64f9e16aee4..72a8ac04911 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -1289,6 +1289,8 @@ pub mod consts {
 }
 
 #[cfg(target_os = "openbsd")]
+#[deprecated(since = "1.0.0", reason = "renamed to env::consts")]
+#[unstable(feature = "os")]
 pub mod consts {
     pub use os::arch_consts::ARCH;
 
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index be52c7dc692..b191eda583c 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -47,13 +47,9 @@ pub fn errno() -> i32 {
     }
 
     #[cfg(target_os = "openbsd")]
-    fn errno_location() -> *const c_int {
-        extern {
-            fn __errno() -> *const c_int;
-        }
-        unsafe {
-            __errno()
-        }
+    unsafe fn errno_location() -> *const c_int {
+        extern { fn __errno() -> *const c_int; }
+        __errno()
     }
 
     #[cfg(any(target_os = "linux", target_os = "android"))]