Module Uring.Resolve

Flags that can be passed to openat2 to control path resolution.

include FLAGS
type t = private int

A set of flags.

val empty : t
val of_int : int -> t
val (+) : t -> t -> t

a + b is the union of the sets.

val mem : t -> t -> bool

mem x flags is true iff x is a subset of flags.

val beneath : t

beneath does not permit path resolution to succeed if any component of the resolution is not a descendant of the directory indicated by the dirfd passed to the open call. Absolute symbolic links and absolute pathnames will be rejected.

For maximum compatiblity with future Linux kernels, the no_magiclinks flag should be specified along with this one.

val in_root : t

in_root treats the dirfd directory as the root directory while resolving the pathname. Absolute symbolic links are interpreted relative to the dirfd. If a prefix component of the pathname equates to the dirfd, then an immediately following .. component likewise equates to the dirfd (just as /.. is traditionally equivalent to /). An absolute pathname is interpreted relative to the dirfd.

For maximum compatiblity with future Linux kernels, the no_magiclinks flag should be specified along with this one.

no_magiclinks disallows all magic-link resolution during path resolution. Magic-links are symbolic link-like objects that are usually found in the /proc filesystem. Unknowingly opening magic links can be risky for some applications, notably those without a controlling terminal or those within a containerised environment that may provide an escape vector.

no_symlinks disallows the resolution of symbolic links during path resolution, and implies the use of no_magiclinks. If the basename component of the pathname is a symlink, and no_symlinks is specified along with Open_flags.path and Open_flags.nofollow, then a fd referencing the symbolic link will be returned.

Note that the no_symlinks flag affects the treatment of symbolic links in all of the components of pathname. This differs from the effect of the Open_flags.nofollow file creation flag, which affects the handling of symbolic links only in the final component of the pathname.

val no_xdev : t

no_xdev disallows the traversal of mount points during path resolution, including bind mounts The pathname must either be on the same mount as the directory referred to by the dirfd, or on the same mount as the current working directory if dirfd is not specified.

val cached : t

cached makes the open operation fail unless all path components are already present in the kernel lookup cache. Any revalidation or IO needed to satisfy the lookup will result in a Unix.error.EAGAIN error.