diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/rustix/src/termios | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/termios')
-rw-r--r-- | vendor/rustix/src/termios/ioctl.rs | 17 | ||||
-rw-r--r-- | vendor/rustix/src/termios/tty.rs | 11 | ||||
-rw-r--r-- | vendor/rustix/src/termios/types.rs | 12 |
3 files changed, 32 insertions, 8 deletions
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: AsFd>(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::<ioctl::BadOpcode<{ c::TIOCEXCL as _ }>>::new(); + ioctl::ioctl(fd, ctl) + } } /// `ioctl(fd, TIOCNXCL)`—Disables exclusive mode on a terminal. @@ -38,5 +45,9 @@ pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> { #[inline] #[doc(alias = "TIOCNXCL")] pub fn ioctl_tiocnxcl<Fd: AsFd>(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::<ioctl::BadOpcode<{ c::TIOCNXCL as _ }>>::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: AsFd>(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<Fd: AsFd, B: Into<Vec<u8>>>(dirfd: Fd, reuse: B) -> io::Result<CS } #[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] -#[cfg(feature = "procfs")] +#[cfg(all(feature = "alloc", feature = "procfs"))] #[allow(unsafe_code)] fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> { buffer.clear(); @@ -54,9 +54,10 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> { 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; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -504,6 +507,9 @@ bitflags! { target_os = "redox", )))] const VT1 = c::VT1; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -564,6 +570,9 @@ bitflags! { target_os = "redox", )))] const CMSPAR = c::CMSPAR; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } @@ -627,6 +636,9 @@ bitflags! { /// `IEXTEN` const IEXTEN = c::IEXTEN; + + /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags> + const _ = !0; } } |