Skip to content

Commit af13d29

Browse files
authored
Document the changes from 0.38 to 1.0 in CHANGES.md. (#1327)
This documents all the incompatible API changes from 0.38.x to 1.0 that I'm aware of.
1 parent 8a027c3 commit af13d29

File tree

2 files changed

+227
-21
lines changed

2 files changed

+227
-21
lines changed

CHANGELOG.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

CHANGES.md

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
# Changes from 0.38.x to 1.0
2+
3+
## 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.0.0/rustix/pipe/fn.fcntl_setpipe_size.html
9+
10+
## API changes
11+
12+
`rustix::thread::FutexOperation` and `rustix::thread::futex` are removed. Use
13+
the functions in the [`rustix::thread::futex`] module instead.
14+
15+
[`rustix::thread::futex`]: https://docs.rs/rustix/1.0.0/rustix/thread/futex/index.html
16+
17+
[`rustix::process::waitpid`]'s return type changed from `WaitStatus` to
18+
`(Pid, WaitStatus)`, to additionally return the pid of the child.
19+
20+
[`rustix::process::waitpid`]: https://docs.rs/rustix/1.0.0/rustix/process/fn.waitpid.html
21+
22+
The `SLAVE` flag in [`rustix::mount::MountPropagationFlags`] is renamed to
23+
[`DOWNSTREAM`].
24+
25+
[`rustix::mount::MountPropagationFlags`]: https://docs.rs/rustix/1.0.0/rustix/mount/struct.MountPropagationFlags.html
26+
[`DOWNSTREAM`]: https://docs.rs/rustix/1.0.0/rustix/mount/struct.MountPropagationFlags.html#associatedconstant.DOWNSTREAM
27+
28+
The "cc" and "libc-extra-traits" features are removed. The "cc" feature hasn't
29+
had any effect for several major releases. If you need the traits provided by
30+
"libc-extra-traits", you should instead depend on libc directly and enable its
31+
"extra_traits" feature.
32+
33+
`rustix::net::Shutdown::ReadWrite` is renamed to
34+
[`rustix::net::Shutdown::Both`] to [align with std].
35+
36+
[`rustix::net::Shutdown::Both`]: https://docs.rs/rustix/1.0.0/rustix/net/enum.Shutdown.html#variant.Both
37+
[align with std]: https://doc.rust-lang.org/stable/std/net/enum.Shutdown.html#variant.Both
38+
39+
The `rustix::io_uring::io_uring_register_files_skip` function is replaced with
40+
a [`IORING_REGISTER_FILES_SKIP`] constant, similar to the [`rustix::fs::CWD`]
41+
constant.
42+
43+
[`IORING_REGISTER_FILES_SKIP`]: https://docs.rs/rustix/1.0.0/rustix/io_uring/constant.IORING_REGISTER_FILES_SKIP.html
44+
[`rustix::fs::CWD`]: https://docs.rs/rustix/1.0.0/rustix/fs/constant.CWD.html
45+
46+
`rustix::process::WaitidOptions` and `rustix::process::WaitidStatus` are
47+
renamed to
48+
[`rustix::process::WaitIdOptions`] and [`rustix::process::WaitIdStatus`] (note
49+
the capitalization), for consistency with [`crate::process::WaitId`].
50+
51+
[`rustix::process::WaitIdOptions`]: https://docs.rs/rustix/1.0.0/rustix/process/struct.WaitIdOptions.html
52+
[`rustix::process::WaitIdStatus`]: https://docs.rs/rustix/1.0.0/rustix/process/struct.WaitIdStatus.html
53+
[`rustix::process::WaitId`]: https://docs.rs/rustix/1.0.0/rustix/process/enum.WaitId.html
54+
55+
The offsets in [`rustix::fs::SeekFrom::Hole`] and
56+
[`rustix::fs::SeekFrom::Data`] are changed from `i64` to `u64` since they
57+
represent absolute offsets.
58+
59+
[`rustix::fs::SeekFrom::Hole`]: https://docs.rs/rustix/1.0.0/rustix/fs/enum.SeekFrom.html#variant.Hole
60+
[`rustix::fs::SeekFrom::Data`]: https://docs.rs/rustix/1.0.0/rustix/fs/enum.SeekFrom.html#variant.Data
61+
62+
Functions in [`rustix::net::sockopt`] are renamed to remove the `get_` prefix,
63+
to [align with Rust conventions].
64+
65+
[`rustix::net::sockopt`]: https://docs.rs/rustix/1.0.0/rustix/net/sockopt/index.html
66+
[align with Rust conventions]: https://rust-lang.github.io/api-guidelines/naming.html#getter-names-follow-rust-convention-c-getter
67+
68+
`rustix::process::sched_*` and `rustix::process::membarrier_*` are moved from
69+
[`rustix::process`] to [`rustix::thread`], as they operate on the current
70+
thread rather than the current process.
71+
72+
[`rustix::process`]: https://docs.rs/rustix/1.0.0/rustix/process/index.html
73+
[`rustix::thread`]: https://docs.rs/rustix/1.0.0/rustix/thread/index.html
74+
75+
The `udata` in [`rustix::event::kqueue::Event`] is changed from `isize` to
76+
`*mut c_void` to better propagate pointer provenance. To use arbitrary integer
77+
values, convert using the [`without_provenance_mut`] and the [`.addr()`]
78+
functions.
79+
80+
[`rustix::event::kqueue::Event`]: https://docs.rs/rustix/1.0.0/x86_64-unknown-freebsd/rustix/event/kqueue/struct.Event.html
81+
[`without_provenance_mut`]: https://doc.rust-lang.org/stable/std/ptr/fn.without_provenance_mut.html
82+
[`.addr()`]: https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.addr
83+
84+
`rustix::mount::mount_recursive_bind` is renamed to
85+
[`rustix::mount::mount_bind_recursive`]. See [this comment] for details.
86+
87+
[`rustix::mount::mount_bind_recursive`]: https://docs.rs/rustix/1.0.0/rustix/mount/fn.mount_bind_recursive.html
88+
[this comment]: https://github.com/bytecodealliance/rustix/pull/763#issuecomment-1662756184
89+
90+
The `rustix::procfs` is removed. This functionality is now available in the
91+
[rustix-linux-procfs crate].
92+
93+
[rustix-linux-procfs crate]: https://crates.io/crates/rustix-linux-procfs
94+
95+
The `flags` field of [`rustix::net::RecvMsgReturn`] changed type from
96+
[`RecvFlags`] to a new [`ReturnFlags`], since it supports a different set of
97+
flags.
98+
99+
[`rustix::net::RecvMsgReturn`]: https://docs.rs/rustix/1.0.0/rustix/net/struct.RecvMsgReturn.html
100+
[`RecvFlags`]: https://docs.rs/rustix/1.0.0/rustix/net/struct.RecvFlags.html
101+
[`ReturnFlags`]: https://docs.rs/rustix/1.0.0/rustix/net/struct.ReturnFlags.html
102+
103+
[`rustix::event::poll`]'s and [`rustix::event::epoll`]'s `timeout` argument
104+
changed from a `c_int` where `-1` means no timeout and non-negative numbers
105+
mean a timeout in milliseconds to an `Option<&Timespec>`. The [`Timespec`]'s
106+
fields are `tv_sec` which holds seconds and `tv_nsec` which holds nanoseconds.
107+
108+
[`rustix::event::poll`]: https://docs.rs/rustix/1.0.0/rustix/event/fn.poll.html
109+
[`rustix::event::epoll`]: https://docs.rs/rustix/1.0.0/rustix/event/fn.epoll.html
110+
[`Timespec`]: https://docs.rs/rustix/1.0.0/rustix/time/type.Timespec.html
111+
112+
Functions in [`rustix::event::port`] are renamed to remove the redundant
113+
`port_*` prefix.
114+
115+
[`rustix::event::port`]: https://docs.rs/rustix/1.0.0/x86_64-unknown-illumos/rustix/event/port/index.html
116+
117+
`rustix::fs::inotify::InotifyEvent` is renamed to
118+
[`rustix::fs::inotify::Event`] to remove the redundant prefix.
119+
120+
[`rustix::fs::inotify::Event`]: https://docs.rs/rustix/1.0.0/rustix/fs/inotify/struct.Event.html
121+
122+
`rustix::fs::StatExt` is removed, and the timestamp fields `st_atime`,
123+
`st_mtime`, and `st_ctime` of [`rustix::fs::Stat`] may now be accessed
124+
directly. They are now signed instead of unsigned, so that they can represent
125+
times before the epoch.
126+
127+
[`rustix::fs::Stat`]: https://docs.rs/rustix/1.0.0/rustix/fs/type.Stat.html
128+
129+
`rustix::io::is_read_write` is removed, as it's higher-level functionality that
130+
can be implemented in terms of lower-level rustix calls.
131+
132+
[`rustix::net::recv_uninit`] and [`rustix::net::recvfrom_uninit`] now include
133+
the number of received bytes in their return types, as this number may differ
134+
from the number of bytes written to the buffer when
135+
[`rustix::net::RecvFlags::TRUNC`] is used.
136+
137+
[`rustix::net::recv_uninit`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.recv_uninit.html
138+
[`rustix::net::recvfrom_uninit`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.recvfrom_uninit.html
139+
[`rustix::net::RecvFlags::TRUNC`]: https://docs.rs/rustix/1.0.0/rustix/net/struct.RecvFlags.html#associatedconstant.TRUNC
140+
141+
[`rustix::io_uring::io_uring_register`] now has a [`IoringRegisterFlags`]
142+
argument, and `rustix::io_uring::io_uring_register` is removed.
143+
144+
[`rustix::io_uring::io_uring_register`]: https://docs.rs/rustix/1.0.0/rustix/io_uring/fn.io_uring_register.html
145+
[`IoringRegisterFlags`]: https://docs.rs/rustix/1.0.0/rustix/io_uring/struct.IoringRegisterFlags.html
146+
147+
[`rustix::process::Signal`] constants are now upper-cased; for example,
148+
`Signal::Int` is now named [`Signal::INT`]. Also, `Signal` is no longer
149+
directly convertible to `i32`; use [`Signal::as_raw`] instead.
150+
151+
[`rustix::process::Signal`]: https://docs.rs/rustix/1.0.0/rustix/process/enum.Signal.html
152+
[`Signal::INT`]: https://docs.rs/rustix/1.0.0/rustix/process/enum.Signal.html#variant.Int
153+
[`Signal::as_raw`]: https://docs.rs/rustix/1.0.0/rustix/process/enum.Signal.html#method.as_raw
154+
155+
The associated constant `rustix::ioctl::Ioctl::OPCODE` is now replaced with an
156+
associated method [`rustix::ioctl::Ioctl::opcode`], to support ioctls where the
157+
opcode is computed rather than a constant.
158+
159+
[`rustix::ioctl::Ioctl::opcode`]: https://docs.rs/rustix/1.0.0/rustix/ioctl/trait.Ioctl.html#tymethod.opcode
160+
161+
`rustix::net::RecvMsgReturn` is renamed to [`rustix::net::RecvMsg`].
162+
163+
[`rustix::net::RecvMsg`]: https://docs.rs/rustix/1.0.0/rustix/net/struct.RecvMsgReturn.html
164+
165+
The `ifindex` argument in
166+
[`rustix::net::sockopt::set_ip_add_membership_with_ifindex`] and
167+
[`rustix::net::sockopt::set_ip_drop_membership_with_ifindex`]
168+
changed from `i32` to `u32`.
169+
170+
[`rustix::net::sockopt::set_ip_add_membership_with_ifindex`]: https://docs.rs/rustix/1.0.0/rustix/net/sockopt/fn.set_ip_add_membership_with_ifindex.html
171+
[`rustix::net::sockopt::set_ip_drop_membership_with_ifindex`]: https://docs.rs/rustix/1.0.0/rustix/net/sockopt/fn.set_ip_drop_membership_with_ifindex.html
172+
173+
The `list` argument in [`rustix::fs::listxattr`], [`rustix::fs::flistxattr`],
174+
and [`rustix::fs::llistxattr`] changed from `[c_char]`, which is `[i8]` on some
175+
architectures, to [`u8`].
176+
177+
[`rustix::fs::listxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.listxattr.html
178+
[`rustix::fs::flistxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.flistxattr.html
179+
[`rustix::fs::llistxattr`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.llistxattr.html
180+
181+
On NetBSD, the nanoseconds fields of [`Stat`] have been renamed, for consistency
182+
with other platforms:
183+
184+
| Old name | New Name |
185+
| -------------- | --------------- |
186+
| `st_atimensec` | `st_atime_nsec` |
187+
| `st_mtimensec` | `st_mtime_nsec` |
188+
| `st_ctimensec` | `st_ctime_nsec` |
189+
| `st_birthtimensec` | `st_birthtime_nsec` |
190+
191+
[`Stat`]: https://docs.rs/rustix/1.0.0/x86_64-unknown-netbsd/rustix/fs/type.Stat.html
192+
193+
[`rustix::mount::mount`]'s `data` argument is now an `Option`, so it can now
194+
be used in place of `mount2`, and `mount2` is now removed.
195+
196+
[`rustix::mount::mount`]: https://docs.rs/rustix/1.0.0/rustix/mount/fn.mount.html
197+
198+
The [`rustix::net`] functions ending with `_v4`, `_v6`, `_unix` and `_xdp` have
199+
been merged into a single function that accepts any address type.
200+
201+
Specically, the following functions are removed:
202+
203+
* `bind_any`, `bind_unix`, `bind_v4`, `bind_v6`, `bind_xdp` in favor of
204+
[`bind`],
205+
* `connect_any`, `connect_unix`, `connect_v4`, `connect_v6` in favor of
206+
[`connect`] (leaving address-less [`connect_unspec`]),
207+
* `sendmsg_v4`, `sendmsg_v6`, `sendmsg_unix`, `sendmsg_xdp`, `sendmsg_any` in
208+
favor of [`sendmsg_addr`] (leaving address-less [`sendmsg`]),
209+
* `sendto_any`, `sendto_v4`, `sendto_v6`, `sendto_unix`, `sendto_xdp` in
210+
favor of [`sendto`].
211+
212+
[`rustix::net`]: https://docs.rs/rustix/1.0.0/rustix/net/index.html
213+
[`bind`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.bind.html
214+
[`connect`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.connect.html
215+
[`connect_unspec`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.connect_unspec.html
216+
[`sendmsg_addr`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.sendmsg_addr.html
217+
[`sendmsg`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.sendmsg.html
218+
[`sendto`]: https://docs.rs/rustix/1.0.0/rustix/net/fn.sendto.html
219+
220+
The `SocketAddrAny` enum has changed to a [`SocketAddrAny`] struct which can
221+
contain any kind of socket address. It can be converted to and from the more
222+
specific socket types using `From`/`Into`/`TryFrom`/`TryInto` conversions.
223+
224+
[`SocketAddrAny`]: https://docs.rs/rustix/1.0.0/rustix/net/struct.SocketAddrAny.html
225+
226+
All explicitly deprecated functions and types have been removed. Their
227+
deprecation messages will have identified alternatives.

0 commit comments

Comments
 (0)