diff options
Diffstat (limited to 'vendor/rustix/src/io/ioctl.rs')
-rw-r--r-- | vendor/rustix/src/io/ioctl.rs | 83 |
1 files changed, 7 insertions, 76 deletions
diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs index fde652e19..59cbe1ab5 100644 --- a/vendor/rustix/src/io/ioctl.rs +++ b/vendor/rustix/src/io/ioctl.rs @@ -1,49 +1,14 @@ -//! 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. +//! 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. use crate::{backend, io}; use backend::fd::AsFd; -/// `ioctl(fd, TIOCEXCL)`—Enables exclusive mode on a terminal. -/// -/// # 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 = "haiku", target_os = "redox", target_os = "wasi")))] -#[inline] -#[doc(alias = "TIOCEXCL")] -pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> { - backend::io::syscalls::ioctl_tiocexcl(fd.as_fd()) -} - -/// `ioctl(fd, TIOCNXCL)`—Disables exclusive mode on a terminal. -/// -/// # 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 = "haiku", target_os = "redox", target_os = "wasi")))] -#[inline] -#[doc(alias = "TIOCNXCL")] -pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> { - backend::io::syscalls::ioctl_tiocnxcl(fd.as_fd()) -} - /// `ioctl(fd, FIOCLEX, NULL)`—Set the close-on-exec flag. /// /// Also known as `fcntl(fd, F_SETFD, FD_CLOEXEC)`. @@ -97,42 +62,8 @@ pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2#GENERIC%09IOCTLS /// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS /// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS -#[cfg(not(target_os = "redox"))] #[inline] #[doc(alias = "FIONREAD")] pub fn ioctl_fionread<Fd: AsFd>(fd: Fd) -> io::Result<u64> { backend::io::syscalls::ioctl_fionread(fd.as_fd()) } - -/// `ioctl(fd, BLKSSZGET)`—Returns the logical block size of a block device. -/// -/// This is mentioned in the [Linux `openat` manual page]. -/// -/// [Linux `openat` manual page]: https://man7.org/linux/man-pages/man2/openat.2.html -#[cfg(any(target_os = "android", target_os = "linux"))] -#[inline] -#[doc(alias = "BLKSSZGET")] -pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> { - backend::io::syscalls::ioctl_blksszget(fd.as_fd()) -} - -/// `ioctl(fd, BLKPBSZGET)`—Returns the physical block size of a block device. -#[cfg(any(target_os = "android", target_os = "linux"))] -#[inline] -#[doc(alias = "BLKPBSZGET")] -pub fn ioctl_blkpbszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> { - backend::io::syscalls::ioctl_blkpbszget(fd.as_fd()) -} - -/// `ioctl(fd, FICLONE, src_fd)`—Share data between open files. -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl_ficlone.2.html -#[cfg(any(target_os = "android", target_os = "linux"))] -#[inline] -#[doc(alias = "FICLONE")] -pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result<()> { - backend::io::syscalls::ioctl_ficlone(fd.as_fd(), src_fd.as_fd()) -} |