summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/process/ioctl.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix/src/process/ioctl.rs')
-rw-r--r--vendor/rustix/src/process/ioctl.rs35
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(())
+ }
}