版本发布 6
This release introduces the [`Buffer` trait], which is used in [`read`], [`pread`], [`recv`], [`recvfrom`], [`getrandom`], [`readlinkat_raw`], [`epoll::wait`], [`kevent`], [`port::getn`], [`getxattr`], [`lgetxattr`], [`fgetxattr`], [`listxattr`], [`llistxattr`], and [`flistxattr`], and adds support for reading data into uninitialized buffers, as well as safely reading data into the spare capacity of `Vec`s. This release also simplifies the way network addresses are handled. Instead of having separate functions with `_v4`, `_v6`, `_unix`, `_xdp`, and now `_netlink` suffixes, rustix now uses a [`SocketAddrArg` trait] so that functions such as [`bind`], [`connect`], [`sendto`], and [`sendmsg_addr`] can accept any type of address, and are easier to extend to new address types in the future. [`bind`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.bind.html [`connect`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.connect.html [`connect_unspec`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.connect_unspec.html [`sendmsg_addr`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.sendmsg_addr.html [`sendmsg`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.sendmsg.html [`sendto`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.sendto.html And, this release simplifies the `ioctl` API, replacing opcode wrapper types with const generics. This updates several APIs to add Linux 6.13 features, and raw linux-raw-sys types are no longer exposed in the public API, so it should be easier to stay up to date with new Linux releases. And many more new features, bug fixes, and cleanups. See the [CHANGES.md file](https://github.com/bytecodealliance/rustix/blob/main/CHANGES.md#changes-from-038x-to-1x) for the full list of breaking changes. [`read`]: https://docs.rs/rustix/1.0.0/rustix/io/fn.read.html [`pread`]: https://docs.rs/rustix/1.0.0/rustix/io/fn.pread.html [`recv`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.recv.html [`recvfrom`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.recvfrom.html [`getrandom`]: https://docs.rs/rustix/1.0.0/rustix/rand/fn.getrandom.html [`readlinkat_raw`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.readlinkat_raw.html [`epoll::wait`]: https://docs.rs/rustix/1.0.0/rustix/event/epoll/fn.wait.html [`getxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.getxattr.html [`lgetxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.lgetxattr.html [`fgetxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.fgetxattr.html [`listxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.listxattr.html [`llistxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.llistxattr.html [`flistxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.flistxattr.html [`kevent`]: https://docs.rs/rustix/1.0.0/x86_64-unknown-freebsd/rustix/event/kqueue/fn.kevent.html [`port::getn`]: https://docs.rs/rustix/1.0.0/x86_64-unknown-illumos/rustix/event/port/fn.getn.html [`Buffer` trait]: https://docs.rs/rustix/1.0.0/rustix/buffer/trait.Buffer.html [`spare_capacity`]: https://docs.rs/rustix/1.0.0/rustix/buffer/fn.spare_capacity.html [`SocketAddrArg` trait]: https://docs.rs/rustix/1.0.0/rustix/net/trait.SocketAddrArg.html
- Meta: - Rust 1.63 - bitflags 2 - significant compile-time improvements - Some APIs were factored out into new toplevel API modules, with their corresponding cargo feature flags: - `rustix::event`, for `epoll`, `eventfd`, and `poll` - `rustix::pipe`, for `pipe`, `tee`, `splice`, and related functions - `rustix::procfs`, for procfs-related APIs - `rustix::stdio`, for `*std{in,out,err}` - `rustix::system`, for `uname`, `sysinfo`, and `sethostname` - `rustix::io` changes: - `SeekFrom` was moved to `rustix::fs`. - `rustix::net` changes: - `socket` now takes an `Option<Protocol>` and `Protocol` no longer implements `Default`; change `Protocol::default()` to `None`. - `sendmsg_noaddr` is renamed to `sendmsg`. - `getsockopt_nosigpipe` and `setsockopt_nosigpipe` are renamed to `get_socket_nosigpipe` and `set_socket_nosigpipe`. - `AcceptFlags` is renamed to `SocketFlags`. - `rustix::event` changes: - `epoll` changes: - `epoll::epoll_add`, `epoll::epoll_mod`, and `epoll::epoll_del` were renamed to `epoll::add`, `epoll::modify`, and `epoll::delete`. - The `EventVec` iterator now returns `Event`s rather than tuples. - `epoll::Event::data` is changed from a `u64` to a custom `EventData` type which can hold either a `u64` or a `*mut c_void`. - `rustix::fs` changes: - `rustix::fs::chmodat_with` is renamed to `rustix::fs::chmodat`. - `rustix::fs::cwd()` is replaced with `rustix::fs::CWD`. - Non-`*at` versions of several functions that implicitly operate on `CWD` were also added. - `rustix::termios` changes: - The API now fully supports arbitrary speeds. The `cfsetispeed`, `cfsetospeed`, `cfsetspeed`, `tcsetattr2`, and `tcgetattr2` functions, as well as the `CBAUD` and `CIBAUD` constants, are replaced by `set_input_speed`, `set_output_speed`, and `set_speed` functions on `Termios`. - The speed macros such as `B9600` are no longer required (`B9600` now always has the value 9600, and so on for all the other speed macros), but they can still be used. They're now in the `rustix::termios::speed` module. - `cfmakeraw` is now called `Termios::make_raw`. - `rustix::process` changes: - `Pid::from_raw` is no longer `unsafe`. - `Pid::from_raw_nonzero` is removed, and a new `Pid::from_raw_unchecked` is added. - `ReaperStatus::pid` is now an `Option<Pid>`, as the OS doesn't always provide it. - `rustix::io_uring` changes: - `io_uring_cqe` now supports the `big_cqe` field, and no longer implements `Copy` and `Clone`.
- Fix decoding of abstract unix sockets (#661) - Fix the fstat/statat/etc. fallback when statx fails with EPERM. (#666) - Add a `rustix::pty` module. (#673) - process: Add aliaseses for `parent_process_death_signal` (#677) - Fix panic on dropping `RecvAncillaryBuffer` after failed `recvmsg` (#676)
## What's Changed * Fix no-std builds for MacOS and BSDs by @niluxv in https://github.com/bytecodealliance/rustix/pull/647 * Make `linkat`, `unlinkat`, and `renameat` weak on macos. by @sunfishcode in https://github.com/bytecodealliance/rustix/pull/649 **Full Changelog**: https://github.com/bytecodealliance/rustix/compare/v0.37.18...v0.37.19
- Fixes undefined references to `pwritev64v2`, `preadv64v2`, `getauxval`, and `setns` on older glibc versions (#535 and #556) - Hopefully fixes the intermittent build errors (#544)
New features: - solaris ports API - FreeBSD kqueue API - Expanded io_uring coverage - termios2, inotify, pidfd_open, witid, set{u,g}id, cap{g,s}et, unmount - `SO_NOSIGPIPE`, `SEEK_DATA`, `SEEK_HOLE` - A new `linux_4_11` cargo feature to optimize for Linux versions >= 4.11. Changes: - stdout/etc. are now a safe functions (in "std" mode) (#519) - epoll no longer has a context (#487) - `copy_file_range`'s `len` argument changed from `u64` to `usize` (#499) - `io_uring::IoringRecvsendFlags` is now split into separate send and receive types. (#553) - `fs::seek` now uses Rustix's own `SeekFrom` type rather than `std::io::SeekFrom` (#486) - Some of the Linux capabilities functions were renamed. (#500) And many bug fixes, including hopefully a fix for the intermittent build failures (#526).