1
0
Fork 0
forked from wry/wry
wry/src/utils/nonblock.rs
2022-03-11 20:04:41 +01:00

8 lines
210 B
Rust

use crate::utils::oserror::OsError;
use 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)?;
Ok(())
}