Skip to content

Commit b76cbee

Browse files
committed
Merge #739
739: Support features across more platforms r=Susurrus * Exposes `utsname` on all platforms * Expose `signalfd` on Android Closes #607.
2 parents 97caa0c + c787799 commit b76cbee

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1818
([#722](https://github.com/nix-rust/nix/pull/722))
1919
- Added `nix::unistd:fexecve`.
2020
([#727](https://github.com/nix-rust/nix/pull/727))
21+
- Expose `uname()` on all platforms.
22+
([#739](https://github.com/nix-rust/nix/pull/739))
23+
- Expose `signalfd` module on Android as well.
24+
([#739](https://github.com/nix-rust/nix/pull/739))
2125

2226
### Changed
2327
- Renamed existing `ptrace` wrappers to encourage namespacing ([#692](https://github.com/nix-rust/nix/pull/692))

src/sys/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ pub mod memfd;
1818
#[macro_use]
1919
pub mod ioctl;
2020

21-
#[cfg(any(target_os = "linux", target_os = "android"))]
21+
// TODO: Add support for dragonfly, freebsd, and ios/macos.
22+
#[cfg(any(target_os = "android", target_os = "linux"))]
2223
pub mod sendfile;
2324

2425
pub mod signal;
2526

26-
// FIXME: Add to Android once libc#671 lands in a release
27-
#[cfg(target_os = "linux")]
27+
#[cfg(any(target_os = "android", target_os = "linux"))]
2828
pub mod signalfd;
2929

3030
pub mod socket;
@@ -39,7 +39,6 @@ pub mod reboot;
3939

4040
pub mod termios;
4141

42-
#[cfg(any(target_os = "linux", target_os = "android"))]
4342
pub mod utsname;
4443

4544
pub mod wait;

src/sys/utsname.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,21 @@ fn to_str<'a>(s: *const *const c_char) -> &'a str {
5050

5151
#[cfg(test)]
5252
mod test {
53-
use super::uname;
53+
#[cfg(target_os = "linux")]
54+
#[test]
55+
pub fn test_uname_linux() {
56+
assert_eq!(super::uname().sysname(), "Linux");
57+
}
58+
59+
#[cfg(any(target_os = "macos", target_os = "ios"))]
60+
#[test]
61+
pub fn test_uname_darwin() {
62+
assert_eq!(super::uname().sysname(), "Darwin");
63+
}
5464

65+
#[cfg(target_os = "freebsd")]
5566
#[test]
56-
pub fn test_uname() {
57-
assert_eq!(uname().sysname(), "Linux");
67+
pub fn test_uname_freebsd() {
68+
assert_eq!(super::uname().sysname(), "FreeBSD");
5869
}
5970
}

0 commit comments

Comments
 (0)