diff options
author | Ryan Zoeller <rtzoeller@rtzoeller.com> | 2022-01-03 04:25:47 -0600 |
---|---|---|
committer | Ryan Zoeller <rtzoeller@rtzoeller.com> | 2022-01-10 20:14:34 -0600 |
commit | 1b32230831542f060d14b2ad31baf119277f8739 (patch) | |
tree | 0ccb135eecfefa3767098c8e1f666c6fdcd585ca | |
parent | f6268d984489f0304565cf996e3d9396da540a0a (diff) | |
download | nix-1b32230831542f060d14b2ad31baf119277f8739.zip |
Add getresuid/gid and setresuid/gid on BSDs
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/unistd.rs | 26 | ||||
-rw-r--r-- | test/test_unistd.rs | 12 |
3 files changed, 32 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1235a71e..48c803b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). (#[1622](https://github.com/nix-rust/nix/pull/1622)) - Added `sendfile` on DragonFly. (#[1615](https://github.com/nix-rust/nix/pull/1615)) +- Added `getresuid`, `setresuid`, `getresgid`, and `setresgid` on DragonFly, FreeBSD, and OpenBSD. + (#[1628](https://github.com/nix-rust/nix/pull/1628)) ### Changed ### Fixed diff --git a/src/unistd.rs b/src/unistd.rs index 7aa1cffe..8da4f932 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -30,11 +30,18 @@ feature! { pub use self::pivot_root::*; } -#[cfg(any(target_os = "android", target_os = "freebsd", - target_os = "linux", target_os = "openbsd"))] +#[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "openbsd"))] pub use self::setres::*; -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "openbsd"))] pub use self::getres::*; feature! { @@ -2691,8 +2698,11 @@ mod pivot_root { } } -#[cfg(any(target_os = "android", target_os = "freebsd", - target_os = "linux", target_os = "openbsd"))] +#[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "openbsd"))] mod setres { feature! { #![feature = "users"] @@ -2735,7 +2745,11 @@ mod setres { } } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "openbsd"))] mod getres { feature! { #![feature = "users"] diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 59ab24e4..0f56b929 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -621,7 +621,11 @@ fn test_sysconf_unsupported() { } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "openbsd"))] #[test] fn test_getresuid() { let resuids = getresuid().unwrap(); @@ -630,7 +634,11 @@ fn test_getresuid() { assert!(resuids.saved.as_raw() != libc::uid_t::max_value()); } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "linux", + target_os = "openbsd"))] #[test] fn test_getresgid() { let resgids = getresgid().unwrap(); |