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