jay-compositor 1.14.0

The Jay compositor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use {
    crate::utils::{compat::IoctlNumber, oserror::OsError},
    uapi::c,
};

pub unsafe fn ioctl<T>(fd: c::c_int, request: c::c_ulong, t: &mut T) -> Result<c::c_int, OsError> {
    let mut ret;
    loop {
        ret = unsafe { c::ioctl(fd, request as IoctlNumber, &mut *t) };
        if ret != -1 {
            return Ok(ret);
        }
        let err = uapi::get_errno();
        if not_matches!(err, c::EINTR | c::EAGAIN) {
            return Err(OsError(err));
        }
    }
}