From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/rustix/src/termios/ioctl.rs | 17 ++++++++++++++--- vendor/rustix/src/termios/tty.rs | 11 ++++++----- vendor/rustix/src/termios/types.rs | 12 ++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) (limited to 'vendor/rustix/src/termios') diff --git a/vendor/rustix/src/termios/ioctl.rs b/vendor/rustix/src/termios/ioctl.rs index 1c60cb9a4..620ae4c71 100644 --- a/vendor/rustix/src/termios/ioctl.rs +++ b/vendor/rustix/src/termios/ioctl.rs @@ -1,7 +1,10 @@ //! Terminal-related `ioctl` functions. +#![allow(unsafe_code)] + use crate::fd::AsFd; -use crate::{backend, io}; +use crate::{backend, io, ioctl}; +use backend::c; /// `ioctl(fd, TIOCEXCL)`—Enables exclusive mode on a terminal. /// @@ -19,7 +22,11 @@ use crate::{backend, io}; #[inline] #[doc(alias = "TIOCEXCL")] pub fn ioctl_tiocexcl(fd: Fd) -> io::Result<()> { - backend::termios::syscalls::ioctl_tiocexcl(fd.as_fd()) + // SAFETY: TIOCEXCL is a no-argument setter opcode. + unsafe { + let ctl = ioctl::NoArg::>::new(); + ioctl::ioctl(fd, ctl) + } } /// `ioctl(fd, TIOCNXCL)`—Disables exclusive mode on a terminal. @@ -38,5 +45,9 @@ pub fn ioctl_tiocexcl(fd: Fd) -> io::Result<()> { #[inline] #[doc(alias = "TIOCNXCL")] pub fn ioctl_tiocnxcl(fd: Fd) -> io::Result<()> { - backend::termios::syscalls::ioctl_tiocnxcl(fd.as_fd()) + // SAFETY: TIOCNXCL is a no-argument setter opcode. + unsafe { + let ctl = ioctl::NoArg::>::new(); + ioctl::ioctl(fd, ctl) + } } diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs index 00787a568..56aab9fcf 100644 --- a/vendor/rustix/src/termios/tty.rs +++ b/vendor/rustix/src/termios/tty.rs @@ -2,7 +2,7 @@ use crate::backend; use backend::fd::AsFd; -#[cfg(feature = "procfs")] +#[cfg(all(feature = "alloc", feature = "procfs"))] #[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] use { crate::ffi::CString, crate::io, crate::path::SMALL_PATH_BUFFER_SIZE, alloc::vec::Vec, @@ -33,7 +33,7 @@ pub fn isatty(fd: Fd) -> bool { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/ttyname.html /// [Linux]: https://man7.org/linux/man-pages/man3/ttyname.3.html #[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] -#[cfg(feature = "procfs")] +#[cfg(all(feature = "alloc", feature = "procfs"))] #[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))] #[doc(alias = "ttyname_r")] #[inline] @@ -42,7 +42,7 @@ pub fn ttyname>>(dirfd: Fd, reuse: B) -> io::Result, mut buffer: Vec) -> io::Result { buffer.clear(); @@ -54,9 +54,10 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec) -> io::Result { buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation strategy to grow capacity exponentially } Ok(len) => { - // SAFETY: assume the backend returns the length of the string + // SAFETY: assume the backend returns the length of the string excluding the + // NUL. unsafe { - buffer.set_len(len); + buffer.set_len(len + 1); } // SAFETY: diff --git a/vendor/rustix/src/termios/types.rs b/vendor/rustix/src/termios/types.rs index 8b7d473cf..0c44ed2e8 100644 --- a/vendor/rustix/src/termios/types.rs +++ b/vendor/rustix/src/termios/types.rs @@ -292,6 +292,9 @@ bitflags! { target_os = "redox", )))] const IUTF8 = c::IUTF8; + + /// + const _ = !0; } } @@ -504,6 +507,9 @@ bitflags! { target_os = "redox", )))] const VT1 = c::VT1; + + /// + const _ = !0; } } @@ -564,6 +570,9 @@ bitflags! { target_os = "redox", )))] const CMSPAR = c::CMSPAR; + + /// + const _ = !0; } } @@ -627,6 +636,9 @@ bitflags! { /// `IEXTEN` const IEXTEN = c::IEXTEN; + + /// + const _ = !0; } } -- cgit v1.2.3