Merge 'core/io: Don't open file as non-blocking in Unix backend' from Pekka Enberg

The Unix backend is a syscall()-based, blocking implementation. The
O_NONBLOCK adds nothing.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #2708
This commit is contained in:
Pekka Enberg
2025-08-21 19:13:39 +03:00
committed by GitHub

View File

@@ -6,7 +6,7 @@ use crate::Result;
use parking_lot::Mutex;
use rustix::{
fd::{AsFd, AsRawFd},
fs::{self, FlockOperation, OFlags, OpenOptionsExt},
fs::{self, FlockOperation},
};
use std::os::fd::RawFd;
@@ -97,7 +97,7 @@ impl IO for UnixIO {
fn open_file(&self, path: &str, flags: OpenFlags, _direct: bool) -> Result<Arc<dyn File>> {
trace!("open_file(path = {})", path);
let mut file = std::fs::File::options();
file.read(true).custom_flags(OFlags::NONBLOCK.bits() as i32);
file.read(true);
if !flags.contains(OpenFlags::ReadOnly) {
file.write(true);