Macro nix::ioctl_write_int [−][src]
macro_rules! ioctl_write_int {
($(#[$attr : meta]) * $name : ident, $ioty : expr, $nr : expr) => { ... };
}
Expand description
Generates a wrapper function for a ioctl that writes an integer to the kernel.
The arguments to this macro are:
- The function name
- The ioctl identifier
- The ioctl sequence number
The generated function has the following signature:
ⓘ
pub unsafe fn FUNCTION_NAME(fd: libc::c_int, data: nix::sys::ioctl::ioctl_param_type) -> Result<libc::c_int>
nix::sys::ioctl::ioctl_param_type
depends on the OS:
- BSD -
libc::c_int
- Linux -
libc::c_ulong
For a more in-depth explanation of ioctls, see ::sys::ioctl
.
Example
const HCI_IOC_MAGIC: u8 = b'k';
const HCI_IOC_HCIDEVUP: u8 = 1;
ioctl_write_int!(hci_dev_up, HCI_IOC_MAGIC, HCI_IOC_HCIDEVUP);