/rust/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-1.1.2/src/fs/openat2.rs
Line | Count | Source |
1 | | use crate::fd::OwnedFd; |
2 | | use crate::{backend, io, path}; |
3 | | use backend::fd::AsFd; |
4 | | use backend::fs::types::{Mode, OFlags, ResolveFlags}; |
5 | | |
6 | | /// `openat2(dirfd, path, OpenHow { oflags, mode, resolve }, sizeof(OpenHow))`— |
7 | | /// Opens a file with more options. |
8 | | /// |
9 | | /// # References |
10 | | /// - [Linux] |
11 | | /// |
12 | | /// [Linux]: https://man7.org/linux/man-pages/man2/openat2.2.html |
13 | | #[inline] |
14 | 0 | pub fn openat2<Fd: AsFd, P: path::Arg>( |
15 | 0 | dirfd: Fd, |
16 | 0 | path: P, |
17 | 0 | oflags: OFlags, |
18 | 0 | mode: Mode, |
19 | 0 | resolve: ResolveFlags, |
20 | 0 | ) -> io::Result<OwnedFd> { |
21 | 0 | path.into_with_c_str(|path| { |
22 | 0 | backend::fs::syscalls::openat2(dirfd.as_fd(), path, oflags, mode, resolve) |
23 | 0 | }) |
24 | 0 | } |