(
dirfd: BorrowedFd<'_>,
path: &CStr,
mut flags: OFlags,
mode: Mode,
resolve: ResolveFlags,
)
| 81 | |
| 82 | #[inline] |
| 83 | pub(crate) fn openat2( |
| 84 | dirfd: BorrowedFd<'_>, |
| 85 | path: &CStr, |
| 86 | mut flags: OFlags, |
| 87 | mode: Mode, |
| 88 | resolve: ResolveFlags, |
| 89 | ) -> io::Result<OwnedFd> { |
| 90 | // Enable support for large files, but not with `O_PATH` because |
| 91 | // `openat2` doesn't like those flags together. |
| 92 | if !flags.contains(OFlags::PATH) { |
| 93 | flags |= OFlags::from_bits_retain(c::O_LARGEFILE); |
| 94 | } |
| 95 | |
| 96 | unsafe { |
| 97 | ret_owned_fd(syscall_readonly!( |
| 98 | __NR_openat2, |
| 99 | dirfd, |
| 100 | path, |
| 101 | by_ref(&open_how { |
| 102 | flags: oflags_for_open_how(flags), |
| 103 | mode: u64::from(mode.bits()), |
| 104 | resolve: resolve.bits(), |
| 105 | }), |
| 106 | size_of::<open_how, _>() |
| 107 | )) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | #[inline] |
| 112 | pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> { |
nothing calls this directly
no test coverage detected