qmassa 1.2.0

Terminal-based tool for displaying GPUs usage stats on Linux.
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]

use libc::Ioctl;


// helpers for generating DRM IOCTL request codes
pub const DRM_IOCTL_BASE: Ioctl = 'd' as Ioctl;
pub const DRM_COMMAND_BASE: Ioctl = 0x40;

macro_rules! drm_iow
{
    ($nr: expr, $sz: expr) => {
        ::nix::request_code_write!(
            $crate::drm_drivers::helpers::DRM_IOCTL_BASE,
            $crate::drm_drivers::helpers::DRM_COMMAND_BASE + $nr,
            $sz)
    }
}
pub(crate) use drm_iow;

macro_rules! drm_iowr
{
    ($nr: expr, $sz: expr) => {
        ::nix::request_code_readwrite!(
            $crate::drm_drivers::helpers::DRM_IOCTL_BASE,
            $crate::drm_drivers::helpers::DRM_COMMAND_BASE + $nr,
            $sz)
    }
}
pub(crate) use drm_iowr;

// Retries ioctl() if it's interrupted
macro_rules! drm_ioctl
{
    ($fd: expr, $req: expr, $arg: expr) => {
        {
            let mut ret: ::libc::c_int;

            loop {
                ret = unsafe { ::libc::ioctl($fd, $req, $arg) };

                if ret != -1 {
                    break;
                }

                let enr = ::std::io::Error::last_os_error()
                    .raw_os_error().unwrap();
                if enr != ::libc::EINTR && enr != ::libc::EAGAIN {
                    break;
                }
            }

            ret
        }
    }
}
pub(crate) use drm_ioctl;

// automatically generated by rust-bindgen 0.69.4
#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);

impl<T> __IncompleteArrayField<T> {
    #[inline]
    pub const fn new() -> Self {
        __IncompleteArrayField(::std::marker::PhantomData, [])
    }

    #[inline]
    pub fn as_ptr(&self) -> *const T {
        self as *const _ as *const T
    }

    #[inline]
    pub fn as_mut_ptr(&mut self) -> *mut T {
        self as *mut _ as *mut T
    }

    #[inline]
    pub unsafe fn as_slice(&self, len: usize) -> &[T] {
        ::std::slice::from_raw_parts(self.as_ptr(), len)
    }

    #[inline]
    pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
        ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
    }
}

impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_str("__IncompleteArrayField")
    }
}
// end of code generated by rust-bindgen 0.69.4