ensure_dir_and_openat

Function ensure_dir_and_openat 

Source
fn ensure_dir_and_openat(
    dirfd: impl AsFd,
    filename: &str,
    flags: OFlags,
) -> Result<OwnedFd>
Expand description

Call openat() on the named subdirectory of “dirfd”, possibly creating it first.

We assume that the directory will probably exist (ie: we try the open first), and on ENOENT, we mkdirat() and retry.