summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/libc/termios/syscalls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/backend/libc/termios/syscalls.rs')
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index f54e9a6f3..097d368ed 100644
--- a/vendor/rustix/src/backend/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -27,6 +27,27 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
}
}
+#[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(crate) fn tcgetattr2(fd: BorrowedFd<'_>) -> io::Result<crate::termios::Termios2> {
+ let mut result = MaybeUninit::<crate::termios::Termios2>::uninit();
+ unsafe {
+ ret(c::ioctl(borrowed_fd(fd), c::TCGETS2, result.as_mut_ptr()))?;
+ Ok(result.assume_init())
+ }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
@@ -56,6 +77,33 @@ pub(crate) fn tcsetattr(
}
}
+#[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(crate) fn tcsetattr2(
+ fd: BorrowedFd,
+ optional_actions: OptionalActions,
+ termios: &crate::termios::Termios2,
+) -> io::Result<()> {
+ unsafe {
+ ret(c::ioctl(
+ borrowed_fd(fd),
+ (c::TCSETS2 as u32 + optional_actions as u32) as _,
+ termios,
+ ))
+ }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::tcsendbreak(borrowed_fd(fd), 0)) }