From 3c6a4f2d4342027caf2a5f5df194c63cfa3e29a9 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 14:19:42 -0300 Subject: [PATCH 01/19] Bump ctest to 0.1.3 --- Cargo.lock | 22 +++++++++++----------- libc-test/Cargo.toml | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da8cdf8cb7869..410b02a802b33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,7 +2,7 @@ name = "libc-test" version = "0.1.0" dependencies = [ - "ctest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctest 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23", ] @@ -13,11 +13,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ctest" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syntex_syntax 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,7 +29,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "generate-files" version = "0.1.0" dependencies = [ - "ctest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctest 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -43,12 +43,12 @@ dependencies = [ [[package]] name = "libc" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.2.23" [[package]] name = "libc" version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "log" @@ -62,11 +62,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syntex_syntax" -version = "0.19.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -99,13 +99,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c" -"checksum ctest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "156b2ddc97c727423b94749e91562244a093e345a575fe1b6b589ab194e09a72" +"checksum ctest 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4714dea251b5a487400bd9f772810cca11e5fe361e1918805c9f1ce35d177e22" "checksum gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "181e3cebba1d663bd92eb90e2da787e10597e027eb00de8d742b260a7850948f" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122" +"checksum libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)" = "e7eb6b826bfc1fdea7935d46556250d1799b7fe2d9f7951071f4291710665e3e" "checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8739e1a8b53efe7349917259f8ced15f797c89bf788a86e44f61addc0d1ecf68" +"checksum syntex_syntax 0.27.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82b078749c05271b2aebae7230331c903c38128d5a3dec72625d9e3a411a5b69" "checksum term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f2077e54d38055cf1ca0fd7933a2e00cd3ec8f6fed352b2a377f06dcdaaf3281" "checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 4e7c88450e6ae..5bf8629adb268 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" libc = { path = ".." } [build-dependencies] -ctest = "0.1" +ctest = "0.1.3" From 6324ed9417b2da86733d31a1a699be946606ff50 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 17:05:30 -0300 Subject: [PATCH 02/19] Add support for emscripten tests --- ci/docker/asmjs-unknown-emscripten/Dockerfile | 20 +++++++++ .../wasm32-unknown-emscripten/Dockerfile | 20 +++++++++ ci/emscripten-entry.sh | 19 +++++++++ ci/emscripten.sh | 36 ++++++++++++++++ ci/run.sh | 4 ++ libc-test/build.rs | 42 ++++++++++++++++--- 6 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 ci/docker/asmjs-unknown-emscripten/Dockerfile create mode 100644 ci/docker/wasm32-unknown-emscripten/Dockerfile create mode 100755 ci/emscripten-entry.sh create mode 100644 ci/emscripten.sh diff --git a/ci/docker/asmjs-unknown-emscripten/Dockerfile b/ci/docker/asmjs-unknown-emscripten/Dockerfile new file mode 100644 index 0000000000000..7de85251e6d43 --- /dev/null +++ b/ci/docker/asmjs-unknown-emscripten/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + gcc \ + git \ + libc6-dev \ + python \ + xz-utils + +COPY emscripten.sh / +RUN bash /emscripten.sh + +ENV PATH=$PATH:/rust/bin + +COPY emscripten-entry.sh / +ENTRYPOINT ["/emscripten-entry.sh"] + diff --git a/ci/docker/wasm32-unknown-emscripten/Dockerfile b/ci/docker/wasm32-unknown-emscripten/Dockerfile new file mode 100644 index 0000000000000..7de85251e6d43 --- /dev/null +++ b/ci/docker/wasm32-unknown-emscripten/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + gcc \ + git \ + libc6-dev \ + python \ + xz-utils + +COPY emscripten.sh / +RUN bash /emscripten.sh + +ENV PATH=$PATH:/rust/bin + +COPY emscripten-entry.sh / +ENTRYPOINT ["/emscripten-entry.sh"] + diff --git a/ci/emscripten-entry.sh b/ci/emscripten-entry.sh new file mode 100755 index 0000000000000..acaebfe8c7cbe --- /dev/null +++ b/ci/emscripten-entry.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex + +source /emsdk-portable/emsdk_env.sh &> /dev/null + +# emsdk-portable provides a node binary, but we need version 8 to run wasm +export PATH="/node-v8.0.0-linux-x64/bin:$PATH" + +exec "$@" diff --git a/ci/emscripten.sh b/ci/emscripten.sh new file mode 100644 index 0000000000000..1a20643bb4ef9 --- /dev/null +++ b/ci/emscripten.sh @@ -0,0 +1,36 @@ +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex + +cd / +curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ + tar -xz + +cd /emsdk-portable +./emsdk update +./emsdk install sdk-1.37.13-64bit +./emsdk activate sdk-1.37.13-64bit + +# Compile and cache libc +source ./emsdk_env.sh +echo "main(){}" > a.c +HOME=/emsdk-portable/ emcc a.c +HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c +rm -f a.* + +# Make emsdk usable by any user +cp /root/.emscripten /emsdk-portable +chmod a+rxw -R /emsdk-portable + +# node 8 is required to run wasm +cd / +curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \ + tar -xJ diff --git a/ci/run.sh b/ci/run.sh index 3ddc7b3954768..08bb8cc92a5d7 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -168,6 +168,10 @@ case "$TARGET" in qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test ;; + *-emscripten) + cd $CARGO_TARGET_DIR/$TARGET/debug/deps/ && node ../libc-test.js + ;; + *-rumprun-netbsd) rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/libc-test qemu-system-x86_64 -nographic -vga none -m 64 \ diff --git a/libc-test/build.rs b/libc-test/build.rs index 619b8d3446f6e..0c01a95168c8d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -13,7 +13,8 @@ fn main() { let linux = target.contains("unknown-linux"); let android = target.contains("android"); let apple = target.contains("apple"); - let musl = target.contains("musl"); + let emscripten = target.contains("asm"); + let musl = target.contains("musl") || emscripten; let uclibc = target.contains("uclibc"); let freebsd = target.contains("freebsd"); let dragonfly = target.contains("dragonfly"); @@ -25,7 +26,7 @@ fn main() { let mut cfg = ctest::TestGenerator::new(); // Pull in extra goodies - if linux || android { + if linux || android || emscripten { cfg.define("_GNU_SOURCE", None); } else if netbsd { cfg.define("_NETBSD_SOURCE", Some("1")); @@ -165,7 +166,7 @@ fn main() { } } - if linux { + if linux || emscripten { cfg.header("mqueue.h"); cfg.header("ucontext.h"); cfg.header("sys/signalfd.h"); @@ -183,7 +184,7 @@ fn main() { cfg.header("shadow.h"); } - if linux || android { + if linux || android || emscripten { cfg.header("malloc.h"); cfg.header("net/ethernet.h"); cfg.header("netpacket/packet.h"); @@ -237,7 +238,7 @@ fn main() { cfg.header("sys/ioctl_compat.h"); } - if linux || freebsd || dragonfly || netbsd || apple { + if linux || emscripten || freebsd || dragonfly || netbsd || apple { if !uclibc { cfg.header("aio.h"); } @@ -356,6 +357,9 @@ fn main() { "FILE_ATTRIBUTE_INTEGRITY_STREAM" | "ERROR_NOTHING_TO_TERMINATE" if mingw => true, + // not defined + "IUTF8" | "ENOATTR" | "EXTA" | "EXTB" if emscripten => true, + "SIG_IGN" => true, // sighandler_t weirdness // types on musl are defined a little differently @@ -428,6 +432,34 @@ fn main() { "prlimit" | "prlimit64" | // non-int in 2nd arg "strerror_r" if linux => true, // actually xpg-something-or-other + // not defined or fails to link + "aio_cancel" | "aio_error" | "aio_fsync" | "aio_read" | "aio_read_write" | "aio_return"| + "aio_suspend" | "aio_write" | "clock_nanosleep" | "clone" | "daemon" | "endspent" | + "epoll_create" | "epoll_create1" | "epoll_ctl" | "epoll_pwait" | "epoll_wait" | + "eventfd" | "faccessat" | "fallocate" | "fgetxattr" | "flistxattr" | "fork" | + "forkpty" | "fremovexattr" | "fsetxattr" | "ftok" | "futimes" | "getdtablesize" | + "getgrgid" | "getgrnam" | "getgroups" | "getpgid" | "getpgrp" | "getpwnam_r" | + "getpwuid_r" | "getspent" | "getspnam" | "getxattr" | "initgroups" | "lgetxattr" | + "listxattr" | "llistxattr" | "lremovexattr" | "lsetxattr" | "lutimes" | "mount" | + "mq_close" | "mq_getattr" | "mq_open" | "mq_receive" | "mq_send" | "mq_setattr" | + "mq_unlink" | "msgctl" | "msgget" | "msgrcv" | "msgsnd" | "pclose" | "popen" | + "ppoll" | "prctl" | "prlimit" | "prlimit64" | "process_vm_readv" | + "process_vm_writev" | "pthread_atfork" | "pthread_attr_getguardsize" | + "pthread_kill" | "pthread_mutexattr_getpshared" | "pthread_mutex_timedlock" | + "pthread_sigmask" | "ptrace" | "quotactl" | "readahead" | "reboot" | "removexattr" | + "sched_getaffinity" | "sched_getparam" | "sched_get_priority_max" | + "sched_get_priority_min" | "sched_getscheduler" | "sched_rr_get_interval" | + "sched_setaffinity" | "sched_setparam" | "sched_setscheduler" | "sem_close" | + "semctl" | "semget" | "semop" | "sem_open" | "sem_timedwait" | "sem_unlink" | + "sendfile" | "setfsgid" | "setfsuid" | "setgroups" | "sethostname" | "setns" | + "setpgid" | "setpgrp" | "setspent" | "settimeofday" | "setxattr" | "shmat" | + "shmctl" | "shmdt" | "shmget" | "sigaltstack" | "signalfd" | "sigsuspend" | + "sigtimedwait" | "sigwait" | "sigwaitinfo" | "splice" | "sync_file_range" | + "syscall" | "sysinfo" | "tee" | "umount" | "umount2" | "unshare" | "vmsplice" + if emscripten => true, + + // n if n.starts_with("epoll") && emscripten => true, + // int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that // they match the interface defined by Linux verbatim, but they conflict with other // send*/recv* syscalls From 772efe94a8392c8da77b73245d43410b4cf7c182 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 17:14:31 -0300 Subject: [PATCH 03/19] Fix c_char and wchar_t for emscripten --- src/unix/notbsd/linux/musl/b32/asmjs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index e890a34585f9c..2b7cb8dc8a1ec 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -1,5 +1,5 @@ -pub type c_char = u8; -pub type wchar_t = u32; +pub type c_char = i8; +pub type wchar_t = i32; s! { pub struct stat { From 0547ddf8ffec67b0fc4e6ddbf0a4a3bbbffbc026 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 17:16:19 -0300 Subject: [PATCH 04/19] Fix rusage and sched_param for emscripten --- src/unix/mod.rs | 2 +- src/unix/notbsd/mod.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 1727047e6b434..076fd55399325 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -62,7 +62,7 @@ s! { pub ru_nvcsw: c_long, pub ru_nivcsw: c_long, - #[cfg(any(target_env = "musl"))] + #[cfg(any(target_env = "musl", target_os = "emscripten"))] __reserved: [c_long; 16], } diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 6debd82960384..9c95b340a351a 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -103,13 +103,13 @@ s! { pub struct sched_param { pub sched_priority: ::c_int, - #[cfg(any(target_env = "musl"))] + #[cfg(any(target_env = "musl", target_os = "emscripten"))] pub sched_ss_low_priority: ::c_int, - #[cfg(any(target_env = "musl"))] + #[cfg(any(target_env = "musl", target_os = "emscripten"))] pub sched_ss_repl_period: ::timespec, - #[cfg(any(target_env = "musl"))] + #[cfg(any(target_env = "musl", target_os = "emscripten"))] pub sched_ss_init_budget: ::timespec, - #[cfg(any(target_env = "musl"))] + #[cfg(any(target_env = "musl", target_os = "emscripten"))] pub sched_ss_max_repl: ::c_int, } @@ -255,6 +255,10 @@ pub const RUSAGE_SELF: ::c_int = 0; pub const O_RDONLY: ::c_int = 0; pub const O_WRONLY: ::c_int = 1; pub const O_RDWR: ::c_int = 2; + +#[cfg(target_os = "emscripten")] +pub const O_TMPFILE: ::c_int = 0o20000000; +#[cfg(not(target_os = "emscripten"))] pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; From 2ca0849c67315f030707c640eb05836ba68c20f7 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 17:25:21 -0300 Subject: [PATCH 05/19] Fix pthread related definitions for emscripten --- src/unix/notbsd/linux/mod.rs | 12 ++++++------ src/unix/notbsd/linux/musl/b32/arm.rs | 2 ++ src/unix/notbsd/linux/musl/b32/asmjs.rs | 2 ++ src/unix/notbsd/linux/musl/b32/mips.rs | 2 ++ src/unix/notbsd/linux/musl/b32/mod.rs | 6 ++++-- src/unix/notbsd/linux/musl/b32/x86.rs | 2 ++ 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index a0718452a8f8d..03d01f1ce09f7 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -68,20 +68,20 @@ s! { pub struct pthread_mutex_t { #[cfg(any(target_arch = "mips", target_arch = "arm", - target_arch = "powerpc"))] + target_arch = "powerpc", target_os = "emscripten"))] __align: [::c_long; 0], #[cfg(not(any(target_arch = "mips", target_arch = "arm", - target_arch = "powerpc")))] + target_arch = "powerpc", target_os = "emscripten")))] __align: [::c_longlong; 0], size: [u8; __SIZEOF_PTHREAD_MUTEX_T], } pub struct pthread_rwlock_t { #[cfg(any(target_arch = "mips", target_arch = "arm", - target_arch = "powerpc"))] + target_arch = "powerpc", target_os = "emscripten"))] __align: [::c_long; 0], #[cfg(not(any(target_arch = "mips", target_arch = "arm", - target_arch = "powerpc")))] + target_arch = "powerpc", target_os = "emscripten")))] __align: [::c_longlong; 0], size: [u8; __SIZEOF_PTHREAD_RWLOCK_T], } @@ -99,9 +99,9 @@ s! { } pub struct pthread_cond_t { - #[cfg(any(target_env = "musl"))] + #[cfg(any(target_env = "musl", target_os = "emscripten"))] __align: [*const ::c_void; 0], - #[cfg(not(any(target_env = "musl")))] + #[cfg(not(any(target_env = "musl", target_os = "emscripten")))] __align: [::c_longlong; 0], size: [u8; __SIZEOF_PTHREAD_COND_T], } diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index ce198aca9285e..fd500568d99f2 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -109,6 +109,8 @@ s! { } } +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; + pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index 2b7cb8dc8a1ec..291fbb2870e8d 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -109,6 +109,8 @@ s! { } } +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; + pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index 23c1a267e664a..61802eebbe5fc 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -117,6 +117,8 @@ s! { } } +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; + pub const O_DIRECT: ::c_int = 0o100000; pub const O_DIRECTORY: ::c_int = 0o200000; pub const O_NOFOLLOW: ::c_int = 0o400000; diff --git a/src/unix/notbsd/linux/musl/b32/mod.rs b/src/unix/notbsd/linux/musl/b32/mod.rs index 61eb6dba17414..4a9a6877ac563 100644 --- a/src/unix/notbsd/linux/musl/b32/mod.rs +++ b/src/unix/notbsd/linux/musl/b32/mod.rs @@ -4,7 +4,10 @@ pub type nlink_t = u32; s! { pub struct pthread_attr_t { - __size: [u32; 9] + #[cfg(target_os = "emscripten")] + __size: [u32; 11], + #[cfg(not(target_os = "emscripten"))] + __size: [u32; 9], } pub struct sigset_t { @@ -33,7 +36,6 @@ s! { } pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; cfg_if! { if #[cfg(any(target_arch = "x86"))] { diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 9daeb58b99869..65421f140403a 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -122,6 +122,8 @@ s! { } } +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; + pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; From 084e47313ff4b2dd95ac2db893064ab6e7da4db9 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 17:54:07 -0300 Subject: [PATCH 06/19] Fix loff_t, ino_t, off_t, blkcnt_t, blksize_t, fsblkcnt_t, fsfilcnt_t definitions for emscripten --- src/unix/notbsd/android/mod.rs | 1 + src/unix/notbsd/linux/mips/mod.rs | 2 ++ src/unix/notbsd/linux/musl/b32/arm.rs | 7 +++++++ src/unix/notbsd/linux/musl/b32/asmjs.rs | 7 +++++++ src/unix/notbsd/linux/musl/b32/mips.rs | 7 +++++++ src/unix/notbsd/linux/musl/b32/x86.rs | 7 +++++++ src/unix/notbsd/linux/musl/b64/mod.rs | 7 +++++++ src/unix/notbsd/linux/musl/mod.rs | 7 ------- src/unix/notbsd/linux/other/mod.rs | 1 + src/unix/notbsd/linux/s390x.rs | 1 + src/unix/notbsd/mod.rs | 1 - 11 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 547d8327dbb90..4fd8ad6ac63e1 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -6,6 +6,7 @@ pub type clock_t = ::c_long; pub type time_t = ::c_long; pub type suseconds_t = ::c_long; pub type off_t = ::c_long; +pub type loff_t = ::c_longlong; pub type blkcnt_t = ::c_ulong; pub type blksize_t = ::c_ulong; pub type nlink_t = u32; diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs index 7b1c15e2fd931..74f4af3b5a63d 100644 --- a/src/unix/notbsd/linux/mips/mod.rs +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -1,3 +1,5 @@ +pub type loff_t = ::c_longlong; + pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; pub const SFD_CLOEXEC: ::c_int = 0x080000; diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index fd500568d99f2..ef44b526a354b 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -1,5 +1,12 @@ pub type c_char = u8; pub type wchar_t = u32; +pub type loff_t = ::c_longlong; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; +pub type blksize_t = c_long; +pub type fsblkcnt_t = ::c_ulonglong; +pub type fsfilcnt_t = ::c_ulonglong; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index 291fbb2870e8d..0d47e5f67850c 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -1,5 +1,12 @@ pub type c_char = i8; pub type wchar_t = i32; +pub type loff_t = i32; +pub type ino_t = u32; +pub type off_t = i32; +pub type blkcnt_t = i32; +pub type blksize_t = i32; +pub type fsblkcnt_t = u32; +pub type fsfilcnt_t = u32; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index 61802eebbe5fc..b8d10ee07fb7a 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -1,5 +1,12 @@ pub type c_char = i8; pub type wchar_t = ::c_int; +pub type loff_t = ::c_longlong; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; +pub type blksize_t = c_long; +pub type fsblkcnt_t = ::c_ulonglong; +pub type fsfilcnt_t = ::c_ulonglong; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 65421f140403a..6ba39fa8a2985 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -1,5 +1,12 @@ pub type c_char = i8; pub type wchar_t = i32; +pub type loff_t = ::c_longlong; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; +pub type blksize_t = c_long; +pub type fsblkcnt_t = ::c_ulonglong; +pub type fsfilcnt_t = ::c_ulonglong; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index fab0b58fed9b7..efdecad5f1815 100644 --- a/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -2,6 +2,13 @@ pub type wchar_t = i32; pub type c_long = i64; pub type c_ulong = u64; pub type nlink_t = u64; +pub type loff_t = ::c_longlong; +pub type ino_t = u64; +pub type off_t = i64; +pub type blkcnt_t = i64; +pub type blksize_t = c_long; +pub type fsblkcnt_t = ::c_ulonglong; +pub type fsfilcnt_t = ::c_ulonglong; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs index b365028b76aca..f781146e500a3 100644 --- a/src/unix/notbsd/linux/musl/mod.rs +++ b/src/unix/notbsd/linux/musl/mod.rs @@ -1,13 +1,6 @@ pub type clock_t = c_long; pub type time_t = c_long; pub type suseconds_t = c_long; -pub type ino_t = u64; -pub type off_t = i64; -pub type blkcnt_t = i64; - -pub type blksize_t = c_long; -pub type fsblkcnt_t = ::c_ulonglong; -pub type fsfilcnt_t = ::c_ulonglong; pub type rlim_t = ::c_ulonglong; s! { diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index b7a11a85e9627..67feab2876408 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -1,3 +1,4 @@ +pub type loff_t = ::c_longlong; pub type fsblkcnt_t = ::c_ulong; pub type fsfilcnt_t = ::c_ulong; pub type rlim_t = c_ulong; diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs index 1c0cd56d6f14c..990db5c5997eb 100644 --- a/src/unix/notbsd/linux/s390x.rs +++ b/src/unix/notbsd/linux/s390x.rs @@ -8,6 +8,7 @@ pub type fsfilcnt_t = u64; pub type ino_t = u64; pub type nlink_t = u64; pub type off_t = i64; +pub type loff_t = ::c_longlong; pub type rlim_t = u64; pub type suseconds_t = i64; pub type time_t = i64; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 9c95b340a351a..d6dc2bc72f84d 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -4,7 +4,6 @@ pub type sa_family_t = u16; pub type pthread_key_t = ::c_uint; pub type speed_t = ::c_uint; pub type tcflag_t = ::c_uint; -pub type loff_t = ::c_longlong; pub type clockid_t = ::c_int; pub type key_t = ::c_int; pub type id_t = ::c_uint; From 66c7d0543fc4a56e89578b7e9e599cd949283106 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 18:31:01 -0300 Subject: [PATCH 07/19] Fix dev_t, ino64_t, off64_t, blkcnt64_t definitions for emscripten --- src/unix/notbsd/linux/mips/mod.rs | 4 ++ src/unix/notbsd/linux/mod.rs | 56 ++++++++++++++++--------- src/unix/notbsd/linux/musl/b32/arm.rs | 4 ++ src/unix/notbsd/linux/musl/b32/asmjs.rs | 4 ++ src/unix/notbsd/linux/musl/b32/mips.rs | 4 ++ src/unix/notbsd/linux/musl/b32/x86.rs | 4 ++ src/unix/notbsd/linux/musl/b64/mod.rs | 4 ++ src/unix/notbsd/linux/other/mod.rs | 4 ++ src/unix/notbsd/linux/s390x.rs | 4 ++ 9 files changed, 69 insertions(+), 19 deletions(-) diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs index 74f4af3b5a63d..61838ef96bdd8 100644 --- a/src/unix/notbsd/linux/mips/mod.rs +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -1,4 +1,8 @@ pub type loff_t = ::c_longlong; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 03d01f1ce09f7..3be3cdaa3e703 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -3,13 +3,9 @@ use dox::{mem, Option}; pub type useconds_t = u32; -pub type dev_t = u64; pub type socklen_t = u32; pub type pthread_t = c_ulong; pub type mode_t = u32; -pub type ino64_t = u64; -pub type off64_t = i64; -pub type blkcnt64_t = i64; pub type rlim64_t = u64; pub type shmatt_t = ::c_ulong; pub type mqd_t = ::c_int; @@ -743,32 +739,54 @@ f! { set1.bits == set2.bits } - pub fn major(dev: ::dev_t) -> ::c_uint { - let mut major = 0; - major |= (dev & 0x00000000000fff00) >> 8; - major |= (dev & 0xfffff00000000000) >> 32; - major as ::c_uint - } - - pub fn minor(dev: ::dev_t) -> ::c_uint { - let mut minor = 0; - minor |= (dev & 0xfffff00000000000) >> 0; - minor |= (dev & 0x00000ffffff00000) >> 12; - minor as ::c_uint - } - pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t { let major = major as ::dev_t; let minor = minor as ::dev_t; let mut dev = 0; dev |= (major & 0x00000fff) << 8; - dev |= (major & 0xfffff000) << 32; + dev |= (major & 0xfffff000) << 31 << 1; // avoid exceeding_bitshifts dev |= (minor & 0x000000ff) << 0; dev |= (minor & 0xffffff00) << 12; dev } } +cfg_if! { + if #[cfg(target_os = "emscripten")] { + f! { + pub fn major(dev: ::dev_t) -> ::c_uint { + let mut major = 0; + major |= (dev & 0x00000fff) >> 8; + major |= (dev & 0xfffff000) >> 31 >> 1; // avoid exceeding_bitshifts + major as ::c_uint + } + + pub fn minor(dev: ::dev_t) -> ::c_uint { + let mut minor = 0; + minor |= (dev & 0x000000ff) >> 0; + minor |= (dev & 0xffffff00) >> 12; + minor as ::c_uint + } + } + } else { + f! { + pub fn major(dev: ::dev_t) -> ::c_uint { + let mut major = 0; + major |= (dev & 0x00000000000fff00) >> 8; + major |= (dev & 0xfffff00000000000) >> 32; + major as ::c_uint + } + + pub fn minor(dev: ::dev_t) -> ::c_uint { + let mut minor = 0; + minor |= (dev & 0xfffff00000000000) >> 0; + minor |= (dev & 0x00000ffffff00000) >> 12; + minor as ::c_uint + } + } + } +} + extern { pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index ef44b526a354b..918f6748c0e1c 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -7,6 +7,10 @@ pub type blkcnt_t = i64; pub type blksize_t = c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index 0d47e5f67850c..0eb808476cd8c 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -7,6 +7,10 @@ pub type blkcnt_t = i32; pub type blksize_t = i32; pub type fsblkcnt_t = u32; pub type fsfilcnt_t = u32; +pub type dev_t = u32; +pub type ino64_t = u32; +pub type off64_t = i32; +pub type blkcnt64_t = i32; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index b8d10ee07fb7a..d9187636466c8 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -7,6 +7,10 @@ pub type blkcnt_t = i64; pub type blksize_t = c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 6ba39fa8a2985..403443092f363 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -7,6 +7,10 @@ pub type blkcnt_t = i64; pub type blksize_t = c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index efdecad5f1815..c6cd3e8121bef 100644 --- a/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -9,6 +9,10 @@ pub type blkcnt_t = i64; pub type blksize_t = c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; s! { pub struct stat { diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 67feab2876408..3c668e2173d80 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -3,6 +3,10 @@ pub type fsblkcnt_t = ::c_ulong; pub type fsfilcnt_t = ::c_ulong; pub type rlim_t = c_ulong; pub type __priority_which_t = ::c_uint; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; s! { pub struct aiocb { diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs index 990db5c5997eb..4bea3049d11fd 100644 --- a/src/unix/notbsd/linux/s390x.rs +++ b/src/unix/notbsd/linux/s390x.rs @@ -17,6 +17,10 @@ pub type greg_t = u64; pub type clock_t = i64; pub type __fsword_t = ::c_long; pub type __priority_which_t = ::c_uint; +pub type dev_t = u64; +pub type ino64_t = u64; +pub type off64_t = i64; +pub type blkcnt64_t = i64; s! { pub struct aiocb { From d87405d76a5f8a9010cbb09a0ff70539ee1e2cee Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 18:34:16 -0300 Subject: [PATCH 08/19] Fix POSIX_MADV_DONTNEED definition for emscripten --- src/unix/notbsd/linux/musl/b32/arm.rs | 4 +++- src/unix/notbsd/linux/musl/b32/asmjs.rs | 2 ++ src/unix/notbsd/linux/musl/b32/mips.rs | 4 +++- src/unix/notbsd/linux/musl/b32/x86.rs | 4 +++- src/unix/notbsd/linux/musl/b64/mod.rs | 4 +++- src/unix/notbsd/linux/musl/mod.rs | 3 +-- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index 918f6748c0e1c..788a656a94634 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -4,7 +4,7 @@ pub type loff_t = ::c_longlong; pub type ino_t = u64; pub type off_t = i64; pub type blkcnt_t = i64; -pub type blksize_t = c_long; +pub type blksize_t = ::c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; pub type dev_t = u64; @@ -249,6 +249,8 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const ERFKILL: ::c_int = 132; pub const EHWPOISON: ::c_int = 133; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + pub const SO_REUSEADDR: ::c_int = 2; pub const SO_TYPE: ::c_int = 3; pub const SO_ERROR: ::c_int = 4; diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index 0eb808476cd8c..d115595c3c7c1 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -249,6 +249,8 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const ERFKILL: ::c_int = 132; pub const EHWPOISON: ::c_int = 133; +pub const POSIX_MADV_DONTNEED: ::c_int = 0; + pub const SO_REUSEADDR: ::c_int = 2; pub const SO_TYPE: ::c_int = 3; pub const SO_ERROR: ::c_int = 4; diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index d9187636466c8..a1bd048f0bed4 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -4,7 +4,7 @@ pub type loff_t = ::c_longlong; pub type ino_t = u64; pub type off_t = i64; pub type blkcnt_t = i64; -pub type blksize_t = c_long; +pub type blksize_t = ::c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; pub type dev_t = u64; @@ -251,6 +251,8 @@ pub const ENOTRECOVERABLE: ::c_int = 166; pub const EHWPOISON: ::c_int = 168; pub const ERFKILL: ::c_int = 167; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + pub const SOCK_STREAM: ::c_int = 2; pub const SOCK_DGRAM: ::c_int = 1; pub const SOCK_SEQPACKET: ::c_int = 5; diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 403443092f363..fdb79251e59ca 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -4,7 +4,7 @@ pub type loff_t = ::c_longlong; pub type ino_t = u64; pub type off_t = i64; pub type blkcnt_t = i64; -pub type blksize_t = c_long; +pub type blksize_t = ::c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; pub type dev_t = u64; @@ -262,6 +262,8 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const ERFKILL: ::c_int = 132; pub const EHWPOISON: ::c_int = 133; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + pub const SO_REUSEADDR: ::c_int = 2; pub const SO_TYPE: ::c_int = 3; pub const SO_ERROR: ::c_int = 4; diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index c6cd3e8121bef..2a319b9d8e4ca 100644 --- a/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -6,7 +6,7 @@ pub type loff_t = ::c_longlong; pub type ino_t = u64; pub type off_t = i64; pub type blkcnt_t = i64; -pub type blksize_t = c_long; +pub type blksize_t = ::c_long; pub type fsblkcnt_t = ::c_ulonglong; pub type fsfilcnt_t = ::c_ulonglong; pub type dev_t = u64; @@ -276,6 +276,8 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const ERFKILL: ::c_int = 132; pub const EHWPOISON: ::c_int = 133; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; + pub const SO_REUSEADDR: ::c_int = 2; pub const SO_TYPE: ::c_int = 3; pub const SO_ERROR: ::c_int = 4; diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs index f781146e500a3..593023fb2a02d 100644 --- a/src/unix/notbsd/linux/musl/mod.rs +++ b/src/unix/notbsd/linux/musl/mod.rs @@ -124,10 +124,9 @@ pub const O_ACCMODE: ::c_int = 0o10000003; pub const O_NDELAY: ::c_int = O_NONBLOCK; pub const NI_MAXHOST: ::socklen_t = 255; pub const PTHREAD_STACK_MIN: ::size_t = 2048; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; -pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const RLIM_INFINITY: ::rlim_t = !0; pub const RLIMIT_RTTIME: ::c_int = 15; From cd0049206796e453b31c8aa547dd3f6681cb3821 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 19:19:22 -0300 Subject: [PATCH 09/19] Enavle travis tests for emscripten --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index b7721b5e6049f..fbd4753c9826e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -101,6 +101,12 @@ matrix: - os: linux env: TARGET=mips-unknown-linux-gnu rust: beta + - os: linux + env: TARGET=asmjs-unknown-emscripten + rust: stable + - os: linux + env: TARGET=wasm32-unknown-emscripten + rust: stable # beta - os: linux From 6cd1dd330e677e8ce6306171455014aeb2f8fcf0 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 21:05:26 -0300 Subject: [PATCH 10/19] Fix style --- src/unix/notbsd/android/mod.rs | 1 + src/unix/notbsd/linux/mips/mod.rs | 1 + src/unix/notbsd/linux/mod.rs | 76 ++++++++++++++----------- src/unix/notbsd/linux/musl/b32/arm.rs | 1 + src/unix/notbsd/linux/musl/b32/asmjs.rs | 1 + src/unix/notbsd/linux/musl/b32/mips.rs | 1 + src/unix/notbsd/linux/musl/b32/x86.rs | 1 + src/unix/notbsd/linux/musl/b64/mod.rs | 1 + src/unix/notbsd/linux/other/mod.rs | 2 + src/unix/notbsd/linux/s390x.rs | 1 + src/unix/notbsd/mod.rs | 5 -- 11 files changed, 54 insertions(+), 37 deletions(-) diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 4fd8ad6ac63e1..af8c51c9cbadc 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -149,6 +149,7 @@ s! { } pub const O_TRUNC: ::c_int = 512; +pub const O_TMPFILE: ::c_int = 0o20000000 | ::O_DIRECTORY; pub const O_CLOEXEC: ::c_int = 0x80000; diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs index 61838ef96bdd8..9b861ea70b23b 100644 --- a/src/unix/notbsd/linux/mips/mod.rs +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -49,6 +49,7 @@ pub const O_ACCMODE: ::c_int = 3; pub const O_DIRECT: ::c_int = 0x8000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const ST_RELATIME: ::c_ulong = 4096; pub const NI_MAXHOST: ::socklen_t = 1025; diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 3be3cdaa3e703..4572270cec220 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -744,46 +744,58 @@ f! { let minor = minor as ::dev_t; let mut dev = 0; dev |= (major & 0x00000fff) << 8; - dev |= (major & 0xfffff000) << 31 << 1; // avoid exceeding_bitshifts + dev |= (major & 0xfffff000) << 31 << 1; // allow exceeding_bitshifts dev |= (minor & 0x000000ff) << 0; dev |= (minor & 0xffffff00) << 12; dev } -} -cfg_if! { - if #[cfg(target_os = "emscripten")] { - f! { - pub fn major(dev: ::dev_t) -> ::c_uint { - let mut major = 0; - major |= (dev & 0x00000fff) >> 8; - major |= (dev & 0xfffff000) >> 31 >> 1; // avoid exceeding_bitshifts - major as ::c_uint - } - - pub fn minor(dev: ::dev_t) -> ::c_uint { - let mut minor = 0; - minor |= (dev & 0x000000ff) >> 0; - minor |= (dev & 0xffffff00) >> 12; - minor as ::c_uint - } - } - } else { - f! { - pub fn major(dev: ::dev_t) -> ::c_uint { - let mut major = 0; - major |= (dev & 0x00000000000fff00) >> 8; - major |= (dev & 0xfffff00000000000) >> 32; - major as ::c_uint + pub fn major(dev: ::dev_t) -> ::c_uint { + cfg_if! { + if #[cfg(target_os = "emscripten")] { + // see + // https://github.com/kripken/emscripten/blob/ + // master/system/include/libc/sys/sysmacros.h + fn inner(dev: ::dev_t) -> ::c_uint { + let mut major = 0; + major |= (dev & 0x00000fff) >> 8; + major |= (dev & 0xfffff000) >> 31 >> 1; + major as ::c_uint + } + } else { + fn inner(dev: ::dev_t) -> ::c_uint { + let mut major = 0; + major |= (dev & 0x00000000000fff00) >> 8; + major |= (dev & 0xfffff00000000000) >> 32; + major as ::c_uint + } } + }; + inner(dev) + } - pub fn minor(dev: ::dev_t) -> ::c_uint { - let mut minor = 0; - minor |= (dev & 0xfffff00000000000) >> 0; - minor |= (dev & 0x00000ffffff00000) >> 12; - minor as ::c_uint + pub fn minor(dev: ::dev_t) -> ::c_uint { + cfg_if! { + if #[cfg(target_os = "emscripten")] { + // see + // https://github.com/kripken/emscripten/blob/ + // master/system/include/libc/sys/sysmacros.h + fn inner(dev: ::dev_t) -> ::c_uint { + let mut minor = 0; + minor |= (dev & 0x000000ff) >> 0; + minor |= (dev & 0xffffff00) >> 12; + minor as ::c_uint + } + } else { + fn inner(dev: ::dev_t) -> ::c_uint { + let mut minor = 0; + minor |= (dev & 0xfffff00000000000) >> 0; + minor |= (dev & 0x00000ffffff00000) >> 12; + minor as ::c_uint + } } - } + }; + inner(dev) } } diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index 788a656a94634..0399f58bd64eb 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -124,6 +124,7 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const O_NOFOLLOW: ::c_int = 0x20000; pub const O_ASYNC: ::c_int = 0x2000; diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index d115595c3c7c1..59ecbb555f6ec 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -124,6 +124,7 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_TMPFILE: ::c_int = 0o20000000; pub const O_NOFOLLOW: ::c_int = 0x20000; pub const O_ASYNC: ::c_int = 0x2000; diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index a1bd048f0bed4..deafa2b3ddc4f 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -132,6 +132,7 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; pub const O_DIRECT: ::c_int = 0o100000; pub const O_DIRECTORY: ::c_int = 0o200000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const O_NOFOLLOW: ::c_int = 0o400000; pub const O_ASYNC: ::c_int = 0o10000; diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index fdb79251e59ca..da8ccb6c87dcd 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -137,6 +137,7 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const O_NOFOLLOW: ::c_int = 0x20000; pub const O_ASYNC: ::c_int = 0x2000; diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index 2a319b9d8e4ca..8e1a2fd2ec4ca 100644 --- a/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -150,6 +150,7 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const O_NOFOLLOW: ::c_int = 0x20000; pub const O_ASYNC: ::c_int = 0x2000; diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 3c668e2173d80..ef4b6df69251e 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -174,6 +174,8 @@ s! { } } +pub const O_TMPFILE: ::c_int = 0o20000000 | ::O_DIRECTORY; + pub const __UT_LINESIZE: usize = 32; pub const __UT_NAMESIZE: usize = 32; pub const __UT_HOSTSIZE: usize = 256; diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs index 4bea3049d11fd..52557b7302edb 100644 --- a/src/unix/notbsd/linux/s390x.rs +++ b/src/unix/notbsd/linux/s390x.rs @@ -371,6 +371,7 @@ pub const O_FSYNC: ::c_int = 0x101000; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index d6dc2bc72f84d..ccbcca3b35e6d 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -255,11 +255,6 @@ pub const O_RDONLY: ::c_int = 0; pub const O_WRONLY: ::c_int = 1; pub const O_RDWR: ::c_int = 2; -#[cfg(target_os = "emscripten")] -pub const O_TMPFILE: ::c_int = 0o20000000; -#[cfg(not(target_os = "emscripten"))] -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; pub const S_IFIFO: ::mode_t = 4096; From 8f88b6ddcc8f093243b3e5650448dae014ab6c00 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 21:05:36 -0300 Subject: [PATCH 11/19] Hide output of emsdk installation --- ci/emscripten.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ci/emscripten.sh b/ci/emscripten.sh index 1a20643bb4ef9..8aa5a98d7fc52 100644 --- a/ci/emscripten.sh +++ b/ci/emscripten.sh @@ -10,13 +10,30 @@ set -ex +hide_output() { + set +x + on_err=" +echo ERROR: An error was encountered with the build. +cat /tmp/build.log +exit 1 +" + trap "$on_err" ERR + bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & + PING_LOOP_PID=$! + $@ &> /tmp/build.log + trap - ERR + kill $PING_LOOP_PID + rm -f /tmp/build.log + set -x +} + cd / curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ tar -xz cd /emsdk-portable ./emsdk update -./emsdk install sdk-1.37.13-64bit +hide_output ./emsdk install sdk-1.37.13-64bit ./emsdk activate sdk-1.37.13-64bit # Compile and cache libc From 4228e72eb179843d709ec723377fa8176ef4d06a Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 21:06:23 -0300 Subject: [PATCH 12/19] Change compiler to beta for emscripten (stable is failing) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbd4753c9826e..db838bce2ceed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,10 +103,10 @@ matrix: rust: beta - os: linux env: TARGET=asmjs-unknown-emscripten - rust: stable + rust: beta - os: linux env: TARGET=wasm32-unknown-emscripten - rust: stable + rust: beta # beta - os: linux From 5363161da10c6629e7af8a33ee600393a8b0a7c8 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 21:29:25 -0300 Subject: [PATCH 13/19] Fix __SIZEOF_PTHREAD_MUTEX_T for mips This was changed when emscripten test support was added --- src/unix/notbsd/linux/musl/b32/mips.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index deafa2b3ddc4f..2e92960f7a4df 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -128,7 +128,7 @@ s! { } } -pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; pub const O_DIRECT: ::c_int = 0o100000; pub const O_DIRECTORY: ::c_int = 0o200000; From b49cecf0b97bf4b854f63e6953dea4248726730d Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 21:30:34 -0300 Subject: [PATCH 14/19] Change compiler to stable for emscripten and skip some functions --- .travis.yml | 4 ++-- libc-test/build.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index db838bce2ceed..fbd4753c9826e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,10 +103,10 @@ matrix: rust: beta - os: linux env: TARGET=asmjs-unknown-emscripten - rust: beta + rust: stable - os: linux env: TARGET=wasm32-unknown-emscripten - rust: beta + rust: stable # beta - os: linux diff --git a/libc-test/build.rs b/libc-test/build.rs index 41953600b0dbe..362b39a87f772 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -460,7 +460,8 @@ fn main() { "setpgid" | "setpgrp" | "setspent" | "settimeofday" | "setxattr" | "shmat" | "shmctl" | "shmdt" | "shmget" | "sigaltstack" | "signalfd" | "sigsuspend" | "sigtimedwait" | "sigwait" | "sigwaitinfo" | "splice" | "sync_file_range" | - "syscall" | "sysinfo" | "tee" | "umount" | "umount2" | "unshare" | "vmsplice" + "syscall" | "sysinfo" | "tee" | "umount" | "umount2" | "unshare" | "vmsplice" | + "swapoff" | "vhangup" | "swapon" | "personality" if emscripten => true, // n if n.starts_with("epoll") && emscripten => true, From bf60a1464275f0388c342c859a0ae20edf75809d Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 8 Jun 2017 21:43:50 -0300 Subject: [PATCH 15/19] Disable wasm-unknown-emscripten tests on travis --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbd4753c9826e..e49bf13620b8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,9 +104,10 @@ matrix: - os: linux env: TARGET=asmjs-unknown-emscripten rust: stable - - os: linux - env: TARGET=wasm32-unknown-emscripten - rust: stable + # https://github.com/rust-lang/libc/pull/610#issuecomment-307264794 + #- os: linux + # env: TARGET=wasm32-unknown-emscripten + # rust: stable # beta - os: linux From 80fda850ef747766c4340001f04bd480e9c3adb1 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Tue, 13 Jun 2017 13:43:56 -0300 Subject: [PATCH 16/19] Remove some functions from emscripten whitelist --- libc-test/build.rs | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 362b39a87f772..45785d6a2b2e8 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -438,17 +438,16 @@ fn main() { "strerror_r" if linux => true, // actually xpg-something-or-other // not defined or fails to link - "aio_cancel" | "aio_error" | "aio_fsync" | "aio_read" | "aio_read_write" | "aio_return"| - "aio_suspend" | "aio_write" | "clock_nanosleep" | "clone" | "daemon" | "endspent" | - "epoll_create" | "epoll_create1" | "epoll_ctl" | "epoll_pwait" | "epoll_wait" | - "eventfd" | "faccessat" | "fallocate" | "fgetxattr" | "flistxattr" | "fork" | - "forkpty" | "fremovexattr" | "fsetxattr" | "ftok" | "futimes" | "getdtablesize" | - "getgrgid" | "getgrnam" | "getgroups" | "getpgid" | "getpgrp" | "getpwnam_r" | - "getpwuid_r" | "getspent" | "getspnam" | "getxattr" | "initgroups" | "lgetxattr" | - "listxattr" | "llistxattr" | "lremovexattr" | "lsetxattr" | "lutimes" | "mount" | - "mq_close" | "mq_getattr" | "mq_open" | "mq_receive" | "mq_send" | "mq_setattr" | - "mq_unlink" | "msgctl" | "msgget" | "msgrcv" | "msgsnd" | "pclose" | "popen" | - "ppoll" | "prctl" | "prlimit" | "prlimit64" | "process_vm_readv" | + "aio_cancel" | "aio_error" | "aio_fsync" | "aio_read" | "aio_return"| "aio_suspend" | + "aio_write" | "clock_nanosleep" | "clone" | "daemon" | "endspent" | "epoll_create" | + "epoll_create1" | "epoll_ctl" | "epoll_pwait" | "epoll_wait" | "eventfd" | + "faccessat" | "fallocate" | "fgetxattr" | "flistxattr" | "forkpty" | "fremovexattr" | + "fsetxattr" | "ftok" | "futimes" | "getdtablesize" | "getgrgid" | "getgrnam" | + "getpwnam_r" | "getpwuid_r" | "getspent" | "getspnam" | "getxattr" | "initgroups" | + "lgetxattr" | "listxattr" | "llistxattr" | "lremovexattr" | "lsetxattr" | "lutimes" | + "mount" | "mq_close" | "mq_getattr" | "mq_open" | "mq_receive" | "mq_send" | + "mq_setattr" | "mq_unlink" | "msgctl" | "msgget" | "msgrcv" | "msgsnd" | "pclose" | + "popen" | "ppoll" | "prctl" | "prlimit" | "prlimit64" | "process_vm_readv" | "process_vm_writev" | "pthread_atfork" | "pthread_attr_getguardsize" | "pthread_kill" | "pthread_mutexattr_getpshared" | "pthread_mutex_timedlock" | "pthread_sigmask" | "ptrace" | "quotactl" | "readahead" | "reboot" | "removexattr" | @@ -456,15 +455,19 @@ fn main() { "sched_get_priority_min" | "sched_getscheduler" | "sched_rr_get_interval" | "sched_setaffinity" | "sched_setparam" | "sched_setscheduler" | "sem_close" | "semctl" | "semget" | "semop" | "sem_open" | "sem_timedwait" | "sem_unlink" | - "sendfile" | "setfsgid" | "setfsuid" | "setgroups" | "sethostname" | "setns" | - "setpgid" | "setpgrp" | "setspent" | "settimeofday" | "setxattr" | "shmat" | - "shmctl" | "shmdt" | "shmget" | "sigaltstack" | "signalfd" | "sigsuspend" | - "sigtimedwait" | "sigwait" | "sigwaitinfo" | "splice" | "sync_file_range" | - "syscall" | "sysinfo" | "tee" | "umount" | "umount2" | "unshare" | "vmsplice" | - "swapoff" | "vhangup" | "swapon" | "personality" - if emscripten => true, - - // n if n.starts_with("epoll") && emscripten => true, + "sendfile" | "setfsgid" | "setfsuid" | "sethostname" | "setns" | "setspent" | + "settimeofday" | "setxattr" | "shmat" | "shmctl" | "shmdt" | "shmget" | + "sigaltstack" | "signalfd" | "sigsuspend" | "sigtimedwait" | "sigwait" | + "sigwaitinfo" | "splice" | "sync_file_range" | "sysinfo" | "tee" | "umount" | + "umount2" | "unshare" | "vmsplice" | "swapoff" | "vhangup" | "swapon" | + "personality" | "syscall" if emscripten => true, + + // fails on travis but works locally. why? + "getgroups" | "setgroups" if emscripten => true, + "setpgid" | "getpgid" if emscripten => true, + "setpgrp" | "getpgrp" if emscripten => true, + "fork" if emscripten => true, + // int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that // they match the interface defined by Linux verbatim, but they conflict with other From 97502e802451ec6bae3609cb2b612aec0bba718f Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Tue, 13 Jun 2017 18:40:28 -0300 Subject: [PATCH 17/19] Add recent added functions to wasm32 whitelist --- libc-test/build.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 45785d6a2b2e8..a444a2e24240b 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -450,6 +450,7 @@ fn main() { "popen" | "ppoll" | "prctl" | "prlimit" | "prlimit64" | "process_vm_readv" | "process_vm_writev" | "pthread_atfork" | "pthread_attr_getguardsize" | "pthread_kill" | "pthread_mutexattr_getpshared" | "pthread_mutex_timedlock" | + "pthread_getschedparam" | "pthread_setschedparam" | "pthread_setschedprio" | "pthread_sigmask" | "ptrace" | "quotactl" | "readahead" | "reboot" | "removexattr" | "sched_getaffinity" | "sched_getparam" | "sched_get_priority_max" | "sched_get_priority_min" | "sched_getscheduler" | "sched_rr_get_interval" | @@ -462,13 +463,6 @@ fn main() { "umount2" | "unshare" | "vmsplice" | "swapoff" | "vhangup" | "swapon" | "personality" | "syscall" if emscripten => true, - // fails on travis but works locally. why? - "getgroups" | "setgroups" if emscripten => true, - "setpgid" | "getpgid" if emscripten => true, - "setpgrp" | "getpgrp" if emscripten => true, - "fork" if emscripten => true, - - // int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that // they match the interface defined by Linux verbatim, but they conflict with other // send*/recv* syscalls From f22bfe3a66c2469ab606d5fa1134a3ed91873cf3 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Tue, 20 Jun 2017 17:31:20 -0300 Subject: [PATCH 18/19] Update emscripten to sdk-1.37.14-64bit --- ci/emscripten.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/emscripten.sh b/ci/emscripten.sh index 8aa5a98d7fc52..0ca578a6c3d3c 100644 --- a/ci/emscripten.sh +++ b/ci/emscripten.sh @@ -33,8 +33,8 @@ curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portabl cd /emsdk-portable ./emsdk update -hide_output ./emsdk install sdk-1.37.13-64bit -./emsdk activate sdk-1.37.13-64bit +hide_output ./emsdk install sdk-1.37.14-64bit +./emsdk activate sdk-1.37.14-64bit # Compile and cache libc source ./emsdk_env.sh From 52f1b31d97fccd0cd5920c0a21fde368f793128c Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Tue, 20 Jun 2017 20:48:17 -0300 Subject: [PATCH 19/19] Enable travis tests for wasm32 https://github.com/kripken/emscripten/issues/5288 is fixed now. --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e49bf13620b8d..fbd4753c9826e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,10 +104,9 @@ matrix: - os: linux env: TARGET=asmjs-unknown-emscripten rust: stable - # https://github.com/rust-lang/libc/pull/610#issuecomment-307264794 - #- os: linux - # env: TARGET=wasm32-unknown-emscripten - # rust: stable + - os: linux + env: TARGET=wasm32-unknown-emscripten + rust: stable # beta - os: linux