Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libc to 0.2.21 #40317

Merged
merged 4 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/liblibc
Submodule liblibc updated 43 files
+6 −0 .travis.yml
+2 −2 Cargo.lock
+1 −1 Cargo.toml
+0 −0 ci/android-accept-licenses.sh
+17 −2 ci/android-install-ndk.sh
+28 −8 ci/android-install-sdk.sh
+32 −0 ci/docker/aarch64-linux-android/Dockerfile
+9 −11 ci/docker/arm-linux-androideabi/Dockerfile
+32 −0 ci/docker/i686-linux-android/Dockerfile
+2 −1 ci/run-docker.sh
+9 −4 ci/run.sh
+7 −3 libc-test/build.rs
+142 −10 src/unix/bsd/apple/mod.rs
+28 −2 src/unix/bsd/freebsdlike/dragonfly/mod.rs
+46 −1 src/unix/bsd/freebsdlike/freebsd/mod.rs
+121 −1 src/unix/bsd/freebsdlike/mod.rs
+72 −1 src/unix/bsd/mod.rs
+97 −1 src/unix/bsd/netbsdlike/mod.rs
+42 −0 src/unix/bsd/netbsdlike/netbsd/mod.rs
+44 −0 src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+44 −1 src/unix/haiku/mod.rs
+17 −75 src/unix/mod.rs
+6 −0 src/unix/notbsd/android/b32/arm.rs
+45 −0 src/unix/notbsd/android/b32/mod.rs
+6 −0 src/unix/notbsd/android/b32/x86.rs
+42 −1 src/unix/notbsd/android/b64/mod.rs
+69 −79 src/unix/notbsd/android/mod.rs
+90 −16 src/unix/notbsd/linux/mips/mod.rs
+57 −1 src/unix/notbsd/linux/mod.rs
+9 −0 src/unix/notbsd/linux/musl/b32/arm.rs
+16 −7 src/unix/notbsd/linux/musl/b32/mips.rs
+9 −0 src/unix/notbsd/linux/musl/b32/x86.rs
+9 −0 src/unix/notbsd/linux/musl/b64/mod.rs
+34 −0 src/unix/notbsd/linux/musl/mod.rs
+34 −0 src/unix/notbsd/linux/other/b32/arm.rs
+42 −1 src/unix/notbsd/linux/other/b32/powerpc.rs
+40 −0 src/unix/notbsd/linux/other/b32/x86.rs
+77 −6 src/unix/notbsd/linux/other/b64/aarch64.rs
+78 −6 src/unix/notbsd/linux/other/b64/powerpc64.rs
+77 −6 src/unix/notbsd/linux/other/b64/x86_64.rs
+12 −0 src/unix/notbsd/linux/other/mod.rs
+124 −6 src/unix/notbsd/mod.rs
+45 −1 src/unix/solaris/mod.rs
10 changes: 6 additions & 4 deletions src/libstd/os/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@

use fmt;

#[cfg(any(target_os = "android",
target_os = "emscripten",
#[cfg(any(target_os = "emscripten",
all(target_os = "linux", any(target_arch = "aarch64",
target_arch = "arm",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "s390x")),
all(target_os = "android", any(target_arch = "aarch64",
target_arch = "arm")),
all(target_os = "fuchsia", target_arch = "aarch64")))]
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
#[cfg(not(any(target_os = "android",
target_os = "emscripten",
#[cfg(not(any(target_os = "emscripten",
all(target_os = "linux", any(target_arch = "aarch64",
target_arch = "arm",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "s390x")),
all(target_os = "android", any(target_arch = "aarch64",
target_arch = "arm")),
all(target_os = "fuchsia", target_arch = "aarch64"))))]
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8;
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/unix/ext/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ impl UnixListener {
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
let (addr, len) = sockaddr_un(path)?;

cvt(libc::bind(*inner.as_inner(), &addr as *const _ as *const _, len))?;
cvt(libc::bind(*inner.as_inner(), &addr as *const _ as *const _, len as _))?;
cvt(libc::listen(*inner.as_inner(), 128))?;

Ok(UnixListener(inner))
Expand Down Expand Up @@ -920,7 +920,7 @@ impl UnixDatagram {
let socket = UnixDatagram::unbound()?;
let (addr, len) = sockaddr_un(path)?;

cvt(libc::bind(*socket.0.as_inner(), &addr as *const _ as *const _, len))?;
cvt(libc::bind(*socket.0.as_inner(), &addr as *const _ as *const _, len as _))?;

Ok(socket)
}
Expand Down
16 changes: 15 additions & 1 deletion src/libstd/sys/unix/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,26 @@ mod tests {
}
}

// Android with api less than 21 define sig* functions inline, so it is not
// available for dynamic link. Implementing sigemptyset and sigaddset allow us
// to support older Android version (independent of libc version).
// The following implementations are based on https://git.io/vSkNf

#[cfg(not(target_os = "android"))]
extern {
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
fn sigemptyset(set: *mut libc::sigset_t) -> libc::c_int;

#[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_int;
}

#[cfg(target_os = "android")]
unsafe fn sigemptyset(set: *mut libc::sigset_t) -> libc::c_int {
libc::memset(set as *mut _, 0, mem::size_of::<libc::sigset_t>());
return 0;
}

#[cfg(target_os = "android")]
unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_int {
use slice;
Expand Down Expand Up @@ -450,7 +464,7 @@ mod tests {

let mut set: libc::sigset_t = mem::uninitialized();
let mut old_set: libc::sigset_t = mem::uninitialized();
t!(cvt(libc::sigemptyset(&mut set)));
t!(cvt(sigemptyset(&mut set)));
t!(cvt(sigaddset(&mut set, libc::SIGINT)));
t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set, &mut old_set)));

Expand Down
11 changes: 10 additions & 1 deletion src/libstd/sys/unix/process/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,16 @@ impl Command {
// need to clean things up now to avoid confusing the program
// we're about to run.
let mut set: libc::sigset_t = mem::uninitialized();
t!(cvt(libc::sigemptyset(&mut set)));
if cfg!(target_os = "android") {
// Implementing sigemptyset allow us to support older Android
// versions. See the comment about Android and sig* functions in
// process_common.rs
libc::memset(&mut set as *mut _ as *mut _,
0,
mem::size_of::<libc::sigset_t>());
} else {
t!(cvt(libc::sigemptyset(&mut set)));
}
t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set,
ptr::null_mut())));
let ret = sys::signal(libc::SIGPIPE, libc::SIG_DFL);
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys_common/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ impl TcpListener {

// Bind our new socket
let (addrp, len) = addr.into_inner();
cvt(unsafe { c::bind(*sock.as_inner(), addrp, len) })?;
cvt(unsafe { c::bind(*sock.as_inner(), addrp, len as _) })?;

// Start listening
cvt(unsafe { c::listen(*sock.as_inner(), 128) })?;
Expand Down Expand Up @@ -430,7 +430,7 @@ impl UdpSocket {

let sock = Socket::new(addr, c::SOCK_DGRAM)?;
let (addrp, len) = addr.into_inner();
cvt(unsafe { c::bind(*sock.as_inner(), addrp, len) })?;
cvt(unsafe { c::bind(*sock.as_inner(), addrp, len as _) })?;
Ok(UdpSocket { inner: sock })
}

Expand Down