| 1 | # Changes from 0.38.x to 1.x |
| 2 | |
| 3 | ## Silent behavior changes |
| 4 | |
| 5 | [`rustix::pipe::fcntl_setpipe_size`] now returns the new size, which may be |
| 6 | greater than the requested size. |
| 7 | |
| 8 | [`rustix::pipe::fcntl_setpipe_size`]: https://docs.rs/rustix/1/rustix/pipe/fn.fcntl_setpipe_size.html |
| 9 | |
| 10 | When a `&mut Vec<_>` is passed to [`rustix::event::epoll::wait`], |
| 11 | [`rustix::event::kqueue::kevent`], or [`rustix::event::port::getn`], these |
| 12 | functions previously adjusted the length of the `Vec` to the number of elements |
| 13 | written, and now do not. A common alternative is to wrap the `&mut Vec<_>` |
| 14 | using [`spare_capacity`], and then to clear the `Vec` by iterating using |
| 15 | `.drain(..)` after each call. For an example of using `spare_capacity` in this |
| 16 | way, see [here]. |
| 17 | |
| 18 | [`rustix::event::epoll::wait`]: https://docs.rs/rustix/1/rustix/event/epoll/fn.wait.html |
| 19 | [`rustix::event::kqueue::kevent`]: https://docs.rs/rustix/1/x86_64-unknown-freebsd/rustix/event/kqueue/fn.kevent.html |
| 20 | [`rustix::event::port::getn`]: https://docs.rs/rustix/1/x86_64-unknown-illumos/rustix/event/port/fn.getn.html |
| 21 | [`spare_capacity`]: https://docs.rs/rustix/1/rustix/buffer/fn.spare_capacity.html |
| 22 | [here]: https://docs.rs/rustix/1/rustix/event/epoll/index.html#examples |
| 23 | |
| 24 | ## API changes |
| 25 | |
| 26 | `rustix::thread::FutexOperation` and `rustix::thread::futex` are removed. Use |
| 27 | the functions in the [`rustix::thread::futex`] module instead. |
| 28 | |
| 29 | [`rustix::thread::futex`]: https://docs.rs/rustix/1/rustix/thread/futex/index.html |
| 30 | |
| 31 | [`rustix::process::waitpid`]'s return type changed from `WaitStatus` to |
| 32 | `(Pid, WaitStatus)`, to additionally return the pid of the child. |
| 33 | |
| 34 | [`rustix::process::waitpid`]: https://docs.rs/rustix/1/rustix/process/fn.waitpid.html |
| 35 | |
| 36 | [`terminating_signal`] and other functions in [`rustix::process::WaitStatus`] changed |
| 37 | from returning `u32` to returning `i32`, for better compatibility with the new |
| 38 | [`Signal`] type and [`exit`]. |
| 39 | |
| 40 | [`terminating_signal`]: https://docs.rs/rustix/1/rustix/process/struct.WaitStatus.html#method.terminating_signal |
| 41 | [`rustix::process::WaitStatus`]: https://docs.rs/rustix/1/rustix/process/struct.WaitStatus.html |
| 42 | [`Signal`]: https://docs.rs/rustix/1/rustix/process/struct.Signal.html |
| 43 | [`exit`]: std::process::exit |
| 44 | |
| 45 | The `SLAVE` flag in [`rustix::mount::MountPropagationFlags`] is renamed to |
| 46 | [`DOWNSTREAM`]. |
| 47 | |
| 48 | [`rustix::mount::MountPropagationFlags`]: https://docs.rs/rustix/1/rustix/mount/struct.MountPropagationFlags.html |
| 49 | [`DOWNSTREAM`]: https://docs.rs/rustix/1/rustix/mount/struct.MountPropagationFlags.html#associatedconstant.DOWNSTREAM |
| 50 | |
| 51 | The "cc" and "libc-extra-traits" features are removed. The "cc" feature hasn't |
| 52 | had any effect for several major releases. If you need the traits provided by |
| 53 | "libc-extra-traits", you should instead depend on libc directly and enable its |
| 54 | "extra_traits" feature. |
| 55 | |
| 56 | `rustix::net::Shutdown::ReadWrite` is renamed to |
| 57 | [`rustix::net::Shutdown::Both`] to [align with std]. |
| 58 | |
| 59 | [`rustix::net::Shutdown::Both`]: https://docs.rs/rustix/1/rustix/net/enum.Shutdown.html#variant.Both |
| 60 | [align with std]: https://doc.rust-lang.org/stable/std/net/enum.Shutdown.html#variant.Both |
| 61 | |
| 62 | The `rustix::io_uring::io_uring_register_files_skip` function is replaced with |
| 63 | a [`IORING_REGISTER_FILES_SKIP`] constant, similar to the [`rustix::fs::CWD`] |
| 64 | constant. |
| 65 | |
| 66 | [`IORING_REGISTER_FILES_SKIP`]: https://docs.rs/rustix/1/rustix/io_uring/constant.IORING_REGISTER_FILES_SKIP.html |
| 67 | [`rustix::fs::CWD`]: https://docs.rs/rustix/1/rustix/fs/constant.CWD.html |
| 68 | |
| 69 | Several structs in [`rustix::io_uring`] are now marked `#[non_exhaustive]` |
| 70 | because they contain padding or reserved fields. Instead of constructing |
| 71 | them with field values and `..Default::default()`, construct them with |
| 72 | `Default::default()` and separately assign the fields. |
| 73 | |
| 74 | [`rustix::io_uring`]: https://docs.rs/rustix/1/rustix/io_uring/index.html |
| 75 | |
| 76 | [`rustix::process::Resource`], [`rustix::thread::MembarrierCommand`], and |
| 77 | [`rustix::thread::Capability`] are now marked `#[non_exhaustive]` to ease |
| 78 | migration in case new constants are defined in the future. |
| 79 | |
| 80 | [`rustix::process::Resource`]: https://docs.rs/rustix/1/rustix/process/enum.Resource.html |
| 81 | [`rustix::thread::MembarrierCommand`]: https://docs.rs/rustix/1/rustix/thread/enum.MembarrierCommand.html |
| 82 | [`rustix::thread::Capability`]: https://docs.rs/rustix/1/rustix/thread/enum.Capability.html |
| 83 | |
| 84 | `rustix::process::WaitidOptions` and `rustix::process::WaitidStatus` are |
| 85 | renamed to |
| 86 | [`rustix::process::WaitIdOptions`] and [`rustix::process::WaitIdStatus`] (note |
| 87 | the capitalization), for consistency with [`rustix::process::WaitId`]. |
| 88 | |
| 89 | [`rustix::process::WaitIdOptions`]: https://docs.rs/rustix/1/rustix/process/struct.WaitIdOptions.html |
| 90 | [`rustix::process::WaitIdStatus`]: https://docs.rs/rustix/1/rustix/process/struct.WaitIdStatus.html |
| 91 | [`rustix::process::WaitId`]: https://docs.rs/rustix/1/rustix/process/enum.WaitId.html |
| 92 | |
| 93 | The offsets in [`rustix::fs::SeekFrom::Hole`] and |
| 94 | [`rustix::fs::SeekFrom::Data`] are changed from `i64` to `u64`, to |
| 95 | [align with std], since they represent absolute offsets. |
| 96 | |
| 97 | [`rustix::fs::SeekFrom::Hole`]: https://docs.rs/rustix/1/rustix/fs/enum.SeekFrom.html#variant.Hole |
| 98 | [`rustix::fs::SeekFrom::Data`]: https://docs.rs/rustix/1/rustix/fs/enum.SeekFrom.html#variant.Data |
| 99 | [align with std]: https://doc.rust-lang.org/stable/std/io/enum.SeekFrom.html#variant.Start |
| 100 | |
| 101 | Functions in [`rustix::net::sockopt`] are renamed to remove the `get_` prefix, |
| 102 | to [align with Rust conventions]. |
| 103 | |
| 104 | [`rustix::net::sockopt`]: https://docs.rs/rustix/1/rustix/net/sockopt/index.html |
| 105 | [align with Rust conventions]: https://rust-lang.github.io/api-guidelines/naming.html#getter-names-follow-rust-convention-c-getter |
| 106 | |
| 107 | `rustix::process::sched_*` and `rustix::process::membarrier_*` are moved from |
| 108 | [`rustix::process`] to [`rustix::thread`], as they operate on the current |
| 109 | thread rather than the current process. |
| 110 | |
| 111 | [`rustix::process`]: https://docs.rs/rustix/1/rustix/process/index.html |
| 112 | [`rustix::thread`]: https://docs.rs/rustix/1/rustix/thread/index.html |
| 113 | |
| 114 | The `udata` in [`rustix::event::kqueue::Event`] is changed from `isize` to |
| 115 | `*mut c_void` to better propagate pointer provenance. To use arbitrary integer |
| 116 | values, convert using the [`without_provenance_mut`] and the [`.addr()`] |
| 117 | functions. |
| 118 | |
| 119 | [`rustix::event::kqueue::Event`]: https://docs.rs/rustix/1/x86_64-unknown-freebsd/rustix/event/kqueue/struct.Event.html |
| 120 | [`without_provenance_mut`]: https://doc.rust-lang.org/stable/std/ptr/fn.without_provenance_mut.html |
| 121 | [`.addr()`]: https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.addr |
| 122 | |
| 123 | `rustix::mount::mount_recursive_bind` is renamed to |
| 124 | [`rustix::mount::mount_bind_recursive`]. See [this comment] for details. |
| 125 | |
| 126 | [`rustix::mount::mount_bind_recursive`]: https://docs.rs/rustix/1/rustix/mount/fn.mount_bind_recursive.html |
| 127 | [this comment]: https://github.com/bytecodealliance/rustix/pull/763#issuecomment-1662756184 |
| 128 | |
| 129 | The `rustix::procfs` is removed. This functionality is now available in the |
| 130 | [rustix-linux-procfs crate]. |
| 131 | |
| 132 | [rustix-linux-procfs crate]: https://crates.io/crates/rustix-linux-procfs |
| 133 | |
| 134 | `rustix::net::RecvMsgReturn` is renamed to [`rustix::net::RecvMsg`]. |
| 135 | |
| 136 | [`rustix::net::RecvMsg`]: https://docs.rs/rustix/1/rustix/net/struct.RecvMsg.html |
| 137 | |
| 138 | The `flags` field of [`rustix::net::RecvMsg`] changed type from [`RecvFlags`] |
| 139 | to a new [`ReturnFlags`], since it supports a different set of flags. |
| 140 | |
| 141 | [`rustix::net::RecvMsg`]: https://docs.rs/rustix/1/rustix/net/struct.RecvMsg.html |
| 142 | [`RecvFlags`]: https://docs.rs/rustix/1/rustix/net/struct.RecvFlags.html |
| 143 | [`ReturnFlags`]: https://docs.rs/rustix/1/rustix/net/struct.ReturnFlags.html |
| 144 | |
| 145 | [`rustix::event::poll`]'s and [`rustix::event::epoll`]'s `timeout` argument |
| 146 | changed from a `c_int` where `-1` means no timeout and non-negative numbers |
| 147 | mean a timeout in milliseconds to an `Option<&Timespec>`. The [`Timespec`]'s |
| 148 | fields are `tv_sec` which holds seconds and `tv_nsec` which holds nanoseconds. |
| 149 | |
| 150 | [`rustix::event::poll`]: https://docs.rs/rustix/1/rustix/event/fn.poll.html |
| 151 | [`rustix::event::epoll`]: https://docs.rs/rustix/1/rustix/event/epoll/index.html |
| 152 | [`Timespec`]: https://docs.rs/rustix/1/rustix/time/struct.Timespec.html |
| 153 | |
| 154 | The timeout argument in [`rustix::thread::futex::wait`], |
| 155 | [`rustix::thread::futex::lock_pi`], [`rustix::thread::futex::wait_bitset`], |
| 156 | [`rustix::thread::futex::wait_requeue_pi`], and |
| 157 | [`rustix::thread::futex::lock_pi2`] changed from `Option<Timespec>` to |
| 158 | `Option<&Timespec>`, for consistency with the rest of rustix's API, and for |
| 159 | low-level efficiency, as it means the implementation doesn't need to make a |
| 160 | copy of the `Timespec` to take its address. An easy way to convert an |
| 161 | `Option<Timespec>` to an `Option<&Timespec> is to use [`Option::as_ref`]. |
| 162 | |
| 163 | [`rustix::thread::futex::wait`]: https://docs.rs/rustix/1/rustix/thread/futex/fn.wait.html |
| 164 | [`rustix::thread::futex::lock_pi`]: https://docs.rs/rustix/1/rustix/thread/futex/fn.lock_pi.html |
| 165 | [`rustix::thread::futex::wait_bitset`]: https://docs.rs/rustix/1/rustix/thread/futex/fn.wait_bitset.html |
| 166 | [`rustix::thread::futex::wait_requeue_pi`]: https://docs.rs/rustix/1/rustix/thread/futex/fn.wait_requeue_pi.html |
| 167 | [`rustix::thread::futex::lock_pi2`]: https://docs.rs/rustix/1/rustix/thread/futex/fn.lock_pi2.html |
| 168 | [`Option::as_ref`]: https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.as_ref |
| 169 | |
| 170 | Functions in [`rustix::event::port`] are renamed to remove the redundant |
| 171 | `port_*` prefix. |
| 172 | |
| 173 | [`rustix::event::port`]: https://docs.rs/rustix/1/x86_64-unknown-illumos/rustix/event/port/index.html |
| 174 | |
| 175 | `rustix::fs::inotify::InotifyEvent` is renamed to |
| 176 | [`rustix::fs::inotify::Event`] to remove the redundant prefix. |
| 177 | |
| 178 | [`rustix::fs::inotify::Event`]: https://docs.rs/rustix/1/rustix/fs/inotify/struct.Event.html |
| 179 | |
| 180 | `rustix::fs::StatExt` is removed, and the timestamp fields `st_atime`, |
| 181 | `st_mtime`, and `st_ctime` of [`rustix::fs::Stat`] may now be accessed |
| 182 | directly. They are now signed instead of unsigned, so that they can represent |
| 183 | times before the epoch. |
| 184 | |
| 185 | [`rustix::fs::Stat`]: https://docs.rs/rustix/1/rustix/fs/struct.Stat.html |
| 186 | |
| 187 | `rustix::io::is_read_write` is removed, as it's higher-level functionality that |
| 188 | can be implemented in terms of lower-level rustix calls. |
| 189 | |
| 190 | [`rustix::net::recv`] and [`rustix::net::recvfrom`] now include |
| 191 | the number of received bytes in their return types, as this number may differ |
| 192 | from the number of bytes written to the buffer when |
| 193 | [`rustix::net::RecvFlags::TRUNC`] is used. |
| 194 | |
| 195 | [`rustix::net::recv`]: https://docs.rs/rustix/1/rustix/net/fn.recv.html |
| 196 | [`rustix::net::recvfrom`]: https://docs.rs/rustix/1/rustix/net/fn.recvfrom.html |
| 197 | [`rustix::net::RecvFlags::TRUNC`]: https://docs.rs/rustix/1/rustix/net/struct.RecvFlags.html#associatedconstant.TRUNC |
| 198 | |
| 199 | [`rustix::process::Signal`] constants are now upper-cased; for example, |
| 200 | `Signal::Int` is now named [`Signal::INT`]. Also, `Signal` is no longer |
| 201 | directly convertible to `i32`; use [`Signal::as_raw`] instead. |
| 202 | |
| 203 | [`rustix::process::Signal`]: https://docs.rs/rustix/1/rustix/process/struct.Signal.html |
| 204 | [`Signal::INT`]: https://docs.rs/rustix/1/rustix/process/struct.Signal.html#variant.Int |
| 205 | [`Signal::as_raw`]: https://docs.rs/rustix/1/rustix/process/struct.Signal.html#method.as_raw |
| 206 | |
| 207 | `Signal::from_raw` is renamed to [`Signal::from_named_raw`]. |
| 208 | |
| 209 | [`Signal::from_named_raw`]: https://docs.rs/rustix/1/rustix/process/struct.Signal.html#method.from_named_raw |
| 210 | |
| 211 | The associated constant `rustix::ioctl::Ioctl::OPCODE` is now replaced with an |
| 212 | associated method [`rustix::ioctl::Ioctl::opcode`], to support ioctls where the |
| 213 | opcode is computed rather than a constant. |
| 214 | |
| 215 | [`rustix::ioctl::Ioctl::opcode`]: https://docs.rs/rustix/1/rustix/ioctl/trait.Ioctl.html#tymethod.opcode |
| 216 | |
| 217 | The `ifindex` argument in |
| 218 | [`rustix::net::sockopt::set_ip_add_membership_with_ifindex`] and |
| 219 | [`rustix::net::sockopt::set_ip_drop_membership_with_ifindex`] |
| 220 | changed from `i32` to `u32`. |
| 221 | |
| 222 | [`rustix::net::sockopt::set_ip_add_membership_with_ifindex`]: https://docs.rs/rustix/1/rustix/net/sockopt/fn.set_ip_add_membership_with_ifindex.html |
| 223 | [`rustix::net::sockopt::set_ip_drop_membership_with_ifindex`]: https://docs.rs/rustix/1/rustix/net/sockopt/fn.set_ip_drop_membership_with_ifindex.html |
| 224 | |
| 225 | The `list` argument in [`rustix::fs::listxattr`], [`rustix::fs::flistxattr`], |
| 226 | and [`rustix::fs::llistxattr`] changed from `[c_char]`, which is `[i8]` on some |
| 227 | architectures, to `[u8]`. |
| 228 | |
| 229 | [`rustix::fs::listxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.listxattr.html |
| 230 | [`rustix::fs::flistxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.flistxattr.html |
| 231 | [`rustix::fs::llistxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.llistxattr.html |
| 232 | |
| 233 | On NetBSD, the nanoseconds fields of [`Stat`] have been renamed, for consistency |
| 234 | with other platforms: |
| 235 | |
| 236 | | Old name | New Name | |
| 237 | | -------------- | --------------- | |
| 238 | | `st_atimensec` | `st_atime_nsec` | |
| 239 | | `st_mtimensec` | `st_mtime_nsec` | |
| 240 | | `st_ctimensec` | `st_ctime_nsec` | |
| 241 | | `st_birthtimensec` | `st_birthtime_nsec` | |
| 242 | |
| 243 | [`Stat`]: https://docs.rs/rustix/1/x86_64-unknown-netbsd/rustix/fs/struct.Stat.html |
| 244 | |
| 245 | [`rustix::mount::mount`]'s `data` argument is now an `Option`, so it can now |
| 246 | be used in place of `mount2`, and `mount2` is now removed. |
| 247 | |
| 248 | [`rustix::mount::mount`]: https://docs.rs/rustix/1/rustix/mount/fn.mount.html |
| 249 | |
| 250 | The [`rustix::net`] functions ending with `_v4`, `_v6`, `_unix` and `_xdp` have |
| 251 | been merged into a single function that accepts any address type. |
| 252 | |
| 253 | Specifically, the following functions are removed: |
| 254 | |
| 255 | * `bind_any`, `bind_unix`, `bind_v4`, `bind_v6`, `bind_xdp` in favor of |
| 256 | [`bind`], |
| 257 | * `connect_any`, `connect_unix`, `connect_v4`, `connect_v6` in favor of |
| 258 | [`connect`] (leaving address-less [`connect_unspec`]), |
| 259 | * `sendmsg_v4`, `sendmsg_v6`, `sendmsg_unix`, `sendmsg_xdp`, `sendmsg_any` in |
| 260 | favor of [`sendmsg_addr`] (leaving address-less [`sendmsg`]), |
| 261 | * `sendto_any`, `sendto_v4`, `sendto_v6`, `sendto_unix`, `sendto_xdp` in |
| 262 | favor of [`sendto`]. |
| 263 | |
| 264 | [`rustix::net`]: https://docs.rs/rustix/1/rustix/net/index.html |
| 265 | [`bind`]: https://docs.rs/rustix/1/rustix/net/fn.bind.html |
| 266 | [`connect`]: https://docs.rs/rustix/1/rustix/net/fn.connect.html |
| 267 | [`connect_unspec`]: https://docs.rs/rustix/1/rustix/net/fn.connect_unspec.html |
| 268 | [`sendmsg_addr`]: https://docs.rs/rustix/1/rustix/net/fn.sendmsg_addr.html |
| 269 | [`sendmsg`]: https://docs.rs/rustix/1/rustix/net/fn.sendmsg.html |
| 270 | [`sendto`]: https://docs.rs/rustix/1/rustix/net/fn.sendto.html |
| 271 | |
| 272 | The `SocketAddrAny` enum has changed to a [`SocketAddrAny`] struct which can |
| 273 | contain any kind of socket address. It can be converted to and from the more |
| 274 | specific socket types using `From`/`Into`/`TryFrom`/`TryInto` conversions. |
| 275 | |
| 276 | [`SocketAddrAny`]: https://docs.rs/rustix/1/rustix/net/struct.SocketAddrAny.html |
| 277 | |
| 278 | The `len` parameter to [`rustix::fs::fadvise`] has changed from `u64` to |
| 279 | `Option<NonZeroU64>`, to reflect that zero is a special case meaning the |
| 280 | advice applies to the end of the file. To convert an arbitrary `u64` value to |
| 281 | `Option<NonZeroU64>`, use `NonZeroU64::new`. |
| 282 | |
| 283 | [`rustix::fs::fadvise`]: https://docs.rs/rustix/1/rustix/fs/fn.fadvise.html |
| 284 | |
| 285 | [`rustix::io_uring::io_uring_enter`] no longer has `arg` and `size` arguments |
| 286 | providing a raw `*mut c_void` and `usize` describing the argument value. To |
| 287 | pass argumentts, there are now additional functions, `io_uring_enter_sigmask`, |
| 288 | and `io_uring_enter_arg`, which take a [`KernelSigSet`] or an |
| 289 | `io_uring_getevents_arg`, respectively. These are more ergonomic, and provide |
| 290 | a better path to adding `IORING_ENTER_EXT_ARG_REG` support in the future. |
| 291 | |
| 292 | [`rustix::io_uring::io_uring_enter`]: https://docs.rs/rustix/1/rustix/io_uring/fn.io_uring_enter.html |
| 293 | [`KernelSigSet`]: https://docs.rs/rustix/1/rustix/io_uring/struct.KernelSigSet.html |
| 294 | |
| 295 | The [`sigmask`] and [`ts`] fields of [`rustix::io_uring::getevents_arg`] |
| 296 | changed from `u64` to [`rustix::io_uring::io_uring_ptr`], to better preserve |
| 297 | pointer provenance. |
| 298 | |
| 299 | [`sigmask`]: https://docs.rs/rustix/1/rustix/io_uring/struct.io_uring_getevents_arg.html#structfield.sigmask |
| 300 | [`ts`]: https://docs.rs/rustix/1/rustix/io_uring/struct.io_uring_getevents_arg.html#structfield.ts |
| 301 | [`rustix::io_uring::getevents_arg`]: https://docs.rs/rustix/1/rustix/io_uring/struct.io_uring_getevents_arg.html |
| 302 | [`rustix::io_uring::io_uring_ptr`]: https://docs.rs/rustix/1/rustix/io_uring/struct.io_uring_ptr.html |
| 303 | |
| 304 | The aliases for [`fcntl_dupfd_cloexec`], [`fcntl_getfd`], and [`fcntl_setfd`] |
| 305 | in `rustix::fs` are removed; these functions are just available in |
| 306 | [`rustix::io`] now. |
| 307 | |
| 308 | [`fcntl_dupfd_cloexec`]: https://docs.rs/rustix/1/rustix/io/fn.fcntl_dupfd_cloexec.html |
| 309 | [`fcntl_getfd`]: https://docs.rs/rustix/1/rustix/io/fn.fcntl_getfd.html |
| 310 | [`fcntl_setfd`]: https://docs.rs/rustix/1/rustix/io/fn.fcntl_setfd.html |
| 311 | [`rustix::io`]: https://docs.rs/rustix/1/rustix/io/index.html |
| 312 | |
| 313 | [`SocketAddrXdp`] no longer has a shared UMEM field. A new |
| 314 | [`SocketAddrXdpWithSharedUmem`] is added for the purpose of calling `bind` and |
| 315 | passing it an XDP address with a shared UMEM fd. And `SockaddrXdpFlags` is |
| 316 | renamed to [`SocketAddrXdpFlags`]. |
| 317 | |
| 318 | [`SocketAddrXdp`]: https://docs.rs/rustix/1/rustix/net/xdp/struct.SocketAddrXdp.html |
| 319 | [`SocketAddrXdpWithSharedUmem`]: https://docs.rs/rustix/1/rustix/net/xdp/struct.SocketAddrXdpWithSharedUmem.html |
| 320 | [`SocketAddrXdpFlags`]: https://docs.rs/rustix/1/rustix/net/xdp/struct.SocketAddrXdpFlags.html |
| 321 | |
| 322 | [`rustix::io_uring::io_uring_setup`] is now unsafe, due its `io_uring_params` |
| 323 | argument optionally containing a raw file descriptor. |
| 324 | |
| 325 | [`rustix::io_uring::io_uring_setup`]: https://docs.rs/rustix/1/rustix/io_uring/fn.io_uring_setup.html |
| 326 | |
| 327 | The buffer for [`SendAncillaryBuffer`] and [`RecvAncillaryBuffer`] is now |
| 328 | a `[MaybeUninit<u8>]` instead of a `[u8]`. |
| 329 | |
| 330 | [`SendAncillaryBuffer`]: https://docs.rs/rustix/1/rustix/net/struct.SendAncillaryBuffer.html |
| 331 | [`RecvAncillaryBuffer`]: https://docs.rs/rustix/1/rustix/net/struct.RecvAncillaryBuffer.html |
| 332 | |
| 333 | [`read`], [`pread`], [`recv`], [`recvfrom`], [`getrandom`], [`readlinkat_raw`], |
| 334 | [`epoll::wait`], [`kevent`], [`port::getn`], [`getxattr`], [`lgetxattr`], |
| 335 | [`fgetxattr`], [`listxattr`], [`llistxattr`], and [`flistxattr`] now use the |
| 336 | new [`Buffer` trait]. |
| 337 | |
| 338 | This replaces `read_uninit`, `pread_uninit`, `recv_uninit`, `recvfrom_uninit`, |
| 339 | and `getrandom_uninit`, as the `Buffer` trait supports reading into |
| 340 | uninitialized slices. |
| 341 | |
| 342 | `epoll::wait`, `kevent`, and `port::getn` previously took a `Vec` which they |
| 343 | implicitly cleared before results were appended. When passing a `Vec` to |
| 344 | `epoll::wait`, `kevent`, or `port::getn` using [`spare_capacity`], the `Vec` is |
| 345 | not cleared first. Consider clearing the vector before calling `epoll::wait`, |
| 346 | `kevent`, or `port::getn`, or consuming it using `.drain(..)` before reusing it. |
| 347 | |
| 348 | [`read`]: https://docs.rs/rustix/1/rustix/io/fn.read.html |
| 349 | [`pread`]: https://docs.rs/rustix/1/rustix/io/fn.pread.html |
| 350 | [`recv`]: https://docs.rs/rustix/1/rustix/net/fn.recv.html |
| 351 | [`recvfrom`]: https://docs.rs/rustix/1/rustix/net/fn.recvfrom.html |
| 352 | [`getrandom`]: https://docs.rs/rustix/1/rustix/rand/fn.getrandom.html |
| 353 | [`readlinkat_raw`]: https://docs.rs/rustix/1/rustix/fs/fn.readlinkat_raw.html |
| 354 | [`epoll::wait`]: https://docs.rs/rustix/1/rustix/event/epoll/fn.wait.html |
| 355 | [`getxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.getxattr.html |
| 356 | [`lgetxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.lgetxattr.html |
| 357 | [`fgetxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.fgetxattr.html |
| 358 | [`listxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.listxattr.html |
| 359 | [`llistxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.llistxattr.html |
| 360 | [`flistxattr`]: https://docs.rs/rustix/1/rustix/fs/fn.flistxattr.html |
| 361 | [`kevent`]: https://docs.rs/rustix/1/x86_64-unknown-freebsd/rustix/event/kqueue/fn.kevent.html |
| 362 | [`port::getn`]: https://docs.rs/rustix/1/x86_64-unknown-illumos/rustix/event/port/fn.getn.html |
| 363 | [`Buffer` trait]: https://docs.rs/rustix/1/rustix/buffer/trait.Buffer.html |
| 364 | [`spare_capacity`]: https://docs.rs/rustix/1/rustix/buffer/fn.spare_capacity.html |
| 365 | |
| 366 | The [`rustix::ioctl::Opcode`] type has changed from a struct to a raw integer |
| 367 | value, and the associated utilities are change to `const` functions. In place |
| 368 | of `ReadOpcode`, `WriteOpcode`, `ReadWriteOpcode`, and `NoneOpcode`, use the |
| 369 | `read`, `write`, `read_write`, and `none` const functions in the |
| 370 | [`ioctl::opcode`] module. For example, in place of this: |
| 371 | ```rust |
| 372 | ioctl::Setter::<ioctl::ReadOpcode<b'U', 15, c_uint>, c_uint>::new(interface) |
| 373 | ``` |
| 374 | use this: |
| 375 | ```rust |
| 376 | + ioctl::Setter::<{ ioctl::opcode::read::<c_uint>(b'U', 15) }, c_uint>::new(interface) |
| 377 | ``` |
| 378 | . |
| 379 | |
| 380 | In place of `BadOpcode`, use the opcode value directly. |
| 381 | |
| 382 | [`rustix::ioctl::Opcode`]: https://docs.rs/rustix/1/rustix/ioctl/type.Opcode.html |
| 383 | [`ioctl::opcode`]: https://docs.rs/rustix/1/rustix/ioctl/opcode/index.html |
| 384 | |
| 385 | [`rustix::event::port::getn`]'s `min_events` argument is now a `u32`, to |
| 386 | reflect the type in the underlying system API. |
| 387 | |
| 388 | [`rustix::event::port::getn`]: https://docs.rs/rustix/1/x86_64-unknown-illumos/rustix/event/port/fn.getn.html |
| 389 | |
| 390 | All explicitly deprecated functions and types have been removed. Their |
| 391 | deprecation messages will have identified alternatives. |