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/process/ioctl.rs | |
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/process/ioctl.rs')
-rw-r--r-- | vendor/rustix/src/process/ioctl.rs | 35 |
1 files changed, 33 insertions, 2 deletions
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: AsFd>(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<Self::Output> { + Ok(()) + } } |