Skip to content

Commit 7fd7f27

Browse files
authored
Merge branch 'master' into const_timespec
2 parents 7de40a9 + 7033d47 commit 7fd7f27

File tree

6 files changed

+137
-10
lines changed

6 files changed

+137
-10
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ This project adheres to [Semantic Versioning](https://semver.org/).
55

66
## [Unreleased] - ReleaseDate
77
### Added
8+
89
- Added `TimeSpec::from_duration` and `TimeSpec::from_timespec`
910
(#[1465](https://github.com/nix-rust/nix/pull/1465))
1011

12+
- Added `IPV6_V6ONLY` sockopt.
13+
(#[1470](https://github.com/nix-rust/nix/pull/1470))
14+
1115
### Changed
16+
17+
- `FdSet::{contains, highest, fds}` no longer require a mutable reference.
18+
(#[1464](https://github.com/nix-rust/nix/pull/1464))
19+
1220
### Fixed
21+
22+
- Added more errno definitions for better backwards compatibility with
23+
Nix 0.21.0.
24+
(#[1467](https://github.com/nix-rust/nix/pull/1467))
25+
1326
### Removed
1427

1528
## [0.22.0] - 9 July 2021

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ information you can provide, the better.
4141

4242
We use labels to help manage issues. The structure is modeled after
4343
[Rust's issue labeling scheme][rust-labels]:
44-
- **A-**prefixed labels state which area of the project the issue
44+
- **A-** prefixed labels state which area of the project the issue
4545
relates to
46-
- **E-**prefixed labels explain the level of experience necessary to fix the
46+
- **E-** prefixed labels explain the level of experience necessary to fix the
4747
issue
48-
- **O-**prefixed labels specify the OS for issues that are OS-specific
49-
- **R-**prefixed labels specify the architecture for issues that are
48+
- **O-** prefixed labels specify the OS for issues that are OS-specific
49+
- **R-** prefixed labels specify the architecture for issues that are
5050
architecture-specific
5151

5252
[rust-labels]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#issue-triage

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targets = [
2525
]
2626

2727
[dependencies]
28-
libc = { version = "0.2.98", features = [ "extra_traits" ] }
28+
libc = { git = "https://github.com/rust-lang/libc", rev = "9c1489fa8", features = [ "extra_traits" ] }
2929
bitflags = "1.1"
3030
cfg-if = "1.0"
3131

src/errno.rs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,22 @@ mod consts {
905905
EHWPOISON = libc::EHWPOISON,
906906
}
907907

908+
#[deprecated(
909+
since = "0.22.1",
910+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
911+
)]
912+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
913+
#[deprecated(
914+
since = "0.22.1",
915+
note = "use nix::errno::Errno::EDEADLOCK instead"
916+
)]
917+
pub const EDEADLOCK: Errno = Errno::EDEADLK;
918+
#[deprecated(
919+
since = "0.22.1",
920+
note = "use nix::errno::Errno::ENOTSUP instead"
921+
)]
922+
pub const ENOTSUP: Errno = Errno::EOPNOTSUPP;
923+
908924
impl Errno {
909925
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
910926
pub const EDEADLOCK: Errno = Errno::EDEADLK;
@@ -1167,6 +1183,22 @@ mod consts {
11671183
EQFULL = libc::EQFULL,
11681184
}
11691185

1186+
#[deprecated(
1187+
since = "0.22.1",
1188+
note = "use nix::errno::Errno::ELAST instead"
1189+
)]
1190+
pub const ELAST: Errno = Errno::EQFULL;
1191+
#[deprecated(
1192+
since = "0.22.1",
1193+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1194+
)]
1195+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1196+
#[deprecated(
1197+
since = "0.22.1",
1198+
note = "use nix::errno::Errno::EDEADLOCK instead"
1199+
)]
1200+
pub const EDEADLOCK: Errno = Errno::EDEADLK;
1201+
11701202
impl Errno {
11711203
pub const ELAST: Errno = Errno::EQFULL;
11721204
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -1392,6 +1424,27 @@ mod consts {
13921424
EOWNERDEAD = libc::EOWNERDEAD,
13931425
}
13941426

1427+
#[deprecated(
1428+
since = "0.22.1",
1429+
note = "use nix::errno::Errno::ELAST instead"
1430+
)]
1431+
pub const ELAST: Errno = Errno::EOWNERDEAD;
1432+
#[deprecated(
1433+
since = "0.22.1",
1434+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1435+
)]
1436+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1437+
#[deprecated(
1438+
since = "0.22.1",
1439+
note = "use nix::errno::Errno::EDEADLOCK instead"
1440+
)]
1441+
pub const EDEADLOCK: Errno = Errno::EDEADLK;
1442+
#[deprecated(
1443+
since = "0.22.1",
1444+
note = "use nix::errno::Errno::EOPNOTSUPP instead"
1445+
)]
1446+
pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
1447+
13951448
impl Errno {
13961449
pub const ELAST: Errno = Errno::EOWNERDEAD;
13971450
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -1607,6 +1660,27 @@ mod consts {
16071660
EASYNC = libc::EASYNC,
16081661
}
16091662

1663+
#[deprecated(
1664+
since = "0.22.1",
1665+
note = "use nix::errno::Errno::ELAST instead"
1666+
)]
1667+
pub const ELAST: Errno = Errno::EASYNC;
1668+
#[deprecated(
1669+
since = "0.22.1",
1670+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1671+
)]
1672+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1673+
#[deprecated(
1674+
since = "0.22.1",
1675+
note = "use nix::errno::Errno::EDEADLOCK instead"
1676+
)]
1677+
pub const EDEADLOCK: Errno = Errno::EDEADLK;
1678+
#[deprecated(
1679+
since = "0.22.1",
1680+
note = "use nix::errno::Errno::EOPNOTSUPP instead"
1681+
)]
1682+
pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
1683+
16101684
impl Errno {
16111685
pub const ELAST: Errno = Errno::EASYNC;
16121686
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -1821,6 +1895,17 @@ mod consts {
18211895
EPROTO = libc::EPROTO,
18221896
}
18231897

1898+
#[deprecated(
1899+
since = "0.22.1",
1900+
note = "use nix::errno::Errno::ELAST instead"
1901+
)]
1902+
pub const ELAST: Errno = Errno::ENOTSUP;
1903+
#[deprecated(
1904+
since = "0.22.1",
1905+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
1906+
)]
1907+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
1908+
18241909
impl Errno {
18251910
pub const ELAST: Errno = Errno::ENOTSUP;
18261911
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -2034,6 +2119,17 @@ mod consts {
20342119
EPROTO = libc::EPROTO,
20352120
}
20362121

2122+
#[deprecated(
2123+
since = "0.22.1",
2124+
note = "use nix::errno::Errno::ELAST instead"
2125+
)]
2126+
pub const ELAST: Errno = Errno::ENOTSUP;
2127+
#[deprecated(
2128+
since = "0.22.1",
2129+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2130+
)]
2131+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2132+
20372133
impl Errno {
20382134
pub const ELAST: Errno = Errno::ENOTSUP;
20392135
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
@@ -2237,6 +2333,12 @@ mod consts {
22372333
EPROTO = libc::EPROTO,
22382334
}
22392335

2336+
#[deprecated(
2337+
since = "0.22.1",
2338+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2339+
)]
2340+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2341+
22402342
impl Errno {
22412343
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
22422344
}
@@ -2464,6 +2566,17 @@ mod consts {
24642566
ESTALE = libc::ESTALE,
24652567
}
24662568

2569+
#[deprecated(
2570+
since = "0.22.1",
2571+
note = "use nix::errno::Errno::ELAST instead"
2572+
)]
2573+
pub const ELAST: Errno = Errno::ELAST;
2574+
#[deprecated(
2575+
since = "0.22.1",
2576+
note = "use nix::errno::Errno::EWOULDBLOCK instead"
2577+
)]
2578+
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
2579+
24672580
impl Errno {
24682581
pub const ELAST: Errno = Errno::ESTALE;
24692582
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;

src/sys/select.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ impl FdSet {
3232
unsafe { libc::FD_CLR(fd, &mut self.0) };
3333
}
3434

35-
pub fn contains(&mut self, fd: RawFd) -> bool {
36-
unsafe { libc::FD_ISSET(fd, &mut self.0) }
35+
pub fn contains(&self, fd: RawFd) -> bool {
36+
unsafe { libc::FD_ISSET(fd, &self.0) }
3737
}
3838

3939
pub fn clear(&mut self) {
@@ -57,7 +57,7 @@ impl FdSet {
5757
/// ```
5858
///
5959
/// [`select`]: fn.select.html
60-
pub fn highest(&mut self) -> Option<RawFd> {
60+
pub fn highest(&self) -> Option<RawFd> {
6161
self.fds(None).next_back()
6262
}
6363

@@ -79,7 +79,7 @@ impl FdSet {
7979
/// assert_eq!(fds, vec![4, 9]);
8080
/// ```
8181
#[inline]
82-
pub fn fds(&mut self, highest: Option<RawFd>) -> Fds {
82+
pub fn fds(&self, highest: Option<RawFd>) -> Fds {
8383
Fds {
8484
set: self,
8585
range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
@@ -96,7 +96,7 @@ impl Default for FdSet {
9696
/// Iterator over `FdSet`.
9797
#[derive(Debug)]
9898
pub struct Fds<'a> {
99-
set: &'a mut FdSet,
99+
set: &'a FdSet,
100100
range: Range<usize>,
101101
}
102102

src/sys/socket/sockopt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ sockopt_impl!(Both, UdpGsoSegment, libc::SOL_UDP, libc::UDP_SEGMENT, libc::c_int
330330
sockopt_impl!(Both, UdpGroSegment, libc::IPPROTO_UDP, libc::UDP_GRO, bool);
331331
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
332332
sockopt_impl!(Both, RxqOvfl, libc::SOL_SOCKET, libc::SO_RXQ_OVFL, libc::c_int);
333+
sockopt_impl!(Both, Ipv6V6Only, libc::IPPROTO_IPV6, libc::IPV6_V6ONLY, bool);
333334

334335
#[cfg(any(target_os = "android", target_os = "linux"))]
335336
#[derive(Copy, Clone, Debug)]

0 commit comments

Comments
 (0)