//! The Unix `ioctl` function is effectively lots of different functions hidden //! behind a single dynamic dispatch interface. In order to provide a type-safe //! API, rustix makes them all separate functions so that they can have //! dedicated static type signatures. //! //! Some ioctls, such as those related to filesystems, terminals, and //! processes, live in other top-level API modules.
#![allow(unsafe_code)]
usecrate::{backend, io, ioctl}; use backend::c; use backend::fd::AsFd;
/// `ioctl(fd, FIOCLEX, NULL)`—Set the close-on-exec flag. /// /// This is similar to `fcntl(fd, F_SETFD, FD_CLOEXEC)`, except that it avoids /// clearing any other flags that might be set. #[cfg(apple)] #[inline] #[doc(alias = "FIOCLEX")] #[doc(alias = "FD_CLOEXEC")] pubfn ioctl_fioclex<Fd: AsFd>(fd: Fd) -> io::Result<()> { // SAFETY: FIOCLEX is a no-argument setter opcode. unsafe { let ctl = ioctl::NoArg::<ioctl::BadOpcode<{ c::FIOCLEX }>>::new();
ioctl::ioctl(fd, ctl)
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.