From e0918dc4d100a03756772fb6ac5152b4019c388d Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Mon, 12 Sep 2022 07:07:36 +0800 Subject: [PATCH] fix issue1814 --- CHANGELOG.md | 2 ++ src/sys/utsname.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aabc244d9..558733d810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ([#1804](https://github.com/nix-rust/nix/pull/1804)) - Added `line_discipline` field to `Termios` on Linux, Android and Haiku ([#1805](https://github.com/nix-rust/nix/pull/1805)) +- Added `domainname` field of `UtsName` on Android and Linux + ([#1817](https://github.com/nix-rust/nix/pull/1817)) ### Changed diff --git a/src/sys/utsname.rs b/src/sys/utsname.rs index 5bd3a539ae..0448cb2990 100644 --- a/src/sys/utsname.rs +++ b/src/sys/utsname.rs @@ -35,6 +35,12 @@ impl UtsName { pub fn machine(&self) -> &OsStr { cast_and_trim(&self.0.machine) } + + /// NIS or YP domain name of this machine. + #[cfg(any(target_os = "android", target_os = "linux"))] + pub fn domainname(&self) -> &OsStr { + cast_and_trim(&self.0.domainname) + } } /// Get system identification