metal: unset O_NONBLOCK for DRM file descriptors
This commit is contained in:
parent
2a3a924f7e
commit
3f001588b8
2 changed files with 17 additions and 2 deletions
|
|
@ -2,6 +2,12 @@ use {crate::utils::oserror::OsError, uapi::c};
|
|||
|
||||
pub fn set_nonblock(fd: c::c_int) -> Result<(), OsError> {
|
||||
let fl = uapi::fcntl_getfl(fd)?;
|
||||
uapi::fcntl_setfl(fd, fl | c::SOCK_NONBLOCK)?;
|
||||
uapi::fcntl_setfl(fd, fl | c::O_NONBLOCK)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_block(fd: c::c_int) -> Result<(), OsError> {
|
||||
let fl = uapi::fcntl_getfl(fd)?;
|
||||
uapi::fcntl_setfl(fd, fl & !c::O_NONBLOCK)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue