diff --git a/CHANGELOG.md b/CHANGELOG.md index b2ac33412b..e51d6dc3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,12 +40,17 @@ This project adheres to [Semantic Versioning](https://semver.org/). (#[1440](https://github.com/nix-rust/nix/pull/1440)) - Minimum supported Rust version is now 1.41.0. ([#1440](https://github.com/nix-rust/nix/pull/1440)) +- Errno aliases are now associated consts on `Errno`, instead of consts in the + `errno` module.` + (#[1452](https://github.com/nix-rust/nix/pull/1452)) ### Fixed - Allow `sockaddr_ll` size, as reported by the Linux kernel, to be smaller then it's definition (#[1395](https://github.com/nix-rust/nix/pull/1395)) - Fix spurious errors using `sendmmsg` with multiple cmsgs (#[1414](https://github.com/nix-rust/nix/pull/1414)) +- Added `Errno::EOPNOTSUPP` to FreeBSD, where it was missing. + (#[1452](https://github.com/nix-rust/nix/pull/1452)) ### Removed @@ -57,6 +62,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). longer be needed now that async/await are available. `AioCb`s now work exclusively with borrowed buffers, not owned ones. (#[1440](https://github.com/nix-rust/nix/pull/1440)) +- Removed some Errno values from platforms where they aren't actually defined. + (#[1452](https://github.com/nix-rust/nix/pull/1452)) ## [0.20.0] - 20 February 2021 ### Added diff --git a/src/errno.rs b/src/errno.rs index 9275febed1..5b0d61f848 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -843,9 +843,11 @@ mod consts { EHWPOISON = libc::EHWPOISON, } - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - pub const EDEADLOCK: Errno = Errno::EDEADLK; - pub const ENOTSUP: Errno = Errno::EOPNOTSUPP; + impl Errno { + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + pub const EDEADLOCK: Errno = Errno::EDEADLK; + pub const ENOTSUP: Errno = Errno::EOPNOTSUPP; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -1103,11 +1105,11 @@ mod consts { EQFULL = libc::EQFULL, } - pub const ELAST: Errno = Errno::EQFULL; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - pub const EDEADLOCK: Errno = Errno::EDEADLK; - - pub const EL2NSYNC: Errno = Errno::UnknownErrno; + impl Errno { + pub const ELAST: Errno = Errno::EQFULL; + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + pub const EDEADLOCK: Errno = Errno::EDEADLK; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -1328,11 +1330,12 @@ mod consts { EOWNERDEAD = libc::EOWNERDEAD, } - pub const ELAST: Errno = Errno::EOWNERDEAD; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - pub const EDEADLOCK: Errno = Errno::EDEADLK; - - pub const EL2NSYNC: Errno = Errno::UnknownErrno; + impl Errno { + pub const ELAST: Errno = Errno::EOWNERDEAD; + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + pub const EDEADLOCK: Errno = Errno::EDEADLK; + pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -1542,12 +1545,12 @@ mod consts { EASYNC = libc::EASYNC, } - pub const ELAST: Errno = Errno::EASYNC; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - pub const EDEADLOCK: Errno = Errno::EDEADLK; - pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; - - pub const EL2NSYNC: Errno = Errno::UnknownErrno; + impl Errno { + pub const ELAST: Errno = Errno::EASYNC; + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + pub const EDEADLOCK: Errno = Errno::EDEADLK; + pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -1756,10 +1759,10 @@ mod consts { EPROTO = libc::EPROTO, } - pub const ELAST: Errno = Errno::ENOTSUP; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - - pub const EL2NSYNC: Errno = Errno::UnknownErrno; + impl Errno { + pub const ELAST: Errno = Errno::ENOTSUP; + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -1969,10 +1972,10 @@ mod consts { EPROTO = libc::EPROTO, } - pub const ELAST: Errno = Errno::ENOTSUP; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - - pub const EL2NSYNC: Errno = Errno::UnknownErrno; + impl Errno { + pub const ELAST: Errno = Errno::ENOTSUP; + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -2172,10 +2175,9 @@ mod consts { EPROTO = libc::EPROTO, } - pub const ELAST: Errno = Errno::UnknownErrno; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; - - pub const EL2NSYNC: Errno = Errno::UnknownErrno; + impl Errno { + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*; @@ -2400,8 +2402,10 @@ mod consts { ESTALE = libc::ESTALE, } - pub const ELAST: Errno = Errno::ESTALE; - pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + impl Errno { + pub const ELAST: Errno = Errno::ESTALE; + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + } pub fn from_i32(e: i32) -> Errno { use self::Errno::*;