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/process/ioctl.rs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'vendor/rustix/src/process/ioctl.rs') diff --git a/vendor/rustix/src/process/ioctl.rs b/vendor/rustix/src/process/ioctl.rs index cde6b5b3c..3c9d90255 100644 --- a/vendor/rustix/src/process/ioctl.rs +++ b/vendor/rustix/src/process/ioctl.rs @@ -1,4 +1,13 @@ -use crate::{backend, io}; +//! Process-oriented `ioctl`s. +//! +//! # Safety +//! +//! This module invokes `ioctl`s. + +#![allow(unsafe_code)] + +use crate::{backend, io, ioctl}; +use backend::c; use backend::fd::AsFd; /// `ioctl(fd, TIOCSCTTY, 0)`—Sets the controlling terminal for the processs. @@ -17,5 +26,27 @@ use backend::fd::AsFd; #[inline] #[doc(alias = "TIOCSCTTY")] pub fn ioctl_tiocsctty(fd: Fd) -> io::Result<()> { - backend::process::syscalls::ioctl_tiocsctty(fd.as_fd()) + unsafe { ioctl::ioctl(fd, Tiocsctty) } +} + +#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))] +struct Tiocsctty; + +#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))] +unsafe impl ioctl::Ioctl for Tiocsctty { + type Output = (); + + const IS_MUTATING: bool = false; + const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::TIOCSCTTY as ioctl::RawOpcode); + + fn as_ptr(&mut self) -> *mut c::c_void { + (&0u32) as *const u32 as *mut c::c_void + } + + unsafe fn output_from_ptr( + _: ioctl::IoctlOutput, + _: *mut c::c_void, + ) -> io::Result { + Ok(()) + } } -- cgit v1.2.3