diff options
Diffstat (limited to 'src/libstd/sys/unix')
| -rw-r--r-- | src/libstd/sys/unix/args.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/env.rs | 11 | ||||
| -rw-r--r-- | src/libstd/sys/unix/ext/fs.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/mod.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 4 |
7 files changed, 30 insertions, 5 deletions
diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index c64db333e51..c04fd863674 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -58,7 +58,8 @@ impl DoubleEndedIterator for Args { target_os = "openbsd", target_os = "solaris", target_os = "emscripten", - target_os = "haiku"))] + target_os = "haiku", + target_os = "fuchsia"))] mod imp { use os::unix::prelude::*; use mem; diff --git a/src/libstd/sys/unix/env.rs b/src/libstd/sys/unix/env.rs index 66ff2fec832..eff3a8c2a34 100644 --- a/src/libstd/sys/unix/env.rs +++ b/src/libstd/sys/unix/env.rs @@ -171,3 +171,14 @@ pub mod os { pub const EXE_SUFFIX: &'static str = ".js"; pub const EXE_EXTENSION: &'static str = "js"; } + +#[cfg(target_os = "fuchsia")] +pub mod os { + pub const FAMILY: &'static str = "unix"; + pub const OS: &'static str = "fuchsia"; + pub const DLL_PREFIX: &'static str = "lib"; + pub const DLL_SUFFIX: &'static str = ".so"; + pub const DLL_EXTENSION: &'static str = "so"; + pub const EXE_SUFFIX: &'static str = ""; + pub const EXE_EXTENSION: &'static str = ""; +} diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index fcfab051588..3ff21a07827 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -312,6 +312,7 @@ pub trait DirEntryExt { } #[stable(feature = "dir_entry_ext", since = "1.1.0")] +#[cfg(not(target_os = "fuchsia"))] impl DirEntryExt for fs::DirEntry { fn ino(&self) -> u64 { self.as_inner().ino() } } diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index b77008676b1..ee2887eb019 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -342,7 +342,8 @@ impl DirEntry { #[cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", - target_os = "haiku"))] + target_os = "haiku", + target_os = "fuchsia"))] fn name_bytes(&self) -> &[u8] { unsafe { CStr::from_ptr(self.entry.d_name.as_ptr()).to_bytes() diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index 501329772ce..66bc9d4a491 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -26,6 +26,7 @@ use libc; #[cfg(target_os = "openbsd")] pub use os::openbsd as platform; #[cfg(target_os = "solaris")] pub use os::solaris as platform; #[cfg(target_os = "emscripten")] pub use os::emscripten as platform; +#[cfg(target_os = "fuchsia")] pub use os::fuchsia as platform; #[macro_use] pub mod weak; @@ -88,11 +89,11 @@ pub fn init() { } } - #[cfg(not(any(target_os = "nacl", target_os = "emscripten")))] + #[cfg(not(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia")))] unsafe fn reset_sigpipe() { assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0); } - #[cfg(any(target_os = "nacl", target_os = "emscripten"))] + #[cfg(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia"))] unsafe fn reset_sigpipe() {} } diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 91f6ba80f83..e591f25cac1 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -38,7 +38,7 @@ static ENV_LOCK: Mutex = Mutex::new(); extern { #[cfg(not(target_os = "dragonfly"))] - #[cfg_attr(any(target_os = "linux", target_os = "emscripten"), + #[cfg_attr(any(target_os = "linux", target_os = "emscripten", target_os = "fuchsia"), link_name = "__errno_location")] #[cfg_attr(any(target_os = "bitrig", target_os = "netbsd", @@ -346,6 +346,12 @@ pub fn current_exe() -> io::Result<PathBuf> { } } +#[cfg(target_os = "fuchsia")] +pub fn current_exe() -> io::Result<PathBuf> { + use io::ErrorKind; + Err(io::Error::new(ErrorKind::Other, "Not yet implemented on fuchsia")) +} + pub struct Env { iter: vec::IntoIter<(OsString, OsString)>, _dont_send_or_sync_me: PhantomData<*mut ()>, diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 87d82cdab97..df98d2e0169 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -135,6 +135,10 @@ impl Thread { pub fn set_name(_name: &CStr) { // Newlib, Illumos, Haiku, and Emscripten have no way to set a thread name. } + #[cfg(target_os = "fuchsia")] + pub fn set_name(_name: &CStr) { + // TODO: determine whether Fuchsia has a way to set a thread name. + } pub fn sleep(dur: Duration) { let mut secs = dur.as_secs(); |
