diff options
| author | Michael Neumann <mneumann@ntecs.de> | 2016-04-02 19:06:16 +0200 |
|---|---|---|
| committer | Michael Neumann <mneumann@ntecs.de> | 2016-04-07 11:39:27 +0200 |
| commit | 60c988ec176b9653bc1c3a6d6a738646d15a5ad6 (patch) | |
| tree | 6f78e7065f801ae6d6ca286c28f74d30f7e9fbe2 /src/libstd/sys/unix | |
| parent | a9f34c86a4dd43efa20c673688529516524f23c5 (diff) | |
| download | rust-60c988ec176b9653bc1c3a6d6a738646d15a5ad6.tar.gz rust-60c988ec176b9653bc1c3a6d6a738646d15a5ad6.zip | |
Fix libstd on DragonFly
Following changes: * birthtime does not exist on DragonFly * errno: __dfly_error is no more. Use #[thread_local] static errno. * clock_gettime expects a c_ulong (use a type alias) These changes are required to build DragonFly snapshots again.
Diffstat (limited to 'src/libstd/sys/unix')
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sys/unix/time.rs | 7 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index eed62c9ecfd..94ebbd70ae8 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -36,6 +36,7 @@ const TMPBUF_SZ: usize = 128; static ENV_LOCK: StaticMutex = StaticMutex::new(); /// Returns the platform-specific value of errno +#[cfg(not(target_os = "dragonfly"))] pub fn errno() -> i32 { extern { #[cfg_attr(any(target_os = "linux", target_os = "emscripten"), @@ -47,7 +48,6 @@ pub fn errno() -> i32 { target_env = "newlib"), link_name = "__errno")] #[cfg_attr(target_os = "solaris", link_name = "___errno")] - #[cfg_attr(target_os = "dragonfly", link_name = "__dfly_error")] #[cfg_attr(any(target_os = "macos", target_os = "ios", target_os = "freebsd"), @@ -60,6 +60,16 @@ pub fn errno() -> i32 { } } +#[cfg(target_os = "dragonfly")] +pub fn errno() -> i32 { + extern { + #[thread_local] + static errno: c_int; + } + + errno as i32 +} + /// Gets a detailed string description for the given error number. pub fn error_string(errno: i32) -> String { extern { diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 1444cf31e85..cc7abe25e35 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -303,8 +303,13 @@ mod inner { } } + #[cfg(not(target_os = "dragonfly"))] + pub type clock_t = libc::c_int; + #[cfg(target_os = "dragonfly")] + pub type clock_t = libc::c_ulong; + impl Timespec { - pub fn now(clock: libc::c_int) -> Timespec { + pub fn now(clock: clock_t) -> Timespec { let mut t = Timespec { t: libc::timespec { tv_sec: 0, |
