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.
67macro_rules! not_implemented {
8 ($func:ident) => {
9/// See the [module comment](self).
10pub fn $func() {
11unimplemented!()
12 }
13 };
14}
1516/// 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
29pub mod memory_allocation {
30not_implemented!(malloc);
31not_implemented!(realloc);
32not_implemented!(calloc);
33not_implemented!(free);
34not_implemented!(posix_memalign);
35not_implemented!(aligned_alloc);
36not_implemented!(malloc_usable_size);
37}
3839/// 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
66pub mod libc_internals {
67not_implemented!(exit);
68not_implemented!(fork);
69not_implemented!(clone);
70not_implemented!(clone3);
71not_implemented!(brk);
72not_implemented!(sigaction);
73not_implemented!(sigaltstack);
74not_implemented!(sigprocmask);
75not_implemented!(sigwait);
76not_implemented!(sigwaitinfo);
77not_implemented!(sigtimedwait);
78not_implemented!(set_thread_area);
79not_implemented!(set_tid_address);
80not_implemented!(tkill);
81not_implemented!(sched_setscheduler);
82not_implemented!(rseq);
83not_implemented!(setuid);
84not_implemented!(setgid);
85not_implemented!(seteuid);
86not_implemented!(setegid);
87not_implemented!(setreuid);
88not_implemented!(setregid);
89not_implemented!(setresuid);
90not_implemented!(setresgid);
91not_implemented!(setgroups);
9293not_implemented!(pthread_atfork);
94not_implemented!(pthread_attr_destroy);
95not_implemented!(pthread_attr_getaffinity_np);
96not_implemented!(pthread_attr_getdetachstate);
97not_implemented!(pthread_attr_getguardsize);
98not_implemented!(pthread_attr_getinheritsched);
99not_implemented!(pthread_attr_getschedparam);
100not_implemented!(pthread_attr_getschedpolicy);
101not_implemented!(pthread_attr_getscope);
102not_implemented!(pthread_attr_getsigmask_np);
103not_implemented!(pthread_attr_getstack);
104not_implemented!(pthread_attr_getstackaddr);
105not_implemented!(pthread_attr_getstacksize);
106not_implemented!(pthread_attr_init);
107not_implemented!(pthread_attr_setaffinity_np);
108not_implemented!(pthread_attr_setdetachstate);
109not_implemented!(pthread_attr_setguardsize);
110not_implemented!(pthread_attr_setinheritsched);
111not_implemented!(pthread_attr_setschedparam);
112not_implemented!(pthread_attr_setschedpolicy);
113not_implemented!(pthread_attr_setscope);
114not_implemented!(pthread_attr_setsigmask_np);
115not_implemented!(pthread_attr_setstack);
116not_implemented!(pthread_attr_setstackaddr);
117not_implemented!(pthread_attr_setstacksize);
118not_implemented!(pthread_barrierattr_destroy);
119not_implemented!(pthread_barrierattr_getpshared);
120not_implemented!(pthread_barrierattr_init);
121not_implemented!(pthread_barrierattr_setpshared);
122not_implemented!(pthread_barrier_destroy);
123not_implemented!(pthread_barrier_wait);
124not_implemented!(pthread_cancel);
125not_implemented!(pthread_cleanup_pop);
126not_implemented!(pthread_cleanup_pop_restore_np);
127not_implemented!(pthread_cleanup_push);
128not_implemented!(pthread_cleanup_push_defer_np);
129not_implemented!(pthread_condattr_destroy);
130not_implemented!(pthread_condattr_getclock);
131not_implemented!(pthread_condattr_getpshared);
132not_implemented!(pthread_condattr_init);
133not_implemented!(pthread_condattr_setclock);
134not_implemented!(pthread_condattr_setpshared);
135not_implemented!(pthread_cond_broadcast);
136not_implemented!(pthread_cond_destroy);
137not_implemented!(pthread_cond_signal);
138not_implemented!(pthread_cond_timedwait);
139not_implemented!(pthread_create);
140not_implemented!(pthread_detach);
141not_implemented!(pthread_equal);
142not_implemented!(pthread_exit);
143not_implemented!(pthread_getaffinity_np);
144not_implemented!(pthread_getattr_default_np);
145not_implemented!(pthread_getattr_np);
146not_implemented!(pthread_getconcurrency);
147not_implemented!(pthread_getcpuclockid);
148not_implemented!(pthread_getname_np);
149not_implemented!(pthread_getschedparam);
150not_implemented!(pthread_getspecific);
151not_implemented!(pthread_join);
152not_implemented!(pthread_key_create);
153not_implemented!(pthread_key_delete);
154not_implemented!(pthread_kill);
155not_implemented!(pthread_kill_other_threads_np);
156not_implemented!(pthread_mutexattr_destroy);
157not_implemented!(pthread_mutexattr_getprioceiling);
158not_implemented!(pthread_mutexattr_getprotocol);
159not_implemented!(pthread_mutexattr_getpshared);
160not_implemented!(pthread_mutexattr_getrobust);
161not_implemented!(pthread_mutexattr_getrobust_np);
162not_implemented!(pthread_mutexattr_gettype);
163not_implemented!(pthread_mutexattr_init);
164not_implemented!(pthread_mutexattr_setprioceiling);
165not_implemented!(pthread_mutexattr_setprotocol);
166not_implemented!(pthread_mutexattr_setpshared);
167not_implemented!(pthread_mutexattr_setrobust);
168not_implemented!(pthread_mutexattr_setrobust_np);
169not_implemented!(pthread_mutexattr_settype);
170not_implemented!(pthread_mutex_consistent);
171not_implemented!(pthread_mutex_consistent_np);
172not_implemented!(pthread_mutex_destroy);
173not_implemented!(pthread_mutex_getprioceiling);
174not_implemented!(pthread_mutex_init);
175not_implemented!(pthread_mutex_lock);
176not_implemented!(pthread_mutex_setprioceiling);
177not_implemented!(pthread_mutex_timedlock);
178not_implemented!(pthread_mutex_trylock);
179not_implemented!(pthread_once);
180not_implemented!(pthread_rwlockattr_destroy);
181not_implemented!(pthread_rwlockattr_getkind_np);
182not_implemented!(pthread_rwlockattr_getpshared);
183not_implemented!(pthread_rwlockattr_init);
184not_implemented!(pthread_rwlockattr_setkind_np);
185not_implemented!(pthread_rwlockattr_setpshared);
186not_implemented!(pthread_rwlock_destroy);
187not_implemented!(pthread_rwlock_rdlock);
188not_implemented!(pthread_rwlock_timedrdlock);
189not_implemented!(pthread_rwlock_timedwrlock);
190not_implemented!(pthread_rwlock_tryrdlock);
191not_implemented!(pthread_rwlock_trywrlock);
192not_implemented!(pthread_rwlock_unlock);
193not_implemented!(pthread_rwlock_wrlock);
194not_implemented!(pthread_self);
195not_implemented!(pthread_setaffinity_np);
196not_implemented!(pthread_setattr_default_np);
197not_implemented!(pthread_setcancelstate);
198not_implemented!(pthread_setcanceltype);
199not_implemented!(pthread_setconcurrency);
200not_implemented!(pthread_setname_np);
201not_implemented!(pthread_setschedparam);
202not_implemented!(pthread_setschedprio);
203not_implemented!(pthread_setspecific);
204not_implemented!(pthread_sigmask);
205not_implemented!(pthread_sigqueue);
206not_implemented!(pthread_spin_destroy);
207not_implemented!(pthread_spin_init);
208not_implemented!(pthread_spin_lock);
209not_implemented!(pthread_spin_trylock);
210not_implemented!(pthread_spin_unlock);
211not_implemented!(pthread_testcancel);
212not_implemented!(pthread_timedjoin_np);
213not_implemented!(pthread_tryjoin_np);
214not_implemented!(pthread_yield);
215}
216217/// 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.
225pub mod higher_level {
226not_implemented!(getpwent);
227not_implemented!(getpwuid);
228not_implemented!(getpwnam);
229not_implemented!(getpwuid_r);
230not_implemented!(getpwnam_r);
231not_implemented!(gethostbyname);
232not_implemented!(execv);
233not_implemented!(execvp);
234not_implemented!(execvpe);
235not_implemented!(wordexp);
236not_implemented!(localtime);
237not_implemented!(localtime_r);
238not_implemented!(gmtime);
239not_implemented!(gmtime_r);
240not_implemented!(ctime);
241not_implemented!(ctime_r);
242not_implemented!(asctime);
243not_implemented!(asctime_r);
244not_implemented!(mktime);
245not_implemented!(getifaddrs);
246247/// See [rustix-openpty](https://crates.io/crates/rustix-openpty).
248pub fn closefrom() {
249unimplemented!()
250 }
251/// See [rustix-openpty](https://crates.io/crates/rustix-openpty).
252pub fn login_tty() {
253unimplemented!()
254 }
255/// See [rustix-openpty](https://crates.io/crates/rustix-openpty).
256pub fn openpty() {
257unimplemented!()
258 }
259260/// 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
268pub fn isatty() {
269unimplemented!()
270 }
271}
272273/// Functions which don't seem possible to even call from Rust with current
274/// language features, even with `unsafe`.
275pub mod impossible {
276not_implemented!(vfork);
277not_implemented!(sigreturn);
278not_implemented!(setjmp);
279not_implemented!(longjmp);
280not_implemented!(sigsetjmp);
281not_implemented!(siglongjmp);
282}
283284/// 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.
289pub mod yet {
290not_implemented!(tgkill);
291not_implemented!(raise);
292not_implemented!(sysctl);
293not_implemented!(mq_open);
294not_implemented!(mq_send);
295not_implemented!(mq_unlink);
296not_implemented!(recvmmsg);
297not_implemented!(cachestat);
298not_implemented!(fanotify_init);
299not_implemented!(fanotify_mark);
300not_implemented!(getifaddrs);
301not_implemented!(signalfd);
302not_implemented!(pidfd_send_signal);
303not_implemented!(mount_setattr);
304not_implemented!(extattr_delete_fd);
305not_implemented!(extattr_delete_link);
306not_implemented!(extattr_get_fd);
307not_implemented!(extattr_get_link);
308not_implemented!(extattr_list_fd);
309not_implemented!(extattr_list_link);
310not_implemented!(extattr_set_fd);
311not_implemented!(extattr_set_link);
312not_implemented!(get_mempolicy);
313not_implemented!(mbind);
314not_implemented!(set_mempolicy);
315not_implemented!(migrate_pages);
316not_implemented!(move_pages);
317not_implemented!(fchmodat2);
318not_implemented!(shmat);
319not_implemented!(shmdt);
320not_implemented!(shmget);
321not_implemented!(shmctl);
322}
323324/// These functions are not quite yet finished in rustix.
325///
326/// Rustix's codebase includes experimental implementations of these functions,
327/// however they are not yet publicly exposed because their API might need more
328/// work and/or they don't yet have a libc backend implementation yet.
329///
330/// See [#1314] for more information, and please leave comments if there are
331/// specific functions you're interested in.
332///
333/// [#1314]: https://github.com/bytecodealliance/rustix/issues/1314
334pub mod quite_yet {
335not_implemented!(_exit);
336not_implemented!(_Exit);
337not_implemented!(exit_group);
338not_implemented!(sigpending);
339not_implemented!(sigsuspend);
340not_implemented!(execveat);
341not_implemented!(execve);
342343/// For now, use `rustix::process::uname().nodename()` instead.
344 ///
345 /// See also the [module comment](self).
346pub fn gethostname() {
347unimplemented!()
348 }
349}