|
| 1 | +//! 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 implementaion is [talc]. |
| 25 | +/// |
| 26 | +/// [dlmalloc]: https://crates.io/crates/dlmalloc |
| 27 | +/// [talc]: https://crates.io/crates/talc |
| 28 | +/// [rustix-dlmalloc]: https://github.com/sunfishcode/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!(brk); |
| 70 | + not_implemented!(sigaction); |
| 71 | + not_implemented!(sigaltstack); |
| 72 | + not_implemented!(sigprocmask); |
| 73 | + not_implemented!(sigwait); |
| 74 | + not_implemented!(sigwaitinfo); |
| 75 | + not_implemented!(sigtimedwait); |
| 76 | + not_implemented!(set_thread_area); |
| 77 | + not_implemented!(set_tid_address); |
| 78 | + not_implemented!(tkill); |
| 79 | + not_implemented!(sched_setscheduler); |
| 80 | + not_implemented!(rseq); |
| 81 | + |
| 82 | + not_implemented!(pthread_atfork); |
| 83 | + not_implemented!(pthread_attr_destroy); |
| 84 | + not_implemented!(pthread_attr_getaffinity_np); |
| 85 | + not_implemented!(pthread_attr_getdetachstate); |
| 86 | + not_implemented!(pthread_attr_getguardsize); |
| 87 | + not_implemented!(pthread_attr_getinheritsched); |
| 88 | + not_implemented!(pthread_attr_getschedparam); |
| 89 | + not_implemented!(pthread_attr_getschedpolicy); |
| 90 | + not_implemented!(pthread_attr_getscope); |
| 91 | + not_implemented!(pthread_attr_getsigmask_np); |
| 92 | + not_implemented!(pthread_attr_getstack); |
| 93 | + not_implemented!(pthread_attr_getstackaddr); |
| 94 | + not_implemented!(pthread_attr_getstacksize); |
| 95 | + not_implemented!(pthread_attr_init); |
| 96 | + not_implemented!(pthread_attr_setaffinity_np); |
| 97 | + not_implemented!(pthread_attr_setdetachstate); |
| 98 | + not_implemented!(pthread_attr_setguardsize); |
| 99 | + not_implemented!(pthread_attr_setinheritsched); |
| 100 | + not_implemented!(pthread_attr_setschedparam); |
| 101 | + not_implemented!(pthread_attr_setschedpolicy); |
| 102 | + not_implemented!(pthread_attr_setscope); |
| 103 | + not_implemented!(pthread_attr_setsigmask_np); |
| 104 | + not_implemented!(pthread_attr_setstack); |
| 105 | + not_implemented!(pthread_attr_setstackaddr); |
| 106 | + not_implemented!(pthread_attr_setstacksize); |
| 107 | + not_implemented!(pthread_barrierattr_destroy); |
| 108 | + not_implemented!(pthread_barrierattr_getpshared); |
| 109 | + not_implemented!(pthread_barrierattr_init); |
| 110 | + not_implemented!(pthread_barrierattr_setpshared); |
| 111 | + not_implemented!(pthread_barrier_destroy); |
| 112 | + not_implemented!(pthread_barrier_wait); |
| 113 | + not_implemented!(pthread_cancel); |
| 114 | + not_implemented!(pthread_cleanup_pop); |
| 115 | + not_implemented!(pthread_cleanup_pop_restore_np); |
| 116 | + not_implemented!(pthread_cleanup_push); |
| 117 | + not_implemented!(pthread_cleanup_push_defer_np); |
| 118 | + not_implemented!(pthread_condattr_destroy); |
| 119 | + not_implemented!(pthread_condattr_getclock); |
| 120 | + not_implemented!(pthread_condattr_getpshared); |
| 121 | + not_implemented!(pthread_condattr_init); |
| 122 | + not_implemented!(pthread_condattr_setclock); |
| 123 | + not_implemented!(pthread_condattr_setpshared); |
| 124 | + not_implemented!(pthread_cond_broadcast); |
| 125 | + not_implemented!(pthread_cond_destroy); |
| 126 | + not_implemented!(pthread_cond_signal); |
| 127 | + not_implemented!(pthread_cond_timedwait); |
| 128 | + not_implemented!(pthread_create); |
| 129 | + not_implemented!(pthread_detach); |
| 130 | + not_implemented!(pthread_equal); |
| 131 | + not_implemented!(pthread_exit); |
| 132 | + not_implemented!(pthread_getaffinity_np); |
| 133 | + not_implemented!(pthread_getattr_default_np); |
| 134 | + not_implemented!(pthread_getattr_np); |
| 135 | + not_implemented!(pthread_getconcurrency); |
| 136 | + not_implemented!(pthread_getcpuclockid); |
| 137 | + not_implemented!(pthread_getname_np); |
| 138 | + not_implemented!(pthread_getschedparam); |
| 139 | + not_implemented!(pthread_getspecific); |
| 140 | + not_implemented!(pthread_join); |
| 141 | + not_implemented!(pthread_key_create); |
| 142 | + not_implemented!(pthread_key_delete); |
| 143 | + not_implemented!(pthread_kill); |
| 144 | + not_implemented!(pthread_kill_other_threads_np); |
| 145 | + not_implemented!(pthread_mutexattr_destroy); |
| 146 | + not_implemented!(pthread_mutexattr_getprioceiling); |
| 147 | + not_implemented!(pthread_mutexattr_getprotocol); |
| 148 | + not_implemented!(pthread_mutexattr_getpshared); |
| 149 | + not_implemented!(pthread_mutexattr_getrobust); |
| 150 | + not_implemented!(pthread_mutexattr_getrobust_np); |
| 151 | + not_implemented!(pthread_mutexattr_gettype); |
| 152 | + not_implemented!(pthread_mutexattr_init); |
| 153 | + not_implemented!(pthread_mutexattr_setprioceiling); |
| 154 | + not_implemented!(pthread_mutexattr_setprotocol); |
| 155 | + not_implemented!(pthread_mutexattr_setpshared); |
| 156 | + not_implemented!(pthread_mutexattr_setrobust); |
| 157 | + not_implemented!(pthread_mutexattr_setrobust_np); |
| 158 | + not_implemented!(pthread_mutexattr_settype); |
| 159 | + not_implemented!(pthread_mutex_consistent); |
| 160 | + not_implemented!(pthread_mutex_consistent_np); |
| 161 | + not_implemented!(pthread_mutex_destroy); |
| 162 | + not_implemented!(pthread_mutex_getprioceiling); |
| 163 | + not_implemented!(pthread_mutex_init); |
| 164 | + not_implemented!(pthread_mutex_lock); |
| 165 | + not_implemented!(pthread_mutex_setprioceiling); |
| 166 | + not_implemented!(pthread_mutex_timedlock); |
| 167 | + not_implemented!(pthread_mutex_trylock); |
| 168 | + not_implemented!(pthread_once); |
| 169 | + not_implemented!(pthread_rwlockattr_destroy); |
| 170 | + not_implemented!(pthread_rwlockattr_getkind_np); |
| 171 | + not_implemented!(pthread_rwlockattr_getpshared); |
| 172 | + not_implemented!(pthread_rwlockattr_init); |
| 173 | + not_implemented!(pthread_rwlockattr_setkind_np); |
| 174 | + not_implemented!(pthread_rwlockattr_setpshared); |
| 175 | + not_implemented!(pthread_rwlock_destroy); |
| 176 | + not_implemented!(pthread_rwlock_rdlock); |
| 177 | + not_implemented!(pthread_rwlock_timedrdlock); |
| 178 | + not_implemented!(pthread_rwlock_timedwrlock); |
| 179 | + not_implemented!(pthread_rwlock_tryrdlock); |
| 180 | + not_implemented!(pthread_rwlock_trywrlock); |
| 181 | + not_implemented!(pthread_rwlock_unlock); |
| 182 | + not_implemented!(pthread_rwlock_wrlock); |
| 183 | + not_implemented!(pthread_self); |
| 184 | + not_implemented!(pthread_setaffinity_np); |
| 185 | + not_implemented!(pthread_setattr_default_np); |
| 186 | + not_implemented!(pthread_setcancelstate); |
| 187 | + not_implemented!(pthread_setcanceltype); |
| 188 | + not_implemented!(pthread_setconcurrency); |
| 189 | + not_implemented!(pthread_setname_np); |
| 190 | + not_implemented!(pthread_setschedparam); |
| 191 | + not_implemented!(pthread_setschedprio); |
| 192 | + not_implemented!(pthread_setspecific); |
| 193 | + not_implemented!(pthread_sigmask); |
| 194 | + not_implemented!(pthread_sigqueue); |
| 195 | + not_implemented!(pthread_spin_destroy); |
| 196 | + not_implemented!(pthread_spin_init); |
| 197 | + not_implemented!(pthread_spin_lock); |
| 198 | + not_implemented!(pthread_spin_trylock); |
| 199 | + not_implemented!(pthread_spin_unlock); |
| 200 | + not_implemented!(pthread_testcancel); |
| 201 | + not_implemented!(pthread_timedjoin_np); |
| 202 | + not_implemented!(pthread_tryjoin_np); |
| 203 | + not_implemented!(pthread_yield); |
| 204 | +} |
| 205 | + |
| 206 | +/// Functions which provide higher-level functionality are out of scope for |
| 207 | +/// rustix. |
| 208 | +/// |
| 209 | +/// These functions are provided by typical libc implementations, but are |
| 210 | +/// higher-level than the simple syscall-like functions that rustix focuses |
| 211 | +/// on. They could be implemented as a separate library built on top of rustix, |
| 212 | +/// rather than being part of rustix itself. This module contains an incomplete |
| 213 | +/// list of such functions. |
| 214 | +pub mod higher_level { |
| 215 | + not_implemented!(getpwent); |
| 216 | + not_implemented!(getpwuid); |
| 217 | + not_implemented!(getpwnam); |
| 218 | + not_implemented!(getpwuid_r); |
| 219 | + not_implemented!(getpwnam_r); |
| 220 | + not_implemented!(gethostbyname); |
| 221 | + not_implemented!(execv); |
| 222 | + not_implemented!(execvp); |
| 223 | + not_implemented!(execvpe); |
| 224 | + not_implemented!(wordexp); |
| 225 | + |
| 226 | + /// See [rustix-openpty](https://github.com/sunfishcode/rustix-openpty). |
| 227 | + pub fn closefrom() { |
| 228 | + unimplemented!() |
| 229 | + } |
| 230 | + /// See [rustix-openpty](https://github.com/sunfishcode/rustix-openpty). |
| 231 | + pub fn login_tty() { |
| 232 | + unimplemented!() |
| 233 | + } |
| 234 | + /// See [rustix-openpty](https://github.com/sunfishcode/rustix-openpty). |
| 235 | + pub fn openpty() { |
| 236 | + unimplemented!() |
| 237 | + } |
| 238 | + |
| 239 | + /// See [`std::io::IsTerminal`]. |
| 240 | + /// |
| 241 | + /// For Rust < 1.70, see [is-terminal]. For a rustix-based implementation, |
| 242 | + /// see [rustix-is-terminal]. |
| 243 | + /// |
| 244 | + /// [`std::io::IsTerminal`]: https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html |
| 245 | + /// [is-terminal]: https://crates.io/crates/is-terminal |
| 246 | + /// [rustix-is-terminal]: https://github.com/sunfishcode/rustix-is-terminal |
| 247 | + pub fn isatty() { |
| 248 | + unimplemented!() |
| 249 | + } |
| 250 | +} |
| 251 | + |
| 252 | +/// These functions are not yet implemented in rustix, but probably could be. |
| 253 | +/// |
| 254 | +/// These are functions that users have asked about, and which probably are |
| 255 | +/// in scope for rustix, but are not yet implemented. This module contains an |
| 256 | +/// incomplete list of such functions. |
| 257 | +pub mod yet { |
| 258 | + not_implemented!(tgkill); |
| 259 | + not_implemented!(raise); |
| 260 | + not_implemented!(sysctl); |
| 261 | + not_implemented!(mq_open); |
| 262 | + not_implemented!(mq_send); |
| 263 | + not_implemented!(mq_unlink); |
| 264 | + not_implemented!(recvmmsg); |
| 265 | + not_implemented!(cachestat); |
| 266 | + not_implemented!(fanotify_init); |
| 267 | + not_implemented!(fanotify_mark); |
| 268 | + not_implemented!(getifaddrs); |
| 269 | + not_implemented!(signalfd); |
| 270 | + not_implemented!(pidfd_send_signal); |
| 271 | + not_implemented!(mount_setattr); |
| 272 | + not_implemented!(extattr_delete_fd); |
| 273 | + not_implemented!(extattr_delete_link); |
| 274 | + not_implemented!(extattr_get_fd); |
| 275 | + not_implemented!(extattr_get_link); |
| 276 | + not_implemented!(extattr_list_fd); |
| 277 | + not_implemented!(extattr_list_link); |
| 278 | + not_implemented!(extattr_set_fd); |
| 279 | + not_implemented!(extattr_set_link); |
| 280 | + not_implemented!(get_mempolicy); |
| 281 | + not_implemented!(mbind); |
| 282 | + not_implemented!(set_mempolicy); |
| 283 | + not_implemented!(migrate_pages); |
| 284 | + not_implemented!(move_pages); |
| 285 | + not_implemented!(fchmodat2); |
| 286 | + not_implemented!(shmat); |
| 287 | + not_implemented!(shmdt); |
| 288 | + not_implemented!(shmget); |
| 289 | + not_implemented!(shmctl); |
| 290 | +} |
| 291 | + |
| 292 | +/// These functions are not yet finished in rustix. |
| 293 | +/// |
| 294 | +/// Rustix's codebase includes experimental implementations of these functions, |
| 295 | +/// however they are not yet publicly exposed because their API might need more |
| 296 | +/// work and/or they don't yet have a libc backend implementation. |
| 297 | +/// |
| 298 | +/// See [#1314] for more information, and please leave comments if there are |
| 299 | +/// specific functions you're interested in. |
| 300 | +/// |
| 301 | +/// [#1314]: https://github.com/bytecodealliance/rustix/issues/1314 |
| 302 | +pub mod quite_yet { |
| 303 | + not_implemented!(_exit); |
| 304 | + not_implemented!(_Exit); |
| 305 | + not_implemented!(exit_group); |
| 306 | + not_implemented!(sigpending); |
| 307 | + not_implemented!(sigsuspend); |
| 308 | + not_implemented!(execveat); |
| 309 | + not_implemented!(execve); |
| 310 | + |
| 311 | + /// For now, use `rustix::process::uname().nodename()` instead. |
| 312 | + /// |
| 313 | + /// See also the [module comment](self). |
| 314 | + pub fn gethostname() { |
| 315 | + unimplemented!() |
| 316 | + } |
| 317 | +} |
0 commit comments