/// The datatype used for the ioctl number #[cfg(any(target_os = "android", target_env = "musl"))] #[doc(hidden)] pubtype ioctl_num_type = ::libc::c_int; #[cfg(not(any(target_os = "android", target_env = "musl")))] #[doc(hidden)] pubtype ioctl_num_type = ::libc::c_ulong; /// The datatype used for the 3rd argument #[doc(hidden)] pubtype ioctl_param_type = ::libc::c_ulong;
/// Encode an ioctl command. #[macro_export] #[doc(hidden)]
macro_rules! ioc {
($dir:expr, $ty:expr, $nr:expr, $sz:expr) => {
(($dir as $crate::sys::ioctl::ioctl_num_type
& $crate::sys::ioctl::DIRMASK)
<< $crate::sys::ioctl::DIRSHIFT)
| (($ty as $crate::sys::ioctl::ioctl_num_type
& $crate::sys::ioctl::TYPEMASK)
<< $crate::sys::ioctl::TYPESHIFT)
| (($nr as $crate::sys::ioctl::ioctl_num_type
& $crate::sys::ioctl::NRMASK)
<< $crate::sys::ioctl::NRSHIFT)
| (($sz as $crate::sys::ioctl::ioctl_num_type
& $crate::sys::ioctl::SIZEMASK)
<< $crate::sys::ioctl::SIZESHIFT)
};
}
/// Generate an ioctl request code for a command that passes no data. /// /// This is equivalent to the `_IO()` macro exposed by the C ioctl API. /// /// You should only use this macro directly if the `ioctl` you're working /// with is "bad" and you cannot use `ioctl_none!()` directly. /// /// # Example /// /// ``` /// # #[macro_use] extern crate nix; /// const KVMIO: u8 = 0xAE; /// ioctl_write_int_bad!(kvm_create_vm, request_code_none!(KVMIO, 0x03)); /// # fn main() {} /// ``` #[macro_export(local_inner_macros)]
macro_rules! request_code_none {
($ty:expr, $nr:expr) => {
ioc!($crate::sys::ioctl::NONE, $ty, $nr, 0)
};
}
/// Generate an ioctl request code for a command that reads. /// /// This is equivalent to the `_IOR()` macro exposed by the C ioctl API. /// /// You should only use this macro directly if the `ioctl` you're working /// with is "bad" and you cannot use `ioctl_read!()` directly. /// /// The read/write direction is relative to userland, so this /// command would be userland is reading and the kernel is /// writing. #[macro_export(local_inner_macros)]
macro_rules! request_code_read {
($ty:expr, $nr:expr, $sz:expr) => {
ioc!($crate::sys::ioctl::READ, $ty, $nr, $sz)
};
}
/// Generate an ioctl request code for a command that writes. /// /// This is equivalent to the `_IOW()` macro exposed by the C ioctl API. /// /// You should only use this macro directly if the `ioctl` you're working /// with is "bad" and you cannot use `ioctl_write!()` directly. /// /// The read/write direction is relative to userland, so this /// command would be userland is writing and the kernel is /// reading. #[macro_export(local_inner_macros)]
macro_rules! request_code_write {
($ty:expr, $nr:expr, $sz:expr) => {
ioc!($crate::sys::ioctl::WRITE, $ty, $nr, $sz)
};
}
/// Generate an ioctl request code for a command that reads and writes. /// /// This is equivalent to the `_IOWR()` macro exposed by the C ioctl API. /// /// You should only use this macro directly if the `ioctl` you're working /// with is "bad" and you cannot use `ioctl_readwrite!()` directly. #[macro_export(local_inner_macros)]
macro_rules! request_code_readwrite {
($ty:expr, $nr:expr, $sz:expr) => {
ioc!(
$crate::sys::ioctl::READ | $crate::sys::ioctl::WRITE,
$ty,
$nr,
$sz
)
};
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-19)
¤
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.