about summary refs log tree commit diff
path: root/library/std/src/sys/unix/fd.rs
diff options
context:
space:
mode:
authorScott Mabin <scott@mabez.dev>2022-04-07 12:07:46 +0100
committerScott Mabin <scott@mabez.dev>2022-04-19 17:00:09 +0100
commit3569d43b501f73862d2fb18fa5e6d023aa5fa750 (patch)
treee01f0192a7e75589c90c13c9f9a65b5792bedd20 /library/std/src/sys/unix/fd.rs
parentf565016eddc3cb812e647d54b06cfe74bdee2900 (diff)
downloadrust-3569d43b501f73862d2fb18fa5e6d023aa5fa750.tar.gz
rust-3569d43b501f73862d2fb18fa5e6d023aa5fa750.zip
espidf: fix stat
* corect type usage with new type definitions in libc
Diffstat (limited to 'library/std/src/sys/unix/fd.rs')
-rw-r--r--library/std/src/sys/unix/fd.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs
index 3de7c68a686..40a64585802 100644
--- a/library/std/src/sys/unix/fd.rs
+++ b/library/std/src/sys/unix/fd.rs
@@ -11,6 +11,21 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
 
 use libc::{c_int, c_void};
 
+#[cfg(any(
+    target_os = "android",
+    target_os = "linux",
+    target_os = "emscripten",
+    target_os = "l4re"
+))]
+use libc::off64_t;
+#[cfg(not(any(
+    target_os = "linux",
+    target_os = "emscripten",
+    target_os = "l4re",
+    target_os = "android"
+)))]
+use libc::off_t as off64_t;
+
 #[derive(Debug)]
 pub struct FileDesc(OwnedFd);
 
@@ -109,7 +124,7 @@ impl FileDesc {
                 self.as_raw_fd(),
                 buf.as_mut_ptr() as *mut c_void,
                 cmp::min(buf.len(), READ_LIMIT),
-                offset as i64,
+                offset as off64_t,
             ))
             .map(|n| n as usize)
         }
@@ -176,7 +191,7 @@ impl FileDesc {
                 self.as_raw_fd(),
                 buf.as_ptr() as *const c_void,
                 cmp::min(buf.len(), READ_LIMIT),
-                offset as i64,
+                offset as off64_t,
             ))
             .map(|n| n as usize)
         }