Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several problems with Errno aliases #1452

Merged
merged 3 commits into from
Jun 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
70 changes: 37 additions & 33 deletions src/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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::*;
Expand Down