@@ -98,6 +98,7 @@ pub unsafe fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t {
9898//
9999// If it doesn't we just fall back to `ftruncate`, generating an error for
100100// too-large values.
101+ #[ cfg( target_pointer_width = "32" ) ]
101102pub fn ftruncate64 ( fd : c_int , size : u64 ) -> io:: Result < ( ) > {
102103 weak ! ( fn ftruncate64( c_int, i64 ) -> c_int) ;
103104
@@ -116,6 +117,14 @@ pub fn ftruncate64(fd: c_int, size: u64) -> io::Result<()> {
116117 }
117118}
118119
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" ) ]
119128pub unsafe fn cvt_pread64 ( fd : c_int , buf : * mut c_void , count : size_t , offset : i64 )
120129 -> io:: Result < ssize_t >
121130{
@@ -130,6 +139,7 @@ pub unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: i6
130139 } )
131140}
132141
142+ #[ cfg( target_pointer_width = "32" ) ]
133143pub unsafe fn cvt_pwrite64 ( fd : c_int , buf : * const c_void , count : size_t , offset : i64 )
134144 -> io:: Result < ssize_t >
135145{
@@ -143,3 +153,17 @@ pub unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset:
143153 }
144154 } )
145155}
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