summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/termios/tc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/termios/tc.rs')
-rw-r--r--vendor/rustix/src/termios/tc.rs80
1 files changed, 80 insertions, 0 deletions
diff --git a/vendor/rustix/src/termios/tc.rs b/vendor/rustix/src/termios/tc.rs
index e1a87b623..12f7f543c 100644
--- a/vendor/rustix/src/termios/tc.rs
+++ b/vendor/rustix/src/termios/tc.rs
@@ -2,6 +2,20 @@ use crate::fd::AsFd;
use crate::process::Pid;
use crate::{backend, io};
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub use backend::termios::types::Termios2;
pub use backend::termios::types::{
Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios, Winsize,
};
@@ -25,6 +39,37 @@ pub fn tcgetattr<Fd: AsFd>(fd: Fd) -> io::Result<Termios> {
backend::termios::syscalls::tcgetattr(fd.as_fd())
}
+/// `tcgetattr2(fd)`—Get terminal attributes.
+///
+/// Also known as the `TCGETS2` operation with `ioctl`.
+///
+/// # References
+/// - [POSIX `tcgetattr`]
+/// - [Linux `ioctl_tty`]
+/// - [Linux `termios`]
+///
+/// [POSIX `tcgetattr`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcgetattr.html
+/// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
+/// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html
+#[inline]
+#[doc(alias = "TCGETS2")]
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub fn tcgetattr2<Fd: AsFd>(fd: Fd) -> io::Result<Termios2> {
+ backend::termios::syscalls::tcgetattr2(fd.as_fd())
+}
+
/// `tcgetwinsize(fd)`—Get the current terminal window size.
///
/// Also known as the `TIOCGWINSZ` operation with `ioctl`.
@@ -96,6 +141,41 @@ pub fn tcsetattr<Fd: AsFd>(
backend::termios::syscalls::tcsetattr(fd.as_fd(), optional_actions, termios)
}
+/// `tcsetattr2(fd)`—Set terminal attributes.
+///
+/// Also known as the `TCSETS2` operation with `ioctl`.
+///
+/// # References
+/// - [POSIX `tcsetattr`]
+/// - [Linux `ioctl_tty`]
+/// - [Linux `termios`]
+///
+/// [POSIX `tcsetattr`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsetattr.html
+/// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
+/// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html
+#[inline]
+#[doc(alias = "TCSETS2")]
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub fn tcsetattr2<Fd: AsFd>(
+ fd: Fd,
+ optional_actions: OptionalActions,
+ termios: &Termios2,
+) -> io::Result<()> {
+ backend::termios::syscalls::tcsetattr2(fd.as_fd(), optional_actions, termios)
+}
+
/// `tcsendbreak(fd, 0)`—Transmit zero-valued bits.
///
/// Also known as the `TCSBRK` operation with `ioctl`, with a duration of 0.