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