core/io/unix: replace O_NONBLOCK flag from libc with equivalent from rustix

This commit is contained in:
Jorge López 2025-01-13 21:03:05 +01:00
parent 5e9cb58f04
commit 2f90a06533
No known key found for this signature in database
GPG key ID: F8D6CEBC4788D6A1

View file

@ -7,8 +7,7 @@ use log::{debug, trace};
use polling::{Event, Events, Poller};
use rustix::{
fd::{AsFd, AsRawFd},
fs,
fs::{FlockOperation, OpenOptionsExt},
fs::{self, FlockOperation, OFlags, OpenOptionsExt},
io::Errno,
};
use std::cell::RefCell;
@ -38,7 +37,7 @@ impl IO for UnixIO {
trace!("open_file(path = {})", path);
let file = std::fs::File::options()
.read(true)
.custom_flags(libc::O_NONBLOCK)
.custom_flags(OFlags::NONBLOCK.bits() as i32)
.write(true)
.create(matches!(flags, OpenFlags::Create))
.open(path)?;