diff --git a/changelog/2767.added.md b/changelog/2767.added.md new file mode 100644 index 0000000000..30d51be770 --- /dev/null +++ b/changelog/2767.added.md @@ -0,0 +1 @@ +Added `getres` and `setres` for Redox OS \ No newline at end of file diff --git a/src/unistd.rs b/src/unistd.rs index e240d8e258..4b313987ea 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -39,10 +39,20 @@ feature! { pub use self::pivot_root::*; } -#[cfg(any(freebsdlike, linux_android, target_os = "openbsd"))] +#[cfg(any( + freebsdlike, + linux_android, + target_os = "openbsd", + target_os = "redox" +))] pub use self::setres::*; -#[cfg(any(freebsdlike, linux_android, target_os = "openbsd"))] +#[cfg(any( + freebsdlike, + linux_android, + target_os = "openbsd", + target_os = "redox" +))] pub use self::getres::*; feature! { @@ -3225,7 +3235,12 @@ mod pivot_root { } } -#[cfg(any(linux_android, freebsdlike, target_os = "openbsd"))] +#[cfg(any( + linux_android, + freebsdlike, + target_os = "openbsd", + target_os = "redox" +))] mod setres { feature! { #![feature = "user"] @@ -3270,7 +3285,12 @@ mod setres { } } -#[cfg(any(linux_android, freebsdlike, target_os = "openbsd"))] +#[cfg(any( + linux_android, + freebsdlike, + target_os = "openbsd", + target_os = "redox" +))] mod getres { feature! { #![feature = "user"] diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 305fc77958..7641752a21 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -721,7 +721,12 @@ fn test_sysconf_unsupported() { assert!(open_max.expect("sysconf failed").is_none()) } -#[cfg(any(linux_android, freebsdlike, target_os = "openbsd"))] +#[cfg(any( + linux_android, + freebsdlike, + target_os = "openbsd", + target_os = "redox" +))] #[test] fn test_getresuid() { let resuids = getresuid().unwrap(); @@ -730,7 +735,12 @@ fn test_getresuid() { assert_ne!(resuids.saved.as_raw(), libc::uid_t::MAX); } -#[cfg(any(linux_android, freebsdlike, target_os = "openbsd"))] +#[cfg(any( + linux_android, + freebsdlike, + target_os = "openbsd", + target_os = "redox" +))] #[test] fn test_getresgid() { let resgids = getresgid().unwrap();