Debian Codegraph @

debian/rust-vendor/rustix/src/not_implemented.rs

raw
1 //! Documentation about unimplemented functions.
2 //!
3 //! This module contains documentation for several functions that rustix does
4 //! not implement, either because they are out of scope, or because they are
5 //! could probably be implemented but are not yet.
6
7 macro_rules! not_implemented {
8 ($func:ident) => {
9 /// See the [module comment](self).
10 pub fn $func() {
11 unimplemented!()
12 }
13 };
14 }
15
16 /// Memory-allocation functions are out of scope for rustix.
17 ///
18 /// It is possible to implement `malloc`, `free`, and similar functions in
19 /// Rust, however rustix itself is focused on syscall-like functions. This
20 /// module contains an incomplete list of such functions.
21 ///
22 /// There are several allocator implementations for Rust; one of them is
23 /// [dlmalloc]. For a rustix-based implementation, see [rustix-dlmalloc].
24 /// Another allocator implementation is [talc].
25 ///
26 /// [dlmalloc]: https://crates.io/crates/dlmalloc
27 /// [talc]: https://crates.io/crates/talc
28 /// [rustix-dlmalloc]: https://crates.io/crates/rustix-dlmalloc
29 pub mod memory_allocation {
30 not_implemented!(malloc);
31 not_implemented!(realloc);
32 not_implemented!(calloc);
33 not_implemented!(free);
34 not_implemented!(posix_memalign);
35 not_implemented!(aligned_alloc);
36 not_implemented!(malloc_usable_size);
37 }
38
39 /// Functions which need access to libc internals are out of scope for rustix.
40 ///
41 /// Most Rust programs have a libc present, and when a libc is present, it
42 /// expects to be the only thing in the process that can do certain operations.
43 /// For example, there can be only one `atexit` list in a process, only one
44 /// `pthread_atfork` list in a process, only one implementation of pthreads in
45 /// a process, and so on, and libc expects to own the one of each of those
46 /// things. And libc implementations may expect to be involved in signal
47 /// handling. So, these functions are believed to be out of scope for rustix.
48 /// This module contains an incomplete list of such functions.
49 ///
50 /// It would be possible to make a rust library which provides safe or
51 /// ergonomic wrappers around these libc functions, however that is out of
52 /// scope for rustix itself.
53 ///
54 /// If you would like to write a Rust program which does not use a libc, and
55 /// which does provide APIs for some of these functions, [Eyra] and [origin]
56 /// are two libraries which may be useful, and which provide public interfaces
57 /// for some of this functionality.
58 ///
59 /// If you are otherwise writing Rust code which you know will not share a
60 /// process with a libc, perhaps because you are writing a libc or similar
61 /// yourself, rustix's codebase does include experimental implementations of
62 /// the primitives needed to implement most of these functions.
63 ///
64 /// [Eyra]: https://github.com/sunfishcode/eyra?tab=readme-ov-file#eyra
65 /// [origin]: https://github.com/sunfishcode/origin?tab=readme-ov-file#origin
66 pub mod libc_internals {
67 not_implemented!(exit);
68 not_implemented!(fork);
69 not_implemented!(clone);
70 not_implemented!(clone3);
71 not_implemented!(brk);
72 not_implemented!(sigaction);
73 not_implemented!(sigaltstack);
74 not_implemented!(sigprocmask);
75 not_implemented!(sigwait);
76 not_implemented!(sigwaitinfo);
77 not_implemented!(sigtimedwait);
78 not_implemented!(set_thread_area);
79 not_implemented!(set_tid_address);
80 not_implemented!(tkill);
81 not_implemented!(sched_setscheduler);
82 not_implemented!(rseq);
83 not_implemented!(setuid);
84 not_implemented!(setgid);
85 not_implemented!(seteuid);
86 not_implemented!(setegid);
87 not_implemented!(setreuid);
88 not_implemented!(setregid);
89 not_implemented!(setresuid);
90 not_implemented!(setresgid);
91 not_implemented!(setgroups);
92
93 not_implemented!(pthread_atfork);
94 not_implemented!(pthread_attr_destroy);
95 not_implemented!(pthread_attr_getaffinity_np);
96 not_implemented!(pthread_attr_getdetachstate);
97 not_implemented!(pthread_attr_getguardsize);
98 not_implemented!(pthread_attr_getinheritsched);
99 not_implemented!(pthread_attr_getschedparam);
100 not_implemented!(pthread_attr_getschedpolicy);
101 not_implemented!(pthread_attr_getscope);
102 not_implemented!(pthread_attr_getsigmask_np);
103 not_implemented!(pthread_attr_getstack);
104 not_implemented!(pthread_attr_getstackaddr);
105 not_implemented!(pthread_attr_getstacksize);
106 not_implemented!(pthread_attr_init);
107 not_implemented!(pthread_attr_setaffinity_np);
108 not_implemented!(pthread_attr_setdetachstate);
109 not_implemented!(pthread_attr_setguardsize);
110 not_implemented!(pthread_attr_setinheritsched);
111 not_implemented!(pthread_attr_setschedparam);
112 not_implemented!(pthread_attr_setschedpolicy);
113 not_implemented!(pthread_attr_setscope);
114 not_implemented!(pthread_attr_setsigmask_np);
115 not_implemented!(pthread_attr_setstack);
116 not_implemented!(pthread_attr_setstackaddr);
117 not_implemented!(pthread_attr_setstacksize);
118 not_implemented!(pthread_barrierattr_destroy);
119 not_implemented!(pthread_barrierattr_getpshared);
120 not_implemented!(pthread_barrierattr_init);
121 not_implemented!(pthread_barrierattr_setpshared);
122 not_implemented!(pthread_barrier_destroy);
123 not_implemented!(pthread_barrier_wait);
124 not_implemented!(pthread_cancel);
125 not_implemented!(pthread_cleanup_pop);
126 not_implemented!(pthread_cleanup_pop_restore_np);
127 not_implemented!(pthread_cleanup_push);
128 not_implemented!(pthread_cleanup_push_defer_np);
129 not_implemented!(pthread_condattr_destroy);
130 not_implemented!(pthread_condattr_getclock);
131 not_implemented!(pthread_condattr_getpshared);
132 not_implemented!(pthread_condattr_init);
133 not_implemented!(pthread_condattr_setclock);
134 not_implemented!(pthread_condattr_setpshared);
135 not_implemented!(pthread_cond_broadcast);
136 not_implemented!(pthread_cond_destroy);
137 not_implemented!(pthread_cond_signal);
138 not_implemented!(pthread_cond_timedwait);
139 not_implemented!(pthread_create);
140 not_implemented!(pthread_detach);
141 not_implemented!(pthread_equal);
142 not_implemented!(pthread_exit);
143 not_implemented!(pthread_getaffinity_np);
144 not_implemented!(pthread_getattr_default_np);
145 not_implemented!(pthread_getattr_np);
146 not_implemented!(pthread_getconcurrency);
147 not_implemented!(pthread_getcpuclockid);
148 not_implemented!(pthread_getname_np);
149 not_implemented!(pthread_getschedparam);
150 not_implemented!(pthread_getspecific);
151 not_implemented!(pthread_join);
152 not_implemented!(pthread_key_create);
153 not_implemented!(pthread_key_delete);
154 not_implemented!(pthread_kill);
155 not_implemented!(pthread_kill_other_threads_np);
156 not_implemented!(pthread_mutexattr_destroy);
157 not_implemented!(pthread_mutexattr_getprioceiling);
158 not_implemented!(pthread_mutexattr_getprotocol);
159 not_implemented!(pthread_mutexattr_getpshared);
160 not_implemented!(pthread_mutexattr_getrobust);
161 not_implemented!(pthread_mutexattr_getrobust_np);
162 not_implemented!(pthread_mutexattr_gettype);
163 not_implemented!(pthread_mutexattr_init);
164 not_implemented!(pthread_mutexattr_setprioceiling);
165 not_implemented!(pthread_mutexattr_setprotocol);
166 not_implemented!(pthread_mutexattr_setpshared);
167 not_implemented!(pthread_mutexattr_setrobust);
168 not_implemented!(pthread_mutexattr_setrobust_np);
169 not_implemented!(pthread_mutexattr_settype);
170 not_implemented!(pthread_mutex_consistent);
171 not_implemented!(pthread_mutex_consistent_np);
172 not_implemented!(pthread_mutex_destroy);
173 not_implemented!(pthread_mutex_getprioceiling);
174 not_implemented!(pthread_mutex_init);
175 not_implemented!(pthread_mutex_lock);
176 not_implemented!(pthread_mutex_setprioceiling);
177 not_implemented!(pthread_mutex_timedlock);
178 not_implemented!(pthread_mutex_trylock);
179 not_implemented!(pthread_once);
180 not_implemented!(pthread_rwlockattr_destroy);
181 not_implemented!(pthread_rwlockattr_getkind_np);
182 not_implemented!(pthread_rwlockattr_getpshared);
183 not_implemented!(pthread_rwlockattr_init);
184 not_implemented!(pthread_rwlockattr_setkind_np);
185 not_implemented!(pthread_rwlockattr_setpshared);
186 not_implemented!(pthread_rwlock_destroy);
187 not_implemented!(pthread_rwlock_rdlock);
188 not_implemented!(pthread_rwlock_timedrdlock);
189 not_implemented!(pthread_rwlock_timedwrlock);
190 not_implemented!(pthread_rwlock_tryrdlock);
191 not_implemented!(pthread_rwlock_trywrlock);
192 not_implemented!(pthread_rwlock_unlock);
193 not_implemented!(pthread_rwlock_wrlock);
194 not_implemented!(pthread_self);
195 not_implemented!(pthread_setaffinity_np);
196 not_implemented!(pthread_setattr_default_np);
197 not_implemented!(pthread_setcancelstate);
198 not_implemented!(pthread_setcanceltype);
199 not_implemented!(pthread_setconcurrency);
200 not_implemented!(pthread_setname_np);
201 not_implemented!(pthread_setschedparam);
202 not_implemented!(pthread_setschedprio);
203 not_implemented!(pthread_setspecific);
204 not_implemented!(pthread_sigmask);
205 not_implemented!(pthread_sigqueue);
206 not_implemented!(pthread_spin_destroy);
207 not_implemented!(pthread_spin_init);
208 not_implemented!(pthread_spin_lock);
209 not_implemented!(pthread_spin_trylock);
210 not_implemented!(pthread_spin_unlock);
211 not_implemented!(pthread_testcancel);
212 not_implemented!(pthread_timedjoin_np);
213 not_implemented!(pthread_tryjoin_np);
214 not_implemented!(pthread_yield);
215 }
216
217 /// Functions which provide higher-level functionality are out of scope for
218 /// rustix.
219 ///
220 /// These functions are provided by typical libc implementations, but are
221 /// higher-level than the simple syscall-like functions that rustix focuses on.
222 /// They could be implemented as a separate library built on top of rustix,
223 /// rather than being part of rustix itself. This module contains an incomplete
224 /// list of such functions.
225 pub mod higher_level {
226 not_implemented!(getpwent);
227 not_implemented!(getpwuid);
228 not_implemented!(getpwnam);
229 not_implemented!(getpwuid_r);
230 not_implemented!(getpwnam_r);
231 not_implemented!(gethostbyname);
232 not_implemented!(execv);
233 not_implemented!(execvp);
234 not_implemented!(execvpe);
235 not_implemented!(wordexp);
236 not_implemented!(localtime);
237 not_implemented!(localtime_r);
238 not_implemented!(gmtime);
239 not_implemented!(gmtime_r);
240 not_implemented!(ctime);
241 not_implemented!(ctime_r);
242 not_implemented!(asctime);
243 not_implemented!(asctime_r);
244 not_implemented!(mktime);
245 not_implemented!(getifaddrs);
246
247 /// See [rustix-openpty](https://crates.io/crates/rustix-openpty).
248 pub fn closefrom() {
249 unimplemented!()
250 }
251 /// See [rustix-openpty](https://crates.io/crates/rustix-openpty).
252 pub fn login_tty() {
253 unimplemented!()
254 }
255 /// See [rustix-openpty](https://crates.io/crates/rustix-openpty).
256 pub fn openpty() {
257 unimplemented!()
258 }
259
260 /// See [`std::io::IsTerminal`].
261 ///
262 /// For Rust < 1.70, see [is-terminal]. For a rustix-based implementation,
263 /// see [rustix-is-terminal].
264 ///
265 /// [`std::io::IsTerminal`]: std::io::IsTerminal
266 /// [is-terminal]: https://crates.io/crates/is-terminal
267 /// [rustix-is-terminal]: https://crates.io/crates/rustix-is-terminal
268 pub fn isatty() {
269 unimplemented!()
270 }
271 }
272
273 /// Functions which don't seem possible to even call from Rust with current
274 /// language features, even with `unsafe`.
275 pub mod impossible {
276 not_implemented!(vfork);
277 not_implemented!(sigreturn);
278 not_implemented!(setjmp);
279 not_implemented!(longjmp);
280 not_implemented!(sigsetjmp);
281 not_implemented!(siglongjmp);
282 }
283
284 /// These functions are not yet implemented in rustix, but probably could be.
285 ///
286 /// These are functions that users have asked about, and which probably are in
287 /// scope for rustix, but are not yet implemented. This module contains an
288 /// incomplete list of such functions.
289 pub mod yet {
290 not_implemented!(tgkill);
291 not_implemented!(raise);
292 not_implemented!(sysctl);
293 not_implemented!(mq_open);
294 not_implemented!(mq_send);
295 not_implemented!(mq_unlink);
296 not_implemented!(recvmmsg);
297 not_implemented!(cachestat);
298 not_implemented!(fanotify_init);
299 not_implemented!(fanotify_mark);
300 not_implemented!(signalfd);
301 not_implemented!(mount_setattr);
302 not_implemented!(extattr_delete_fd);
303 not_implemented!(extattr_delete_link);
304 not_implemented!(extattr_get_fd);
305 not_implemented!(extattr_get_link);
306 not_implemented!(extattr_list_fd);
307 not_implemented!(extattr_list_link);
308 not_implemented!(extattr_set_fd);
309 not_implemented!(extattr_set_link);
310 not_implemented!(get_mempolicy);
311 not_implemented!(mbind);
312 not_implemented!(set_mempolicy);
313 not_implemented!(migrate_pages);
314 not_implemented!(move_pages);
315 not_implemented!(fchmodat2);
316 not_implemented!(shmat);
317 not_implemented!(shmdt);
318 not_implemented!(shmget);
319 not_implemented!(shmctl);
320 }
321
322 /// These functions are not quite yet finished in rustix.
323 ///
324 /// Rustix's codebase includes experimental implementations of these functions,
325 /// however they are not yet publicly exposed because their API might need more
326 /// work and/or they don't yet have a libc backend implementation yet.
327 ///
328 /// See [#1314] for more information, and please leave comments if there are
329 /// specific functions you're interested in.
330 ///
331 /// [#1314]: https://github.com/bytecodealliance/rustix/issues/1314
332 pub mod quite_yet {
333 not_implemented!(_exit);
334 not_implemented!(_Exit);
335 not_implemented!(exit_group);
336 not_implemented!(sigpending);
337 not_implemented!(sigsuspend);
338 not_implemented!(execveat);
339 not_implemented!(execve);
340
341 /// For now, use `rustix::process::uname().nodename()` instead.
342 ///
343 /// See also the [module comment](self).
344 pub fn gethostname() {
345 unimplemented!()
346 }
347 }