summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-06-12 18:52:03 -0600
committerGitHub <noreply@github.com>2021-06-12 18:52:03 -0600
commitaf2ee71318c5da88f764c97069295e8d5c0bd282 (patch)
treeb25e2b034c1e6e064ee119f87a8a859595c55a9e
parent4c15c53fc2c736a686307d46ff1db143a07711eb (diff)
parent6f15bf3f0a3692e9e1e29cd6108d3ee655b370a8 (diff)
downloadnix-af2ee71318c5da88f764c97069295e8d5c0bd282.zip
Merge pull request #1452 from asomers/errno-values
Fix several problems with Errno aliases
-rw-r--r--CHANGELOG.md7
-rw-r--r--src/errno.rs70
2 files changed, 44 insertions, 33 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2ac3341..e51d6dc3 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 9275febe..5b0d61f8 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::*;