Skip to content

Commit 0059ddf

Browse files
bors[bot]Jenn Wheeler
andcommitted
Merge #1036
1036: Add several errno values for OpenBSD r=asomers a=sourgrasses It looks like OpenBSD added several new errno values in 6.2, and they've already been added to `libc`, so this should allow any crates using those to build on OpenBSD. Co-authored-by: Jenn Wheeler <jwheeler@antiochcollege.edu>
2 parents 871e570 + c690968 commit 0059ddf

File tree

2 files changed

+76
-23
lines changed

2 files changed

+76
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1515
([#1034](https://github.com/nix-rust/nix/pull/1034))
1616
- Added ENOTSUP errno support for Linux and Android.
1717
([#969](https://github.com/nix-rust/nix/pull/969))
18+
- Add several errno constants from OpenBSD 6.2
19+
([#1036](https://github.com/nix-rust/nix/pull/1036))
1820

1921
### Changed
2022
- `PollFd` event flags renamed to `PollFlags` ([#1024](https://github.com/nix-rust/nix/pull/1024/))

src/errno.rs

Lines changed: 74 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ fn desc(errno: Errno) -> &'static str {
360360
#[cfg(any(target_os = "linux", target_os = "android"))]
361361
EDQUOT => "Quota exceeded",
362362

363-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd", target_os = "dragonfly"))]
363+
#[cfg(any(target_os = "linux", target_os = "android",
364+
target_os = "openbsd", target_os = "dragonfly"))]
364365
ENOMEDIUM => "No medium found",
365366

366367
#[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd"))]
@@ -408,70 +409,112 @@ fn desc(errno: Errno) -> &'static str {
408409
#[cfg(target_os = "freebsd")]
409410
ECAPMODE => "Not permitted in capability mode",
410411

411-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
412+
#[cfg(any(target_os = "macos", target_os = "freebsd",
413+
target_os = "dragonfly", target_os = "ios",
414+
target_os = "openbsd", target_os = "netbsd"))]
412415
ENEEDAUTH => "Need authenticator",
413416

414-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
417+
#[cfg(any(target_os = "macos", target_os = "freebsd",
418+
target_os = "dragonfly", target_os = "ios",
419+
target_os = "openbsd", target_os = "netbsd"))]
415420
EOVERFLOW => "Value too large to be stored in data type",
416421

417-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "netbsd"))]
422+
#[cfg(any(target_os = "macos", target_os = "freebsd",
423+
target_os = "dragonfly", target_os = "ios",
424+
target_os = "netbsd"))]
418425
EILSEQ => "Illegal byte sequence",
419426

420-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
427+
#[cfg(any(target_os = "macos", target_os = "freebsd",
428+
target_os = "dragonfly", target_os = "ios",
429+
target_os = "openbsd", target_os = "netbsd"))]
421430
ENOATTR => "Attribute not found",
422431

423-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "netbsd"))]
432+
#[cfg(any(target_os = "macos", target_os = "freebsd",
433+
target_os = "dragonfly", target_os = "ios",
434+
target_os = "openbsd", target_os = "netbsd"))]
424435
EBADMSG => "Bad message",
425436

426-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "netbsd"))]
437+
#[cfg(any(target_os = "macos", target_os = "freebsd",
438+
target_os = "dragonfly", target_os = "ios",
439+
target_os = "openbsd", target_os = "netbsd"))]
427440
EPROTO => "Protocol error",
428441

429-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "ios"))]
442+
#[cfg(any(target_os = "macos", target_os = "freebsd",
443+
target_os = "ios", target_os = "openbsd", ))]
430444
ENOTRECOVERABLE => "State not recoverable",
431445

432-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "ios"))]
446+
#[cfg(any(target_os = "macos", target_os = "freebsd",
447+
target_os = "ios", target_os = "openbsd"))]
433448
EOWNERDEAD => "Previous owner died",
434449

435-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
450+
#[cfg(any(target_os = "macos", target_os = "freebsd",
451+
target_os = "dragonfly", target_os = "ios",
452+
target_os = "openbsd", target_os = "netbsd"))]
436453
ENOTSUP => "Operation not supported",
437454

438-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
455+
#[cfg(any(target_os = "macos", target_os = "freebsd",
456+
target_os = "dragonfly", target_os = "ios",
457+
target_os = "openbsd", target_os = "netbsd"))]
439458
EPROCLIM => "Too many processes",
440459

441-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
460+
#[cfg(any(target_os = "macos", target_os = "freebsd",
461+
target_os = "dragonfly", target_os = "ios",
462+
target_os = "openbsd", target_os = "netbsd"))]
442463
EUSERS => "Too many users",
443464

444-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
465+
#[cfg(any(target_os = "macos", target_os = "freebsd",
466+
target_os = "dragonfly", target_os = "ios",
467+
target_os = "openbsd", target_os = "netbsd"))]
445468
EDQUOT => "Disc quota exceeded",
446469

447-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
470+
#[cfg(any(target_os = "macos", target_os = "freebsd",
471+
target_os = "dragonfly", target_os = "ios",
472+
target_os = "openbsd", target_os = "netbsd"))]
448473
ESTALE => "Stale NFS file handle",
449474

450-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
475+
#[cfg(any(target_os = "macos", target_os = "freebsd",
476+
target_os = "dragonfly", target_os = "ios",
477+
target_os = "openbsd", target_os = "netbsd"))]
451478
EREMOTE => "Too many levels of remote in path",
452479

453-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
480+
#[cfg(any(target_os = "macos", target_os = "freebsd",
481+
target_os = "dragonfly", target_os = "ios",
482+
target_os = "openbsd", target_os = "netbsd"))]
454483
EBADRPC => "RPC struct is bad",
455484

456-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
485+
#[cfg(any(target_os = "macos", target_os = "freebsd",
486+
target_os = "dragonfly", target_os = "ios",
487+
target_os = "openbsd", target_os = "netbsd"))]
457488
ERPCMISMATCH => "RPC version wrong",
458489

459-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
490+
#[cfg(any(target_os = "macos", target_os = "freebsd",
491+
target_os = "dragonfly", target_os = "ios",
492+
target_os = "openbsd", target_os = "netbsd"))]
460493
EPROGUNAVAIL => "RPC prog. not avail",
461494

462-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
495+
#[cfg(any(target_os = "macos", target_os = "freebsd",
496+
target_os = "dragonfly", target_os = "ios",
497+
target_os = "openbsd", target_os = "netbsd"))]
463498
EPROGMISMATCH => "Program version wrong",
464499

465-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
500+
#[cfg(any(target_os = "macos", target_os = "freebsd",
501+
target_os = "dragonfly", target_os = "ios",
502+
target_os = "openbsd", target_os = "netbsd"))]
466503
EPROCUNAVAIL => "Bad procedure for program",
467504

468-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
505+
#[cfg(any(target_os = "macos", target_os = "freebsd",
506+
target_os = "dragonfly", target_os = "ios",
507+
target_os = "openbsd", target_os = "netbsd"))]
469508
EFTYPE => "Inappropriate file type or format",
470509

471-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
510+
#[cfg(any(target_os = "macos", target_os = "freebsd",
511+
target_os = "dragonfly", target_os = "ios",
512+
target_os = "openbsd", target_os = "netbsd"))]
472513
EAUTH => "Authentication error",
473514

474-
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
515+
#[cfg(any(target_os = "macos", target_os = "freebsd",
516+
target_os = "dragonfly", target_os = "ios",
517+
target_os = "openbsd", target_os = "netbsd"))]
475518
ECANCELED => "Operation canceled",
476519

477520
#[cfg(any(target_os = "macos", target_os = "ios"))]
@@ -1588,6 +1631,10 @@ mod consts {
15881631
EIDRM = libc::EIDRM,
15891632
ENOMSG = libc::ENOMSG,
15901633
ENOTSUP = libc::ENOTSUP,
1634+
EBADMSG = libc::EBADMSG,
1635+
ENOTRECOVERABLE = libc::ENOTRECOVERABLE,
1636+
EOWNERDEAD = libc::EOWNERDEAD,
1637+
EPROTO = libc::EPROTO,
15911638
}
15921639

15931640
pub const ELAST: Errno = Errno::ENOTSUP;
@@ -1690,6 +1737,10 @@ mod consts {
16901737
libc::EIDRM => EIDRM,
16911738
libc::ENOMSG => ENOMSG,
16921739
libc::ENOTSUP => ENOTSUP,
1740+
libc::EBADMSG => EBADMSG,
1741+
libc::ENOTRECOVERABLE => ENOTRECOVERABLE,
1742+
libc::EOWNERDEAD => EOWNERDEAD,
1743+
libc::EPROTO => EPROTO,
16931744
_ => UnknownErrno,
16941745
}
16951746
}

0 commit comments

Comments
 (0)