summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerts Diepraam <terts.diepraam@gmail.com>2022-08-21 00:37:17 +0200
committerTerts Diepraam <terts.diepraam@gmail.com>2022-08-22 06:32:11 +0200
commit810f74abbe2a8a4657b5f784ba11599f21ab984a (patch)
treeff814dbe2dc26c32ac5dfcbf9a85c633054d7cd8
parent2a8b438860ed37d515ed2cf854a9cd7cfaef35d5 (diff)
downloadnix-810f74abbe2a8a4657b5f784ba11599f21ab984a.zip
add line field to Termios struct
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/sys/termios.rs39
2 files changed, 42 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56ab09ff..6c296fad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased] - ReleaseDate
### Added
+- Added `line_discipline` field to `Termios` on Linux, Android and Haiku
+ ([#1805](https://github.com/nix-rust/nix/pull/1805))
+
### Changed
- The MSRV is now 1.56.1
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index c5b27d28..b4bb3d85 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -181,6 +181,15 @@ pub struct Termios {
pub local_flags: LocalFlags,
/// Control characters (see `termios.c_cc` documentation)
pub control_chars: [libc::cc_t; NCCS],
+ /// Line discipline (see `termios.c_line` documentation)
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ ))]
+ pub line_discipline: libc::cc_t,
+ /// Line discipline (see `termios.c_line` documentation)
+ #[cfg(target_os = "haiku")]
+ pub line_discipline: libc::c_char,
}
impl Termios {
@@ -196,6 +205,14 @@ impl Termios {
termios.c_cflag = self.control_flags.bits();
termios.c_lflag = self.local_flags.bits();
termios.c_cc = self.control_chars;
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ {
+ termios.c_line = self.line_discipline;
+ }
}
self.inner.borrow()
}
@@ -214,6 +231,14 @@ impl Termios {
termios.c_cflag = self.control_flags.bits();
termios.c_lflag = self.local_flags.bits();
termios.c_cc = self.control_chars;
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ {
+ termios.c_line = self.line_discipline;
+ }
}
self.inner.as_ptr()
}
@@ -226,6 +251,14 @@ impl Termios {
self.control_flags = ControlFlags::from_bits_truncate(termios.c_cflag);
self.local_flags = LocalFlags::from_bits_truncate(termios.c_lflag);
self.control_chars = termios.c_cc;
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ {
+ self.line_discipline = termios.c_line;
+ }
}
}
@@ -238,6 +271,12 @@ impl From<libc::termios> for Termios {
control_flags: ControlFlags::from_bits_truncate(termios.c_cflag),
local_flags: LocalFlags::from_bits_truncate(termios.c_lflag),
control_chars: termios.c_cc,
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ line_discipline: termios.c_line,
}
}
}