[emscripten] Disable code paths that don't work on emscripten
This commit is contained in:
parent
ad91873cb6
commit
60599df03b
6 changed files with 13 additions and 11 deletions
|
@ -83,11 +83,11 @@ pub fn init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "nacl"))]
|
#[cfg(not(any(target_os = "nacl", target_os = "emscripten")))]
|
||||||
unsafe fn reset_sigpipe() {
|
unsafe fn reset_sigpipe() {
|
||||||
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0);
|
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0);
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "nacl")]
|
#[cfg(any(target_os = "nacl", target_os = "emscripten"))]
|
||||||
unsafe fn reset_sigpipe() {}
|
unsafe fn reset_sigpipe() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,11 +551,13 @@ pub fn home_dir() -> Option<PathBuf> {
|
||||||
|
|
||||||
#[cfg(any(target_os = "android",
|
#[cfg(any(target_os = "android",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "nacl"))]
|
target_os = "nacl",
|
||||||
|
target_os = "emscripten"))]
|
||||||
unsafe fn fallback() -> Option<OsString> { None }
|
unsafe fn fallback() -> Option<OsString> { None }
|
||||||
#[cfg(not(any(target_os = "android",
|
#[cfg(not(any(target_os = "android",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "nacl")))]
|
target_os = "nacl",
|
||||||
|
target_os = "emscripten")))]
|
||||||
unsafe fn fallback() -> Option<OsString> {
|
unsafe fn fallback() -> Option<OsString> {
|
||||||
#[cfg(not(target_os = "solaris"))]
|
#[cfg(not(target_os = "solaris"))]
|
||||||
unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,
|
unsafe fn getpwduid_r(me: libc::uid_t, passwd: &mut libc::passwd,
|
||||||
|
|
|
@ -81,8 +81,7 @@ impl Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "android",
|
target_os = "android"))]
|
||||||
target_os = "emscripten"))]
|
|
||||||
pub fn set_name(name: &CStr) {
|
pub fn set_name(name: &CStr) {
|
||||||
const PR_SET_NAME: libc::c_int = 15;
|
const PR_SET_NAME: libc::c_int = 15;
|
||||||
// pthread wrapper only appeared in glibc 2.12, so we use syscall
|
// pthread wrapper only appeared in glibc 2.12, so we use syscall
|
||||||
|
@ -118,9 +117,9 @@ impl Thread {
|
||||||
name.as_ptr() as *mut libc::c_void);
|
name.as_ptr() as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(any(target_env = "newlib", target_os = "solaris"))]
|
#[cfg(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten"))]
|
||||||
pub fn set_name(_name: &CStr) {
|
pub fn set_name(_name: &CStr) {
|
||||||
// Newlib and Illumos has no way to set a thread name.
|
// Newlib, Illumos and Emscripten have no way to set a thread name.
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sleep(dur: Duration) {
|
pub fn sleep(dur: Duration) {
|
||||||
|
|
|
@ -60,7 +60,6 @@ pub const unwinder_private_data_size: usize = 2;
|
||||||
pub const unwinder_private_data_size: usize = 2;
|
pub const unwinder_private_data_size: usize = 2;
|
||||||
|
|
||||||
#[cfg(target_arch = "asmjs")]
|
#[cfg(target_arch = "asmjs")]
|
||||||
// FIXME: Copied from arm. Need to confirm.
|
|
||||||
pub const unwinder_private_data_size: usize = 20;
|
pub const unwinder_private_data_size: usize = 20;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
|
@ -24,7 +24,8 @@ mod rusti {
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "solaris"))]
|
target_os = "solaris",
|
||||||
|
target_os = "emscripten"))]
|
||||||
mod m {
|
mod m {
|
||||||
#[main]
|
#[main]
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
|
|
|
@ -42,7 +42,8 @@ struct Outer {
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "solaris"))]
|
target_os = "solaris",
|
||||||
|
target_os = "emscripten"))]
|
||||||
mod m {
|
mod m {
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
pub mod m {
|
pub mod m {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue