Skip to content

Commit

Permalink
Update emscripten functions declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Oct 17, 2019
1 parent 01008e4 commit 6de4924
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
34 changes: 2 additions & 32 deletions src/libstd/sys/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,7 @@ impl FileDesc {
#[cfg(target_os = "android")]
use super::android::cvt_pread64;

#[cfg(target_os = "emscripten")]
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
-> io::Result<isize>
{
use crate::convert::TryInto;
use libc::pread64;
// pread64 on emscripten actually takes a 32 bit offset
if let Ok(o) = offset.try_into() {
cvt(pread64(fd, buf, count, o))
} else {
Err(io::Error::new(io::ErrorKind::InvalidInput,
"cannot pread >2GB"))
}
}

#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
#[cfg(not(target_os = "android"))]
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
-> io::Result<isize>
{
Expand Down Expand Up @@ -128,22 +113,7 @@ impl FileDesc {
#[cfg(target_os = "android")]
use super::android::cvt_pwrite64;

#[cfg(target_os = "emscripten")]
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
-> io::Result<isize>
{
use crate::convert::TryInto;
use libc::pwrite64;
// pwrite64 on emscripten actually takes a 32 bit offset
if let Ok(o) = offset.try_into() {
cvt(pwrite64(fd, buf, count, o))
} else {
Err(io::Error::new(io::ErrorKind::InvalidInput,
"cannot pwrite >2GB"))
}
}

#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
#[cfg(not(target_os = "android"))]
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
-> io::Result<isize>
{
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,6 @@ impl File {
SeekFrom::End(off) => (libc::SEEK_END, off),
SeekFrom::Current(off) => (libc::SEEK_CUR, off),
};
#[cfg(target_os = "emscripten")]
let pos = pos as i32;
let n = cvt(unsafe { lseek64(self.0.raw(), pos, whence) })?;
Ok(n as u64)
}
Expand Down

0 comments on commit 6de4924

Please sign in to comment.