diff options
-rw-r--r-- | CHANGELOG.md | 13 | ||||
-rw-r--r-- | CONTRIBUTING.md | 8 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/errno.rs | 113 | ||||
-rw-r--r-- | src/sys/select.rs | 10 | ||||
-rw-r--r-- | src/sys/socket/sockopt.rs | 1 |
6 files changed, 137 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ddef368..03d2ef1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,24 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] - ReleaseDate ### Added + - Added `TimeSpec::from_duration` and `TimeSpec::from_timespec` (#[1465](https://github.com/nix-rust/nix/pull/1465)) +- Added `IPV6_V6ONLY` sockopt. + (#[1470](https://github.com/nix-rust/nix/pull/1470)) + ### Changed + +- `FdSet::{contains, highest, fds}` no longer require a mutable reference. + (#[1464](https://github.com/nix-rust/nix/pull/1464)) + ### Fixed + +- Added more errno definitions for better backwards compatibility with + Nix 0.21.0. + (#[1467](https://github.com/nix-rust/nix/pull/1467)) + ### Removed ## [0.22.0] - 9 July 2021 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55990c4f..00221157 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,12 +41,12 @@ information you can provide, the better. We use labels to help manage issues. The structure is modeled after [Rust's issue labeling scheme][rust-labels]: -- **A-**prefixed labels state which area of the project the issue +- **A-** prefixed labels state which area of the project the issue relates to -- **E-**prefixed labels explain the level of experience necessary to fix the +- **E-** prefixed labels explain the level of experience necessary to fix the issue -- **O-**prefixed labels specify the OS for issues that are OS-specific -- **R-**prefixed labels specify the architecture for issues that are +- **O-** prefixed labels specify the OS for issues that are OS-specific +- **R-** prefixed labels specify the architecture for issues that are architecture-specific [rust-labels]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#issue-triage @@ -25,7 +25,7 @@ targets = [ ] [dependencies] -libc = { version = "0.2.98", features = [ "extra_traits" ] } +libc = { git = "https://github.com/rust-lang/libc", rev = "9c1489fa8", features = [ "extra_traits" ] } bitflags = "1.1" cfg-if = "1.0" diff --git a/src/errno.rs b/src/errno.rs index 00e20140..9c2dfe46 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -905,6 +905,22 @@ mod consts { EHWPOISON = libc::EHWPOISON, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EDEADLOCK instead" + )] + pub const EDEADLOCK: Errno = Errno::EDEADLK; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ENOTSUP instead" + )] + pub const ENOTSUP: Errno = Errno::EOPNOTSUPP; + impl Errno { pub const EWOULDBLOCK: Errno = Errno::EAGAIN; pub const EDEADLOCK: Errno = Errno::EDEADLK; @@ -1167,6 +1183,22 @@ mod consts { EQFULL = libc::EQFULL, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ELAST instead" + )] + pub const ELAST: Errno = Errno::EQFULL; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EDEADLOCK instead" + )] + pub const EDEADLOCK: Errno = Errno::EDEADLK; + impl Errno { pub const ELAST: Errno = Errno::EQFULL; pub const EWOULDBLOCK: Errno = Errno::EAGAIN; @@ -1392,6 +1424,27 @@ mod consts { EOWNERDEAD = libc::EOWNERDEAD, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ELAST instead" + )] + pub const ELAST: Errno = Errno::EOWNERDEAD; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EDEADLOCK instead" + )] + pub const EDEADLOCK: Errno = Errno::EDEADLK; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EOPNOTSUPP instead" + )] + pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; + impl Errno { pub const ELAST: Errno = Errno::EOWNERDEAD; pub const EWOULDBLOCK: Errno = Errno::EAGAIN; @@ -1607,6 +1660,27 @@ mod consts { EASYNC = libc::EASYNC, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ELAST instead" + )] + pub const ELAST: Errno = Errno::EASYNC; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EDEADLOCK instead" + )] + pub const EDEADLOCK: Errno = Errno::EDEADLK; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EOPNOTSUPP instead" + )] + pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; + impl Errno { pub const ELAST: Errno = Errno::EASYNC; pub const EWOULDBLOCK: Errno = Errno::EAGAIN; @@ -1821,6 +1895,17 @@ mod consts { EPROTO = libc::EPROTO, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ELAST instead" + )] + pub const ELAST: Errno = Errno::ENOTSUP; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + impl Errno { pub const ELAST: Errno = Errno::ENOTSUP; pub const EWOULDBLOCK: Errno = Errno::EAGAIN; @@ -2034,6 +2119,17 @@ mod consts { EPROTO = libc::EPROTO, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ELAST instead" + )] + pub const ELAST: Errno = Errno::ENOTSUP; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + impl Errno { pub const ELAST: Errno = Errno::ENOTSUP; pub const EWOULDBLOCK: Errno = Errno::EAGAIN; @@ -2237,6 +2333,12 @@ mod consts { EPROTO = libc::EPROTO, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + impl Errno { pub const EWOULDBLOCK: Errno = Errno::EAGAIN; } @@ -2464,6 +2566,17 @@ mod consts { ESTALE = libc::ESTALE, } + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::ELAST instead" + )] + pub const ELAST: Errno = Errno::ELAST; + #[deprecated( + since = "0.22.1", + note = "use nix::errno::Errno::EWOULDBLOCK instead" + )] + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + impl Errno { pub const ELAST: Errno = Errno::ESTALE; pub const EWOULDBLOCK: Errno = Errno::EAGAIN; diff --git a/src/sys/select.rs b/src/sys/select.rs index 5eb64234..a8035f79 100644 --- a/src/sys/select.rs +++ b/src/sys/select.rs @@ -32,8 +32,8 @@ impl FdSet { unsafe { libc::FD_CLR(fd, &mut self.0) }; } - pub fn contains(&mut self, fd: RawFd) -> bool { - unsafe { libc::FD_ISSET(fd, &mut self.0) } + pub fn contains(&self, fd: RawFd) -> bool { + unsafe { libc::FD_ISSET(fd, &self.0) } } pub fn clear(&mut self) { @@ -57,7 +57,7 @@ impl FdSet { /// ``` /// /// [`select`]: fn.select.html - pub fn highest(&mut self) -> Option<RawFd> { + pub fn highest(&self) -> Option<RawFd> { self.fds(None).next_back() } @@ -79,7 +79,7 @@ impl FdSet { /// assert_eq!(fds, vec![4, 9]); /// ``` #[inline] - pub fn fds(&mut self, highest: Option<RawFd>) -> Fds { + pub fn fds(&self, highest: Option<RawFd>) -> Fds { Fds { set: self, range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE), @@ -96,7 +96,7 @@ impl Default for FdSet { /// Iterator over `FdSet`. #[derive(Debug)] pub struct Fds<'a> { - set: &'a mut FdSet, + set: &'a FdSet, range: Range<usize>, } diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index e2f2cafe..69fe479a 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -330,6 +330,7 @@ sockopt_impl!(Both, UdpGsoSegment, libc::SOL_UDP, libc::UDP_SEGMENT, libc::c_int sockopt_impl!(Both, UdpGroSegment, libc::IPPROTO_UDP, libc::UDP_GRO, bool); #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] sockopt_impl!(Both, RxqOvfl, libc::SOL_SOCKET, libc::SO_RXQ_OVFL, libc::c_int); +sockopt_impl!(Both, Ipv6V6Only, libc::IPPROTO_IPV6, libc::IPV6_V6ONLY, bool); #[cfg(any(target_os = "android", target_os = "linux"))] #[derive(Copy, Clone, Debug)] |