aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / libc / src / unix / linux_like / linux / musl / lfs64.rs
| 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.cast()) |
| 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.cast()) |
| 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.cast()) |
| 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.cast(), 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.cast()) |
| 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.cast()) |
| 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.cast()) |
| 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.cast()) |
| 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::{ |
| 121 | open as open64, |
| 122 | openat as openat64, |
| 123 | }; |
| 124 | |
| 125 | #[inline] |
| 126 | pub unsafe extern "C" fn posix_fadvise64( |
| 127 | fd: c_int, |
| 128 | offset: off64_t, |
| 129 | len: off64_t, |
| 130 | advice: c_int, |
| 131 | ) -> c_int { |
| 132 | crate::posix_fadvise(fd, offset, len, advice) |
| 133 | } |
| 134 | |
| 135 | #[inline] |
| 136 | pub unsafe extern "C" fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int { |
| 137 | crate::posix_fallocate(fd, offset, len) |
| 138 | } |
| 139 | |
| 140 | #[inline] |
| 141 | pub unsafe extern "C" fn pread64( |
| 142 | fd: c_int, |
| 143 | buf: *mut c_void, |
| 144 | count: size_t, |
| 145 | offset: off64_t, |
| 146 | ) -> ssize_t { |
| 147 | crate::pread(fd, buf, count, offset) |
| 148 | } |
| 149 | |
| 150 | #[inline] |
| 151 | pub unsafe extern "C" fn preadv64( |
| 152 | fd: c_int, |
| 153 | iov: *const crate::iovec, |
| 154 | iovcnt: c_int, |
| 155 | offset: off64_t, |
| 156 | ) -> ssize_t { |
| 157 | crate::preadv(fd, iov, iovcnt, offset) |
| 158 | } |
| 159 | |
| 160 | #[inline] |
| 161 | pub unsafe extern "C" fn prlimit64( |
| 162 | pid: crate::pid_t, |
| 163 | resource: c_int, |
| 164 | new_limit: *const crate::rlimit64, |
| 165 | old_limit: *mut crate::rlimit64, |
| 166 | ) -> c_int { |
| 167 | crate::prlimit(pid, resource, new_limit.cast(), old_limit.cast()) |
| 168 | } |
| 169 | |
| 170 | #[inline] |
| 171 | pub unsafe extern "C" fn pwrite64( |
| 172 | fd: c_int, |
| 173 | buf: *const c_void, |
| 174 | count: size_t, |
| 175 | offset: off64_t, |
| 176 | ) -> ssize_t { |
| 177 | crate::pwrite(fd, buf, count, offset) |
| 178 | } |
| 179 | |
| 180 | #[inline] |
| 181 | pub unsafe extern "C" fn pwritev64( |
| 182 | fd: c_int, |
| 183 | iov: *const crate::iovec, |
| 184 | iovcnt: c_int, |
| 185 | offset: off64_t, |
| 186 | ) -> ssize_t { |
| 187 | crate::pwritev(fd, iov, iovcnt, offset) |
| 188 | } |
| 189 | |
| 190 | #[inline] |
| 191 | pub unsafe extern "C" fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64 { |
| 192 | crate::readdir(dirp).cast() |
| 193 | } |
| 194 | |
| 195 | #[inline] |
| 196 | pub unsafe extern "C" fn readdir64_r( |
| 197 | dirp: *mut crate::DIR, |
| 198 | entry: *mut crate::dirent64, |
| 199 | result: *mut *mut crate::dirent64, |
| 200 | ) -> c_int { |
| 201 | crate::readdir_r(dirp, entry.cast(), result.cast()) |
| 202 | } |
| 203 | |
| 204 | #[inline] |
| 205 | pub unsafe extern "C" fn sendfile64( |
| 206 | out_fd: c_int, |
| 207 | in_fd: c_int, |
| 208 | offset: *mut off64_t, |
| 209 | count: size_t, |
| 210 | ) -> ssize_t { |
| 211 | crate::sendfile(out_fd, in_fd, offset, count) |
| 212 | } |
| 213 | |
| 214 | #[inline] |
| 215 | pub unsafe extern "C" fn setrlimit64(resource: c_int, rlim: *const crate::rlimit64) -> c_int { |
| 216 | crate::setrlimit(resource, rlim.cast()) |
| 217 | } |
| 218 | |
| 219 | #[inline] |
| 220 | pub unsafe extern "C" fn stat64(pathname: *const c_char, statbuf: *mut crate::stat64) -> c_int { |
| 221 | crate::stat(pathname, statbuf.cast()) |
| 222 | } |
| 223 | |
| 224 | #[inline] |
| 225 | pub unsafe extern "C" fn statfs64(pathname: *const c_char, buf: *mut crate::statfs64) -> c_int { |
| 226 | crate::statfs(pathname, buf.cast()) |
| 227 | } |
| 228 | |
| 229 | #[inline] |
| 230 | pub unsafe extern "C" fn statvfs64(path: *const c_char, buf: *mut crate::statvfs64) -> c_int { |
| 231 | crate::statvfs(path, buf.cast()) |
| 232 | } |
| 233 | |
| 234 | #[inline] |
| 235 | pub unsafe extern "C" fn tmpfile64() -> *mut crate::FILE { |
| 236 | crate::tmpfile() |
| 237 | } |
| 238 | |
| 239 | #[inline] |
| 240 | pub unsafe extern "C" fn truncate64(path: *const c_char, length: off64_t) -> c_int { |
| 241 | crate::truncate(path, length) |
| 242 | } |