1#![allow(unsafe_code)]
8
9use crate::{backend, io, ioctl};
10use backend::c;
11use backend::fd::AsFd;
12
13#[cfg(not(any(
26    windows,
27    target_os = "aix",
28    target_os = "horizon",
29    target_os = "redox",
30    target_os = "wasi"
31)))]
32#[inline]
33#[doc(alias = "TIOCSCTTY")]
34pub fn ioctl_tiocsctty<Fd: AsFd>(fd: Fd) -> io::Result<()> {
35    unsafe { ioctl::ioctl(fd, Tiocsctty) }
36}
37
38#[cfg(not(any(
39    windows,
40    target_os = "aix",
41    target_os = "horizon",
42    target_os = "redox",
43    target_os = "wasi"
44)))]
45struct Tiocsctty;
46
47#[cfg(not(any(
48    windows,
49    target_os = "aix",
50    target_os = "horizon",
51    target_os = "redox",
52    target_os = "wasi"
53)))]
54unsafe impl ioctl::Ioctl for Tiocsctty {
55    type Output = ();
56
57    const IS_MUTATING: bool = false;
58
59    fn opcode(&self) -> ioctl::Opcode {
60        c::TIOCSCTTY as ioctl::Opcode
61    }
62
63    fn as_ptr(&mut self) -> *mut c::c_void {
64        crate::utils::as_ptr(&0_u32) as *mut c::c_void
65    }
66
67    unsafe fn output_from_ptr(
68        _: ioctl::IoctlOutput,
69        _: *mut c::c_void,
70    ) -> io::Result<Self::Output> {
71        Ok(())
72    }
73}