Skip to content

Support ioctl!(none, ...) with an argument #781

@GabrielMajeri

Description

@GabrielMajeri

The KVM ioctl KVM_GET_API_VERSION is of type none / _IO. I've tried defining it as:

const KVMIO: u8 = 0xAE;
ioctl!(none get_api_version with KVMIO, 0x00);
let version = unsafe { get_api_version(self.fd)? };

However, this fails with EINVAL, since the code in the kernel still expects one i32 parameter, which should be 0.

nix should have some support for an additional parameter with none ioctls. Right now I am manually using libc::ioctl for this, but the macro should support something like

let version = unsafe { get_api_version(self.fd, 0)? };

Or perhaps add a new ioctl type, which is the same as none, but called none_int, which takes the second parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions