Skip to content

Commit b641788

Browse files
bors[bot]rtzoeller
andauthored
Merge #1628
1628: Add getresuid/gid and setresuid/gid on BSDs r=asomers a=rtzoeller Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
2 parents f6268d9 + 1b32230 commit b641788

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3131
(#[1622](https://github.com/nix-rust/nix/pull/1622))
3232
- Added `sendfile` on DragonFly.
3333
(#[1615](https://github.com/nix-rust/nix/pull/1615))
34+
- Added `getresuid`, `setresuid`, `getresgid`, and `setresgid` on DragonFly, FreeBSD, and OpenBSD.
35+
(#[1628](https://github.com/nix-rust/nix/pull/1628))
3436

3537
### Changed
3638
### Fixed

src/unistd.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ feature! {
3030
pub use self::pivot_root::*;
3131
}
3232

33-
#[cfg(any(target_os = "android", target_os = "freebsd",
34-
target_os = "linux", target_os = "openbsd"))]
33+
#[cfg(any(target_os = "android",
34+
target_os = "dragonfly",
35+
target_os = "freebsd",
36+
target_os = "linux",
37+
target_os = "openbsd"))]
3538
pub use self::setres::*;
3639

37-
#[cfg(any(target_os = "android", target_os = "linux"))]
40+
#[cfg(any(target_os = "android",
41+
target_os = "dragonfly",
42+
target_os = "freebsd",
43+
target_os = "linux",
44+
target_os = "openbsd"))]
3845
pub use self::getres::*;
3946

4047
feature! {
@@ -2691,8 +2698,11 @@ mod pivot_root {
26912698
}
26922699
}
26932700

2694-
#[cfg(any(target_os = "android", target_os = "freebsd",
2695-
target_os = "linux", target_os = "openbsd"))]
2701+
#[cfg(any(target_os = "android",
2702+
target_os = "dragonfly",
2703+
target_os = "freebsd",
2704+
target_os = "linux",
2705+
target_os = "openbsd"))]
26962706
mod setres {
26972707
feature! {
26982708
#![feature = "users"]
@@ -2735,7 +2745,11 @@ mod setres {
27352745
}
27362746
}
27372747

2738-
#[cfg(any(target_os = "android", target_os = "linux"))]
2748+
#[cfg(any(target_os = "android",
2749+
target_os = "dragonfly",
2750+
target_os = "freebsd",
2751+
target_os = "linux",
2752+
target_os = "openbsd"))]
27392753
mod getres {
27402754
feature! {
27412755
#![feature = "users"]

test/test_unistd.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,11 @@ fn test_sysconf_unsupported() {
621621
}
622622

623623

624-
#[cfg(any(target_os = "android", target_os = "linux"))]
624+
#[cfg(any(target_os = "android",
625+
target_os = "dragonfly",
626+
target_os = "freebsd",
627+
target_os = "linux",
628+
target_os = "openbsd"))]
625629
#[test]
626630
fn test_getresuid() {
627631
let resuids = getresuid().unwrap();
@@ -630,7 +634,11 @@ fn test_getresuid() {
630634
assert!(resuids.saved.as_raw() != libc::uid_t::max_value());
631635
}
632636

633-
#[cfg(any(target_os = "android", target_os = "linux"))]
637+
#[cfg(any(target_os = "android",
638+
target_os = "dragonfly",
639+
target_os = "freebsd",
640+
target_os = "linux",
641+
target_os = "openbsd"))]
634642
#[test]
635643
fn test_getresgid() {
636644
let resgids = getresgid().unwrap();

0 commit comments

Comments
 (0)