[][src]Macro nix::ioctl_write_int

macro_rules! ioctl_write_int {
    ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr) => { ... };
}

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:

This example is not tested
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);