Sha256: c7f551152d65ac173d9eaa298b964339037b60a7b81e8bc316453718417a6be3

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

//! 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 process.
///
/// # References
///  - [Linux]
///  - [FreeBSD]
///  - [NetBSD]
///  - [OpenBSD]
///
/// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4
/// [NetBSD]: https://man.netbsd.org/tty.4
/// [OpenBSD]: https://man.openbsd.org/tty.4
#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
#[inline]
#[doc(alias = "TIOCSCTTY")]
pub fn ioctl_tiocsctty<Fd: AsFd>(fd: Fd) -> io::Result<()> {
    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 {
        (&0_u32) as *const u32 as *mut c::c_void
    }

    unsafe fn output_from_ptr(
        _: ioctl::IoctlOutput,
        _: *mut c::c_void,
    ) -> io::Result<Self::Output> {
        Ok(())
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/rustix-0.38.44/src/process/ioctl.rs
wasmtime-28.0.0 ./ext/cargo-vendor/rustix-0.38.43/src/process/ioctl.rs
wasmtime-27.0.0 ./ext/cargo-vendor/rustix-0.38.41/src/process/ioctl.rs
wasmtime-26.0.0 ./ext/cargo-vendor/rustix-0.38.37/src/process/ioctl.rs