diff options
| author | bors <bors@rust-lang.org> | 2016-03-08 01:04:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-03-08 01:04:36 +0000 |
| commit | 4352a8554f3765b98d27c1a0b1a170414f82b199 (patch) | |
| tree | 1e67584b82b9f652f8bb1cc7e387746499288a0a /src/libstd/sys | |
| parent | 388ccda455140e51456980efc07d175c19dcf005 (diff) | |
| parent | 660bbf4f6f4ce7a3d9e4fa7fdfc5e7c87145e049 (diff) | |
Auto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichton
Fix building libstd on emscripten targets. The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. This commit also depends needs https://github.com/ashleysommer/rust/commit/f1575cff2d631e977038fdba3fa3422ba5f8f2fe applied in order to successfully build libstd with emscripten target.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 250b1b015a0..d1b4b1c5c08 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -25,15 +25,19 @@ use sys::time::SystemTime; use sys::{cvt, cvt_r}; use sys_common::{AsInner, FromInner}; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "emscripten"))] use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64}; #[cfg(target_os = "android")] use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off64_t, ftruncate64, lseek64, dirent as dirent64, open as open64}; -#[cfg(not(any(target_os = "linux", target_os = "android")))] +#[cfg(not(any(target_os = "linux", + target_os = "emscripten", + target_os = "android")))] use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t, ftruncate as ftruncate64, lseek as lseek64, dirent as dirent64, open as open64}; -#[cfg(not(any(target_os = "linux", target_os = "solaris")))] +#[cfg(not(any(target_os = "linux", + target_os = "emscripten", + target_os = "solaris")))] use libc::{readdir_r as readdir64_r}; pub struct File(FileDesc); |
