rustix/process/
ioctl.rs
1#![allow(unsafe_code)]
8
9use crate::{backend, io, ioctl};
10use backend::c;
11use backend::fd::AsFd;
12
13#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
26#[inline]
27#[doc(alias = "TIOCSCTTY")]
28pub fn ioctl_tiocsctty<Fd: AsFd>(fd: Fd) -> io::Result<()> {
29 unsafe { ioctl::ioctl(fd, Tiocsctty) }
30}
31
32#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
33struct Tiocsctty;
34
35#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
36unsafe impl ioctl::Ioctl for Tiocsctty {
37 type Output = ();
38
39 const IS_MUTATING: bool = false;
40 const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::TIOCSCTTY as ioctl::RawOpcode);
41
42 fn as_ptr(&mut self) -> *mut c::c_void {
43 (&0_u32) as *const u32 as *mut c::c_void
44 }
45
46 unsafe fn output_from_ptr(
47 _: ioctl::IoctlOutput,
48 _: *mut c::c_void,
49 ) -> io::Result<Self::Output> {
50 Ok(())
51 }
52}