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 ///
8 /// # References
9 /// - [Linux]
10 ///
11 /// [Linux]: https://man7.org/linux/man-pages/man2/openat2.2.html
12 #[inline]
openat2<Fd: AsFd, P: path::Arg>( dirfd: Fd, path: P, oflags: OFlags, mode: Mode, resolve: ResolveFlags, ) -> io::Result<OwnedFd>13 pub fn openat2<Fd: AsFd, P: path::Arg>(
14 dirfd: Fd,
15 path: P,
16 oflags: OFlags,
17 mode: Mode,
18 resolve: ResolveFlags,
19 ) -> io::Result<OwnedFd> {
20 path.into_with_c_str(|path| {
21 backend::fs::syscalls::openat2(dirfd.as_fd(), path, oflags, mode, resolve)
22 })
23 }
24