Update emscripten functions declarations
This commit is contained in:
parent
01008e4cd6
commit
6de4924b6c
2 changed files with 2 additions and 34 deletions
|
@ -71,22 +71,7 @@ impl FileDesc {
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
use super::android::cvt_pread64;
|
use super::android::cvt_pread64;
|
||||||
|
|
||||||
#[cfg(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>
|
|
||||||
{
|
|
||||||
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")))]
|
|
||||||
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
|
unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64)
|
||||||
-> io::Result<isize>
|
-> io::Result<isize>
|
||||||
{
|
{
|
||||||
|
@ -128,22 +113,7 @@ impl FileDesc {
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
use super::android::cvt_pwrite64;
|
use super::android::cvt_pwrite64;
|
||||||
|
|
||||||
#[cfg(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>
|
|
||||||
{
|
|
||||||
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")))]
|
|
||||||
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
|
unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64)
|
||||||
-> io::Result<isize>
|
-> io::Result<isize>
|
||||||
{
|
{
|
||||||
|
|
|
@ -602,8 +602,6 @@ impl File {
|
||||||
SeekFrom::End(off) => (libc::SEEK_END, off),
|
SeekFrom::End(off) => (libc::SEEK_END, off),
|
||||||
SeekFrom::Current(off) => (libc::SEEK_CUR, 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) })?;
|
let n = cvt(unsafe { lseek64(self.0.raw(), pos, whence) })?;
|
||||||
Ok(n as u64)
|
Ok(n as u64)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue