interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / unix / linux_like / emscripten / lfs64.rs

214 lines · 5321 bytes Raw Blame History
1use crate::off64_t;
2use crate::prelude::*;
3
4// In-sync with ../linux/musl/lfs64.rs except for fallocate64, prlimit64 and sendfile64
5
6#[inline]
7pub unsafe extern "C" fn creat64(path: *const c_char, mode: crate::mode_t) -> c_int {
8 crate::creat(path, mode)
9}
10
11#[inline]
12pub unsafe extern "C" fn fgetpos64(stream: *mut crate::FILE, pos: *mut crate::fpos64_t) -> c_int {
13 crate::fgetpos(stream, pos.cast())
14}
15
16#[inline]
17pub 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]
22pub 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]
31pub 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]
40pub unsafe extern "C" fn fsetpos64(stream: *mut crate::FILE, pos: *const crate::fpos64_t) -> c_int {
41 crate::fsetpos(stream, pos.cast())
42}
43
44#[inline]
45pub unsafe extern "C" fn fstat64(fildes: c_int, buf: *mut crate::stat64) -> c_int {
46 crate::fstat(fildes, buf.cast())
47}
48
49#[inline]
50pub 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.cast(), flag)
57}
58
59#[inline]
60pub unsafe extern "C" fn fstatfs64(fd: c_int, buf: *mut crate::statfs64) -> c_int {
61 crate::fstatfs(fd, buf.cast())
62}
63
64#[inline]
65pub unsafe extern "C" fn fstatvfs64(fd: c_int, buf: *mut crate::statvfs64) -> c_int {
66 crate::fstatvfs(fd, buf.cast())
67}
68
69#[inline]
70pub unsafe extern "C" fn ftello64(stream: *mut crate::FILE) -> off64_t {
71 crate::ftello(stream)
72}
73
74#[inline]
75pub unsafe extern "C" fn ftruncate64(fd: c_int, length: off64_t) -> c_int {
76 crate::ftruncate(fd, length)
77}
78
79#[inline]
80pub unsafe extern "C" fn getrlimit64(resource: c_int, rlim: *mut crate::rlimit64) -> c_int {
81 crate::getrlimit(resource, rlim.cast())
82}
83
84#[inline]
85pub 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]
90pub unsafe extern "C" fn lstat64(path: *const c_char, buf: *mut crate::stat64) -> c_int {
91 crate::lstat(path, buf.cast())
92}
93
94#[inline]
95pub 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.
112pub use crate::{
113 open as open64,
114 openat as openat64,
115};
116
117#[inline]
118pub unsafe extern "C" fn posix_fadvise64(
119 fd: c_int,
120 offset: off64_t,
121 len: off64_t,
122 advice: c_int,
123) -> c_int {
124 crate::posix_fadvise(fd, offset, len, advice)
125}
126
127#[inline]
128pub unsafe extern "C" fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int {
129 crate::posix_fallocate(fd, offset, len)
130}
131
132#[inline]
133pub unsafe extern "C" fn pread64(
134 fd: c_int,
135 buf: *mut c_void,
136 count: size_t,
137 offset: off64_t,
138) -> ssize_t {
139 crate::pread(fd, buf, count, offset)
140}
141
142#[inline]
143pub unsafe extern "C" fn preadv64(
144 fd: c_int,
145 iov: *const crate::iovec,
146 iovcnt: c_int,
147 offset: off64_t,
148) -> ssize_t {
149 crate::preadv(fd, iov, iovcnt, offset)
150}
151
152#[inline]
153pub unsafe extern "C" fn pwrite64(
154 fd: c_int,
155 buf: *const c_void,
156 count: size_t,
157 offset: off64_t,
158) -> ssize_t {
159 crate::pwrite(fd, buf, count, offset)
160}
161
162#[inline]
163pub unsafe extern "C" fn pwritev64(
164 fd: c_int,
165 iov: *const crate::iovec,
166 iovcnt: c_int,
167 offset: off64_t,
168) -> ssize_t {
169 crate::pwritev(fd, iov, iovcnt, offset)
170}
171
172#[inline]
173pub unsafe extern "C" fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64 {
174 crate::readdir(dirp).cast()
175}
176
177#[inline]
178pub unsafe extern "C" fn readdir64_r(
179 dirp: *mut crate::DIR,
180 entry: *mut crate::dirent64,
181 result: *mut *mut crate::dirent64,
182) -> c_int {
183 crate::readdir_r(dirp, entry.cast(), result.cast())
184}
185
186#[inline]
187pub unsafe extern "C" fn setrlimit64(resource: c_int, rlim: *const crate::rlimit64) -> c_int {
188 crate::setrlimit(resource, rlim.cast())
189}
190
191#[inline]
192pub unsafe extern "C" fn stat64(pathname: *const c_char, statbuf: *mut crate::stat64) -> c_int {
193 crate::stat(pathname, statbuf.cast())
194}
195
196#[inline]
197pub unsafe extern "C" fn statfs64(pathname: *const c_char, buf: *mut crate::statfs64) -> c_int {
198 crate::statfs(pathname, buf.cast())
199}
200
201#[inline]
202pub unsafe extern "C" fn statvfs64(path: *const c_char, buf: *mut crate::statvfs64) -> c_int {
203 crate::statvfs(path, buf.cast())
204}
205
206#[inline]
207pub unsafe extern "C" fn tmpfile64() -> *mut crate::FILE {
208 crate::tmpfile()
209}
210
211#[inline]
212pub unsafe extern "C" fn truncate64(path: *const c_char, length: off64_t) -> c_int {
213 crate::truncate(path, length)
214}