@@ -52,9 +52,8 @@ pub(crate) unsafe fn pread(
52
52
// Silently cast; we'll get `EINVAL` if the value is negative.
53
53
let offset = offset as i64 ;
54
54
55
- // ESP-IDF and Vita don't support 64-bit offsets.
56
- #[ cfg( any( target_os = "espidf" , target_os = "vita" ) ) ]
57
- let offset: i32 = offset. try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
55
+ // ESP-IDF and Vita don't support 64-bit offsets, for example.
56
+ let offset = offset. try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
58
57
59
58
ret_usize ( c:: pread ( borrowed_fd ( fd) , buf. 0 . cast ( ) , len, offset) )
60
59
}
@@ -65,9 +64,8 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result<
65
64
// Silently cast; we'll get `EINVAL` if the value is negative.
66
65
let offset = offset as i64 ;
67
66
68
- // ESP-IDF and Vita don't support 64-bit offsets.
69
- #[ cfg( any( target_os = "espidf" , target_os = "vita" ) ) ]
70
- let offset: i32 = offset. try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
67
+ // ESP-IDF and Vita don't support 64-bit offsets, for example.
68
+ let offset = offset. try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
71
69
72
70
unsafe { ret_usize ( c:: pwrite ( borrowed_fd ( fd) , buf. as_ptr ( ) . cast ( ) , len, offset) ) }
73
71
}
@@ -111,6 +109,10 @@ pub(crate) fn preadv(
111
109
) -> io:: Result < usize > {
112
110
// Silently cast; we'll get `EINVAL` if the value is negative.
113
111
let offset = offset as i64 ;
112
+
113
+ // ESP-IDF and Vita don't support 64-bit offsets, for example.
114
+ let offset = offset. try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
115
+
114
116
unsafe {
115
117
ret_usize ( c:: preadv (
116
118
borrowed_fd ( fd) ,
@@ -134,6 +136,10 @@ pub(crate) fn preadv(
134
136
pub ( crate ) fn pwritev ( fd : BorrowedFd < ' _ > , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
135
137
// Silently cast; we'll get `EINVAL` if the value is negative.
136
138
let offset = offset as i64 ;
139
+
140
+ // ESP-IDF and Vita don't support 64-bit offsets, for example.
141
+ let offset = offset. try_into ( ) . map_err ( |_| io:: Errno :: OVERFLOW ) ?;
142
+
137
143
unsafe {
138
144
ret_usize ( c:: pwritev (
139
145
borrowed_fd ( fd) ,
0 commit comments