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

Function openat2_more

tests/fs/openat2.rs:6–21  ·  view source on GitHub ↗

Like `openat2`, but keep retrying until it fails or succeeds.

(
    dirfd: Fd,
    path: P,
    oflags: OFlags,
    mode: Mode,
    resolve: ResolveFlags,
)

Source from the content-addressed store, hash-verified

4
5/// Like `openat2`, but keep retrying until it fails or succeeds.
6fn openat2_more<Fd: AsFd, P: path::Arg>(
7 dirfd: Fd,
8 path: P,
9 oflags: OFlags,
10 mode: Mode,
11 resolve: ResolveFlags,
12) -> io::Result<OwnedFd> {
13 let path = path.as_cow_c_str().unwrap().into_owned();
14 loop {
15 match openat2(dirfd.as_fd(), &path, oflags, mode, resolve) {
16 Ok(file) => return Ok(file),
17 Err(io::Errno::AGAIN) => continue,
18 Err(err) => return Err(err),
19 }
20 }
21}
22
23#[test]
24fn test_openat2() {

Callers 1

test_openat2Function · 0.85

Calls 3

as_cow_c_strMethod · 0.80
openat2Function · 0.50
as_fdMethod · 0.45

Tested by 1

test_openat2Function · 0.68