[][src]Function wasi::path_open

pub unsafe fn path_open(
    fd: Fd,
    dirflags: Lookupflags,
    path: &str,
    oflags: Oflags,
    fs_rights_base: Rights,
    fs_rights_inherting: Rights,
    fdflags: Fdflags
) -> Result<Fd>

Open a file or directory. The returned file descriptor is not guaranteed to be the lowest-numbered file descriptor not currently open; it is randomized to prevent applications from depending on making assumptions about indexes, since this is error-prone in multi-threaded contexts. The returned file descriptor is guaranteed to be less than 2**31. Note: This is similar to openat in POSIX.

Parameters

  • dirflags - Flags determining the method of how the path is resolved.
  • path - The relative path of the file or directory to open, relative to the dirfd directory.
  • oflags - The method by which to open the file.
  • fs_rights_base - The initial rights of the newly created file descriptor. The implementation is allowed to return a file descriptor with fewer rights than specified, if and only if those rights do not apply to the type of file being opened. The base rights are rights that will apply to operations using the file descriptor itself, while the inheriting rights are rights that apply to file descriptors derived from it.

Return

  • opened_fd - The file descriptor of the file that has been opened.