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