MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / openat2

Function openat2

src/backend/linux_raw/fs/syscalls.rs:83–109  ·  view source on GitHub ↗
(
    dirfd: BorrowedFd<'_>,
    path: &CStr,
    mut flags: OFlags,
    mode: Mode,
    resolve: ResolveFlags,
)

Source from the content-addressed store, hash-verified

81
82#[inline]
83pub(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]
112pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> {

Callers

nothing calls this directly

Calls 2

containsMethod · 0.80
ret_owned_fdFunction · 0.50

Tested by

no test coverage detected