summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/backend/linux_raw/termios/syscalls.rs')
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/syscalls.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
index a8dda5f81..f5643f3c3 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
@@ -42,6 +42,30 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
}
#[inline]
+#[cfg(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> {
+ unsafe {
+ let mut result = MaybeUninit::<crate::termios::Termios2>::uninit();
+ ret(syscall!(
+ __NR_ioctl,
+ fd,
+ c_uint(linux_raw_sys::ioctl::TCGETS2),
+ &mut result
+ ))?;
+ Ok(result.assume_init())
+ }
+}
+
+#[inline]
pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
let mut result = MaybeUninit::<__kernel_pid_t>::uninit();
@@ -78,6 +102,32 @@ pub(crate) fn tcsetattr(
}
#[inline]
+#[cfg(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(syscall_readonly!(
+ __NR_ioctl,
+ fd,
+ c_uint(linux_raw_sys::ioctl::TCSETS2 + optional_actions as u32),
+ by_ref(termios)
+ ))
+ }
+}
+
+#[inline]
pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TCSBRK), c_uint(0))) }
}