complete openbsd support for std::env

- add `std::env:consts`
- deprecating `std::os::consts`
- refactoring errno_location()
This commit is contained in:
Sébastien Marie 2015-02-05 18:56:10 +01:00
parent 5ad3488f29
commit cb4965ef3a
3 changed files with 37 additions and 7 deletions

View file

@ -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 {

View file

@ -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;

View file

@ -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"))]