cap_primitives/rustix/linux/fs/
open_entry_impl.rs1use crate::fs::{manually, open_beneath, OpenOptions};
2use std::ffi::OsStr;
3use std::{fs, io};
4
5pub(crate) fn open_entry_impl(
6 start: &fs::File,
7 path: &OsStr,
8 options: &OpenOptions,
9) -> io::Result<fs::File> {
10 let result = open_beneath(start, path.as_ref(), options);
11
12 match result {
13 Ok(file) => Ok(file),
14 Err(err) => match rustix::io::Errno::from_io_error(&err) {
15 Some(rustix::io::Errno::NOSYS) => manually::open_entry(start, path, options),
16 _ => Err(err),
17 },
18 }
19}