1 use crate::off64_t; 2 use crate::prelude::*; 3 4 // In-sync with ../linux/musl/lfs64.rs except for fallocate64, prlimit64 and sendfile64 5 6 #[inline] 7 pub unsafe extern "C" fn creat64(path: *const c_char, mode: crate::mode_t) -> c_int { 8 crate::creat(path, mode) 9 } 10 11 #[inline] 12 pub unsafe extern "C" fn fgetpos64(stream: *mut crate::FILE, pos: *mut crate::fpos64_t) -> c_int { 13 crate::fgetpos(stream, pos as *mut _) 14 } 15 16 #[inline] 17 pub unsafe extern "C" fn fopen64(pathname: *const c_char, mode: *const c_char) -> *mut crate::FILE { 18 crate::fopen(pathname, mode) 19 } 20 21 #[inline] 22 pub unsafe extern "C" fn freopen64( 23 pathname: *const c_char, 24 mode: *const c_char, 25 stream: *mut crate::FILE, 26 ) -> *mut crate::FILE { 27 crate::freopen(pathname, mode, stream) 28 } 29 30 #[inline] 31 pub unsafe extern "C" fn fseeko64( 32 stream: *mut crate::FILE, 33 offset: off64_t, 34 whence: c_int, 35 ) -> c_int { 36 crate::fseeko(stream, offset, whence) 37 } 38 39 #[inline] 40 pub unsafe extern "C" fn fsetpos64(stream: *mut crate::FILE, pos: *const crate::fpos64_t) -> c_int { 41 crate::fsetpos(stream, pos as *mut _) 42 } 43 44 #[inline] 45 pub unsafe extern "C" fn fstat64(fildes: c_int, buf: *mut crate::stat64) -> c_int { 46 crate::fstat(fildes, buf as *mut _) 47 } 48 49 #[inline] 50 pub unsafe extern "C" fn fstatat64( 51 fd: c_int, 52 path: *const c_char, 53 buf: *mut crate::stat64, 54 flag: c_int, 55 ) -> c_int { 56 crate::fstatat(fd, path, buf as *mut _, flag) 57 } 58 59 #[inline] 60 pub unsafe extern "C" fn fstatfs64(fd: c_int, buf: *mut crate::statfs64) -> c_int { 61 crate::fstatfs(fd, buf as *mut _) 62 } 63 64 #[inline] 65 pub unsafe extern "C" fn fstatvfs64(fd: c_int, buf: *mut crate::statvfs64) -> c_int { 66 crate::fstatvfs(fd, buf as *mut _) 67 } 68 69 #[inline] 70 pub unsafe extern "C" fn ftello64(stream: *mut crate::FILE) -> off64_t { 71 crate::ftello(stream) 72 } 73 74 #[inline] 75 pub unsafe extern "C" fn ftruncate64(fd: c_int, length: off64_t) -> c_int { 76 crate::ftruncate(fd, length) 77 } 78 79 #[inline] 80 pub unsafe extern "C" fn getrlimit64(resource: c_int, rlim: *mut crate::rlimit64) -> c_int { 81 crate::getrlimit(resource, rlim as *mut _) 82 } 83 84 #[inline] 85 pub unsafe extern "C" fn lseek64(fd: c_int, offset: off64_t, whence: c_int) -> off64_t { 86 crate::lseek(fd, offset, whence) 87 } 88 89 #[inline] 90 pub unsafe extern "C" fn lstat64(path: *const c_char, buf: *mut crate::stat64) -> c_int { 91 crate::lstat(path, buf as *mut _) 92 } 93 94 #[inline] 95 pub unsafe extern "C" fn mmap64( 96 addr: *mut c_void, 97 length: size_t, 98 prot: c_int, 99 flags: c_int, 100 fd: c_int, 101 offset: off64_t, 102 ) -> *mut c_void { 103 crate::mmap(addr, length, prot, flags, fd, offset) 104 } 105 106 // These functions are variadic in the C ABI since the `mode` argument is "optional". Variadic 107 // `extern "C"` functions are unstable in Rust so we cannot write a shim function for these 108 // entrypoints. See https://github.com/rust-lang/rust/issues/44930. 109 // 110 // These aliases are mostly fine though, neither function takes a LFS64-namespaced type as an 111 // argument, nor do their names clash with any declared types. 112 pub use crate::{open as open64, openat as openat64}; 113 114 #[inline] 115 pub unsafe extern "C" fn posix_fadvise64( 116 fd: c_int, 117 offset: off64_t, 118 len: off64_t, 119 advice: c_int, 120 ) -> c_int { 121 crate::posix_fadvise(fd, offset, len, advice) 122 } 123 124 #[inline] 125 pub unsafe extern "C" fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int { 126 crate::posix_fallocate(fd, offset, len) 127 } 128 129 #[inline] 130 pub unsafe extern "C" fn pread64( 131 fd: c_int, 132 buf: *mut c_void, 133 count: size_t, 134 offset: off64_t, 135 ) -> ssize_t { 136 crate::pread(fd, buf, count, offset) 137 } 138 139 #[inline] 140 pub unsafe extern "C" fn preadv64( 141 fd: c_int, 142 iov: *const crate::iovec, 143 iovcnt: c_int, 144 offset: off64_t, 145 ) -> ssize_t { 146 crate::preadv(fd, iov, iovcnt, offset) 147 } 148 149 #[inline] 150 pub unsafe extern "C" fn pwrite64( 151 fd: c_int, 152 buf: *const c_void, 153 count: size_t, 154 offset: off64_t, 155 ) -> ssize_t { 156 crate::pwrite(fd, buf, count, offset) 157 } 158 159 #[inline] 160 pub unsafe extern "C" fn pwritev64( 161 fd: c_int, 162 iov: *const crate::iovec, 163 iovcnt: c_int, 164 offset: off64_t, 165 ) -> ssize_t { 166 crate::pwritev(fd, iov, iovcnt, offset) 167 } 168 169 #[inline] 170 pub unsafe extern "C" fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64 { 171 crate::readdir(dirp) as *mut _ 172 } 173 174 #[inline] 175 pub unsafe extern "C" fn readdir64_r( 176 dirp: *mut crate::DIR, 177 entry: *mut crate::dirent64, 178 result: *mut *mut crate::dirent64, 179 ) -> c_int { 180 crate::readdir_r(dirp, entry as *mut _, result as *mut _) 181 } 182 183 #[inline] 184 pub unsafe extern "C" fn setrlimit64(resource: c_int, rlim: *const crate::rlimit64) -> c_int { 185 crate::setrlimit(resource, rlim as *mut _) 186 } 187 188 #[inline] 189 pub unsafe extern "C" fn stat64(pathname: *const c_char, statbuf: *mut crate::stat64) -> c_int { 190 crate::stat(pathname, statbuf as *mut _) 191 } 192 193 #[inline] 194 pub unsafe extern "C" fn statfs64(pathname: *const c_char, buf: *mut crate::statfs64) -> c_int { 195 crate::statfs(pathname, buf as *mut _) 196 } 197 198 #[inline] 199 pub unsafe extern "C" fn statvfs64(path: *const c_char, buf: *mut crate::statvfs64) -> c_int { 200 crate::statvfs(path, buf as *mut _) 201 } 202 203 #[inline] 204 pub unsafe extern "C" fn tmpfile64() -> *mut crate::FILE { 205 crate::tmpfile() 206 } 207 208 #[inline] 209 pub unsafe extern "C" fn truncate64(path: *const c_char, length: off64_t) -> c_int { 210 crate::truncate(path, length) 211 } 212