Debian Codegraph @

debian/missing-sources/libc/src/unix/linux_like/emscripten/lfs64.rs

raw
1 use crate::off64_t;
2 use crate::prelude::*;
3
4 // In-sync with ../linux/musl/lfs64.rs except for fallocate64, prlimit64 and sendfile64
5
6 #[inline]
7 pub unsafe extern "C" fn creat64(path: *const c_char, mode: crate::mode_t) -> c_int {
8 crate::creat(path, mode)
9 }
10
11 #[inline]
12 pub unsafe extern "C" fn fgetpos64(stream: *mut crate::FILE, pos: *mut crate::fpos64_t) -> c_int {
13 crate::fgetpos(stream, pos as *mut _)
14 }
15
16 #[inline]
17 pub 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]
22 pub 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]
31 pub 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]
40 pub unsafe extern "C" fn fsetpos64(stream: *mut crate::FILE, pos: *const crate::fpos64_t) -> c_int {
41 crate::fsetpos(stream, pos as *mut _)
42 }
43
44 #[inline]
45 pub unsafe extern "C" fn fstat64(fildes: c_int, buf: *mut crate::stat64) -> c_int {
46 crate::fstat(fildes, buf as *mut _)
47 }
48
49 #[inline]
50 pub 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 as *mut _, flag)
57 }
58
59 #[inline]
60 pub unsafe extern "C" fn fstatfs64(fd: c_int, buf: *mut crate::statfs64) -> c_int {
61 crate::fstatfs(fd, buf as *mut _)
62 }
63
64 #[inline]
65 pub unsafe extern "C" fn fstatvfs64(fd: c_int, buf: *mut crate::statvfs64) -> c_int {
66 crate::fstatvfs(fd, buf as *mut _)
67 }
68
69 #[inline]
70 pub unsafe extern "C" fn ftello64(stream: *mut crate::FILE) -> off64_t {
71 crate::ftello(stream)
72 }
73
74 #[inline]
75 pub unsafe extern "C" fn ftruncate64(fd: c_int, length: off64_t) -> c_int {
76 crate::ftruncate(fd, length)
77 }
78
79 #[inline]
80 pub unsafe extern "C" fn getrlimit64(resource: c_int, rlim: *mut crate::rlimit64) -> c_int {
81 crate::getrlimit(resource, rlim as *mut _)
82 }
83
84 #[inline]
85 pub 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]
90 pub unsafe extern "C" fn lstat64(path: *const c_char, buf: *mut crate::stat64) -> c_int {
91 crate::lstat(path, buf as *mut _)
92 }
93
94 #[inline]
95 pub 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.
112 pub use crate::{
113 open as open64,
114 openat as openat64,
115 };
116
117 #[inline]
118 pub 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]
128 pub 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]
133 pub 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]
143 pub 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]
153 pub 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]
163 pub 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]
173 pub unsafe extern "C" fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64 {
174 crate::readdir(dirp) as *mut _
175 }
176
177 #[inline]
178 pub 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 as *mut _, result as *mut _)
184 }
185
186 #[inline]
187 pub unsafe extern "C" fn setrlimit64(resource: c_int, rlim: *const crate::rlimit64) -> c_int {
188 crate::setrlimit(resource, rlim as *mut _)
189 }
190
191 #[inline]
192 pub unsafe extern "C" fn stat64(pathname: *const c_char, statbuf: *mut crate::stat64) -> c_int {
193 crate::stat(pathname, statbuf as *mut _)
194 }
195
196 #[inline]
197 pub unsafe extern "C" fn statfs64(pathname: *const c_char, buf: *mut crate::statfs64) -> c_int {
198 crate::statfs(pathname, buf as *mut _)
199 }
200
201 #[inline]
202 pub unsafe extern "C" fn statvfs64(path: *const c_char, buf: *mut crate::statvfs64) -> c_int {
203 crate::statvfs(path, buf as *mut _)
204 }
205
206 #[inline]
207 pub unsafe extern "C" fn tmpfile64() -> *mut crate::FILE {
208 crate::tmpfile()
209 }
210
211 #[inline]
212 pub unsafe extern "C" fn truncate64(path: *const c_char, length: off64_t) -> c_int {
213 crate::truncate(path, length)
214 }