package uring

  1. Overview
  2. Docs

Flags that can be passed to openat2.

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 append : t

append repositions the file offset to the end of the file before every write. This should be used with caution with io_uring.

val cloexec : t

cloexec enables the close-on-exec flag for the new fd.

val creat : t

creat implies that if the pathname does not exist, it is created as a regular file.

val direct : t

direct disables the kernel buffer cache and performs IO directly to and from the userspace buffers.

val directory : t

directory causes the open operation to fail if the target is not a directory.

val dsync : t

dsync ensures that write operations on the file complete according to the requirements of synchronised IO data integrity completion.

val excl : t

excl is used alongside creat to ensure that the file is created as a result of the openat2 call, and otherwise fails with a Unix.error.EEXIST exception. The only exception where excl can be used without creat is when attempting to open block devices. If the block device is otherwise mounted, then the open will fail with Unix.error.EBUSY.

val noatime : t

noatime signals that the file access time should not be updated when the file is read from. See Statx.atime_nsec.

val noctty : t

noctty ensures that if the path refers to a tty, it will not be assigned as the controlling terminal even if one is not present.

val nofollow : t

nofollow will cause the open to fail with Unix.error.ELOOP if the basename of the path is a symbolic link.

val nonblock : t

nonblock will open the file in non-blocking mode.

val path : t

path will obtain a fd that can only be used to either indicate a location in a filesystem tree, or perform operations at the fd level. The file is not opened, and so any IO operations on the file will fail. path is only used with cloexec, directory and nofollow, and any other flags will be ignored.

val sync : t

sync ensures that write operations on the file complete according to the requirements of synchronised IO file integrity completion.

val tmpfile : t

tmpfile creates an anonymous temporary regular file. The pathname must be a directory, within which an unnamed inode will be created. If tmpfile is specified without excl, then a subsequent linkat call can move it permanently into the filesystem.

val trunc : t

trunc will set the file size to 0 if the file already exists and is a regular file and is opened for writing. If the file is a FIFO or terminal, then the flag is ignored. Use of trunc on other file types is unspecified.

OCaml

Innovation. Community. Security.