Skip to content

Commit e5b123c

Browse files
committed
Update the libc submodule
Brings in a few fixes for wasm/asmjs
1 parent eb8f258 commit e5b123c

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

src/liblibc

Submodule liblibc updated 83 files

src/libstd/os/raw.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515
use fmt;
1616

17-
#[cfg(any(target_os = "emscripten",
18-
all(target_os = "linux", any(target_arch = "aarch64",
17+
#[cfg(any(all(target_os = "linux", any(target_arch = "aarch64",
1918
target_arch = "arm",
2019
target_arch = "powerpc",
2120
target_arch = "powerpc64",
@@ -24,8 +23,7 @@ use fmt;
2423
target_arch = "arm")),
2524
all(target_os = "fuchsia", target_arch = "aarch64")))]
2625
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
27-
#[cfg(not(any(target_os = "emscripten",
28-
all(target_os = "linux", any(target_arch = "aarch64",
26+
#[cfg(not(any(all(target_os = "linux", any(target_arch = "aarch64",
2927
target_arch = "arm",
3028
target_arch = "powerpc",
3129
target_arch = "powerpc64",

src/libstd/sys/unix/fd.rs

+22-6
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,21 @@ impl FileDesc {
7171
#[cfg(target_os = "android")]
7272
use super::android::cvt_pread64;
7373

74-
#[cfg(not(target_os = "android"))]
74+
#[cfg(target_os = "emscripten")]
7575
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
7676
-> io::Result<isize>
7777
{
78-
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
7978
use libc::pread64;
80-
#[cfg(not(any(target_os = "linux", target_os = "emscripten")))]
79+
cvt(pread64(fd, buf, count, offset as i32))
80+
}
81+
82+
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
83+
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
84+
-> io::Result<isize>
85+
{
86+
#[cfg(target_os = "linux")]
87+
use libc::pread64;
88+
#[cfg(not(target_os = "linux"))]
8189
use libc::pread as pread64;
8290
cvt(pread64(fd, buf, count, offset))
8391
}
@@ -104,13 +112,21 @@ impl FileDesc {
104112
#[cfg(target_os = "android")]
105113
use super::android::cvt_pwrite64;
106114

107-
#[cfg(not(target_os = "android"))]
115+
#[cfg(target_os = "emscripten")]
116+
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
117+
-> io::Result<isize>
118+
{
119+
use libc::pwrite64;
120+
cvt(pwrite64(fd, buf, count, offset as i32))
121+
}
122+
123+
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
108124
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
109125
-> io::Result<isize>
110126
{
111-
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
127+
#[cfg(target_os = "linux")]
112128
use libc::pwrite64;
113-
#[cfg(not(any(target_os = "linux", target_os = "emscripten")))]
129+
#[cfg(not(target_os = "linux"))]
114130
use libc::pwrite as pwrite64;
115131
cvt(pwrite64(fd, buf, count, offset))
116132
}

src/libstd/sys/unix/fs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ impl File {
514514
SeekFrom::End(off) => (libc::SEEK_END, off),
515515
SeekFrom::Current(off) => (libc::SEEK_CUR, off),
516516
};
517+
#[cfg(target_os = "emscripten")]
518+
let pos = pos as i32;
517519
let n = cvt(unsafe { lseek64(self.0.raw(), pos, whence) })?;
518520
Ok(n as u64)
519521
}

src/libstd/sys/unix/process/process_unix.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use io::{self, Error, ErrorKind};
1212
use libc::{self, c_int, gid_t, pid_t, uid_t};
13-
use mem;
1413
use ptr;
1514

1615
use sys::cvt;
@@ -184,7 +183,9 @@ impl Command {
184183
}
185184

186185
// NaCl has no signal support.
187-
if cfg!(not(any(target_os = "nacl", target_os = "emscripten"))) {
186+
#[cfg(not(any(target_os = "nacl", target_os = "emscripten")))]
187+
{
188+
use mem;
188189
// Reset signal handling so the child process starts in a
189190
// standardized state. libstd ignores SIGPIPE, and signal-handling
190191
// libraries often set a mask. Child processes inherit ignored

0 commit comments

Comments
 (0)