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 @@ -562,6 +562,38 @@ pub mod consts { pub const EXE_EXTENSION: &'static str = ""; } +/// 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 { 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"))]