Macro nix::ioctl_none

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

Generates a wrapper function for an ioctl that passes no data 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) -> Result<libc::c_int>

For a more in-depth explanation of ioctls, see ::sys::ioctl.

Example

The videodev2 driver on Linux defines the log_status ioctl as:

#define VIDIOC_LOG_STATUS         _IO('V', 70)

This can be implemented in Rust like:

ioctl_none!(log_status, b'V', 70);
fn main() {}