@@ -98,6 +98,7 @@ pub unsafe fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t {
98
98
//
99
99
// If it doesn't we just fall back to `ftruncate`, generating an error for
100
100
// too-large values.
101
+ #[ cfg( target_pointer_width = "32" ) ]
101
102
pub fn ftruncate64 ( fd : c_int , size : u64 ) -> io:: Result < ( ) > {
102
103
weak ! ( fn ftruncate64( c_int, i64 ) -> c_int) ;
103
104
@@ -116,6 +117,14 @@ pub fn ftruncate64(fd: c_int, size: u64) -> io::Result<()> {
116
117
}
117
118
}
118
119
120
+ #[ cfg( target_pointer_width = "64" ) ]
121
+ pub fn ftruncate64 ( fd : c_int , size : u64 ) -> io:: Result < ( ) > {
122
+ unsafe {
123
+ cvt_r ( || ftruncate ( fd, size as i64 ) ) . map ( |_| ( ) )
124
+ }
125
+ }
126
+
127
+ #[ cfg( target_pointer_width = "32" ) ]
119
128
pub unsafe fn cvt_pread64 ( fd : c_int , buf : * mut c_void , count : size_t , offset : i64 )
120
129
-> io:: Result < ssize_t >
121
130
{
@@ -130,6 +139,7 @@ pub unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: i6
130
139
} )
131
140
}
132
141
142
+ #[ cfg( target_pointer_width = "32" ) ]
133
143
pub unsafe fn cvt_pwrite64 ( fd : c_int , buf : * const c_void , count : size_t , offset : i64 )
134
144
-> io:: Result < ssize_t >
135
145
{
@@ -143,3 +153,17 @@ pub unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset:
143
153
}
144
154
} )
145
155
}
156
+
157
+ #[ cfg( target_pointer_width = "64" ) ]
158
+ pub unsafe fn cvt_pread64 ( fd : c_int , buf : * mut c_void , count : size_t , offset : i64 )
159
+ -> io:: Result < ssize_t >
160
+ {
161
+ cvt ( pread ( fd, buf, count, offset) )
162
+ }
163
+
164
+ #[ cfg( target_pointer_width = "64" ) ]
165
+ pub unsafe fn cvt_pwrite64 ( fd : c_int , buf : * const c_void , count : size_t , offset : i64 )
166
+ -> io:: Result < ssize_t >
167
+ {
168
+ cvt ( pwrite ( fd, buf, count, offset) )
169
+ }
0 commit comments