···32323333val alloc : 'a t -> 'a -> extra_data:'b -> 'a entry
3434(** [alloc t a ~extra_data] adds the value [a] to [t] and returns a
3535- pointer to that value, or raises {!Invalid_arg} if no extra space
3535+ pointer to that value, or raises [Invalid_argument] if no extra space
3636 can be created for [t], or [t] has already been [release]d.
3737 @param extra_data Prevent this from being GC'd until [free] is called. *)
3838
-2
vendor/opam/uring/lib/uring/uring.ml
···3131module Flags = struct
3232 type t = int
33333434- let empty = 0
3535-3634 let of_int x = x
37353836 let ( + ) = ( lor )
+193-17
vendor/opam/uring/lib/uring/uring.mli
···1414 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 *)
16161717-(** Io_uring interface. *)
1717+(** Io_uring is an asynchronous I/O API for Linux that uses ring buffers
1818+ shared between the Linux kernel and userspace to provide an efficient
1919+ mechanism to batch requests that can be handled asynchronously and in
2020+ parallel. This module provides an OCaml interface to io_uring that
2121+ aims to provide a thin type-safe layer for use in higher-level interfaces.
2222+ @see <https://unixism.net/loti/what_is_io_uring.html#what-is-io-uring> What is Io_uring? *)
18231924module Region = Region
2025···69747075(** {2 Timeout} *)
71767272-type clock = Boottime | Realtime
7373-(** Represents Linux clocks. [Boottime] and [Realtime] represents OS clocks CLOCK_BOOTTIME
7474- and CLOCK_REALTIME respectively. *)
7777+(** Represents different Linux clocks. *)
7878+type clock =
7979+ Boottime (** [CLOCK_BOOTTIME] is a suspend-aware monotonic clock *)
8080+ | Realtime (** [CLOCK_REALTIME] is a wallclock time clock that may be affected by discontinuous jumps *)
75817682val timeout: ?absolute:bool -> 'a t -> clock -> int64 -> 'a -> 'a job option
7783(** [timeout t clock ns d] submits a timeout request to uring [t].
···9399 (** [mem x flags] is [true] iff [x] is a subset of [flags]. *)
94100end
951019696-(** Flags that can be passed to openat2. *)
102102+(** Flags that can be passed to {!openat2}. *)
97103module Open_flags : sig
98104 include FLAGS
99105100100- val empty : t
101106 val append : t
107107+ (** [append] repositions the file offset to the end of the file before
108108+ every write. This should be used with caution with io_uring.
109109+ @see <https://github.com/axboe/liburing/issues/32#issuecomment-1313220682> GitHub axboe/liburing#32 *)
110110+102111 val cloexec : t
112112+ (** [cloexec] enables the close-on-exec flag for the new fd. *)
113113+103114 val creat : t
115115+ (** [creat] implies that if the pathname does not exist, it is
116116+ created as a regular file. *)
117117+104118 val direct : t
119119+ (** [direct] disables the kernel buffer cache and performs IO
120120+ directly to and from the userspace buffers. *)
121121+105122 val directory : t
123123+ (** [directory] causes the open operation to fail if the target
124124+ is not a directory. *)
125125+106126 val dsync : t
127127+ (** [dsync] ensures that write operations on the file complete
128128+ according to the requirements of synchronised IO data integrity
129129+ completion. *)
130130+107131 val excl : t
108108- val largefile : t
132132+ (** [excl] is used alongside {!creat} to ensure that the file
133133+ is created as a result of the {!openat2} call, and otherwise
134134+ fails with a {!Unix.EEXIST} exception. The only exception where
135135+ [excl] can be used without {!creat} is when attempting to open
136136+ block devices. If the block device is otherwise mounted, then
137137+ the open will fail with {!Unix.EBUSY}. *)
138138+109139 val noatime : t
140140+ (** [noatime] signals that the file access time should not be updated
141141+ when the file is read from. See {!Statx.atime_nsec}. *)
142142+110143 val noctty : t
144144+ (** [noctty] ensures that if the path refers to a tty, it will not
145145+ be assigned as the controlling terminal even if one is not present. *)
146146+111147 val nofollow : t
148148+ (** [nofollow] will cause the open to fail with {!Unix.ELOOP} if the
149149+ basename of the path is a symbolic link. *)
150150+112151 val nonblock : t
152152+ (** [nonblock] will open the file in non-blocking mode. *)
153153+113154 val path : t
155155+ (** [path] will obtain a fd that can only be used to either indicate
156156+ a location in a filesystem tree, or perform operations at the fd
157157+ level. The file is not opened, and so any IO operations on the file
158158+ will fail. [path] is only used with {!cloexec}, {!directory} and
159159+ {!nofollow}, and any other flags will be ignored. *)
160160+114161 val sync : t
162162+ (** [sync] ensures that write operations on the file complete
163163+ according to the requirements of synchronised IO file integrity
164164+ completion. *)
165165+115166 val tmpfile : t
167167+ (** [tmpfile] creates an anonymous temporary regular file. The pathname
168168+ must be a directory, within which an unnamed inode will be created.
169169+ If [tmpfile] is specified without {!excl}, then a subsequent
170170+ linkat call can move it permanently into the filesystem. *)
171171+116172 val trunc : t
173173+ (** [trunc] will set the file size to 0 if the file already exists
174174+ and is a regular file and is opened for writing. If the file
175175+ is a FIFO or terminal, then the flag is ignored. Use of [trunc]
176176+ on other file types is unspecified. *)
117177end
118178119119-(** Flags that can be passed to openat2 to control path resolution. *)
179179+(** Flags that can be passed to {!openat2} to control path resolution. *)
120180module Resolve : sig
121181 include FLAGS
122182123123- val empty : t
124183 val beneath : t
184184+ (** [beneath] does not permit path resolution to succeed if any
185185+ component of the resolution is not a descendant of the directory
186186+ indicated by the [dirfd] passed to the open call. Absolute symbolic
187187+ links and absolute pathnames will be rejected.
188188+189189+ For maximum compatiblity with future Linux kernels, the {!no_magiclinks}
190190+ flag should be specified along with this one. *)
191191+125192 val in_root : t
193193+ (** [in_root] treats the [dirfd] directory as the root directory while
194194+ resolving the pathname. Absolute symbolic links are interpreted
195195+ relative to the [dirfd]. If a prefix component of the pathname
196196+ equates to the [dirfd], then an immediately following [..] component
197197+ likewise equates to the [dirfd] (just as [/..] is traditionally
198198+ equivalent to [/]). An absolute pathname is interpreted relative to
199199+ the [dirfd].
200200+201201+ For maximum compatiblity with future Linux kernels, the {!no_magiclinks}
202202+ flag should be specified along with this one. *)
203203+126204 val no_magiclinks : t
205205+ (** [no_magiclinks] disallows all magic-link resolution during path
206206+ resolution. Magic-links are symbolic link-like objects that are
207207+ usually found in the [/proc] filesystem. Unknowingly opening magic
208208+ links can be risky for some applications, notably those without a
209209+ controlling terminal or those within a containerised environment that
210210+ may provide an escape vector. *)
211211+127212 val no_symlinks : t
213213+ (** [no_symlinks] disallows the resolution of symbolic links during path
214214+ resolution, and implies the use of {!no_magiclinks}. If the basename
215215+ component of the pathname is a symlink, and [no_symlinks] is specified
216216+ along with {!Open_flags.path} and {!Open_flags.nofollow}, then a fd
217217+ referencing the symbolic link will be returned.
218218+219219+ Note that the [no_symlinks] flag affects the treatment of symbolic links
220220+ in all of the components of pathname. This differs from the effect
221221+ of the {!Open_flags.nofollow} file creation flag, which affects the
222222+ handling of symbolic links only in the final component of the pathname. *)
223223+128224 val no_xdev : t
225225+ (** [no_xdev] disallows the traversal of mount points during path resolution,
226226+ including bind mounts The pathname must either be on the same mount as
227227+ the directory referred to by the [dirfd], or on the same mount as the
228228+ current working directory if [dirfd] is not specified. *)
229229+129230 val cached : t
231231+ (** [cached] makes the open operation fail unless all path components are
232232+ already present in the kernel lookup cache. Any revalidation or IO
233233+ needed to satisfy the lookup will result in a {!Unix.EAGAIN} error. *)
130234end
131235132236val openat2 : 'a t ->
···241345 ]
242346243347 val pp_kind : kind Fmt.t
348348+ (** [pp_kind kind] formats a human readable [kind] *)
244349245350 val create : unit -> t
246351 (** Use [create] to make a statx result buffer to pass to {! statx}. *)
···248353 module Flags : sig
249354 include FLAGS
250355251251- val empty : t
252356 val empty_path : t
357357+ (** [empty_path] signals that if the pathname is an empty string
358358+ then operate on the file referred to by the [fd] (which can
359359+ refer to any type of file).
360360+ If [fd] is not specified then the call operates on the current
361361+ working directory. *)
362362+253363 val no_automount : t
364364+ (** [no_automount] signals that statx should not automount the basename
365365+ component of the path if it is an automount point.
366366+ This can be used in tools that scan directories to prevent
367367+ mass-automounting of a directory of automount points. *)
368368+254369 val symlink_nofollow : t
370370+ (** [symlink_nofollow] signals that if the path is a symbolic link,
371371+ then return information about the link itself. *)
372372+255373 val statx_sync_as_stat : t
374374+ (** [statx_sync_as_stat] is the filesystem-specific behaviour in
375375+ response to stat calls. *)
376376+256377 val statx_force_sync : t
378378+ (** [statx_force_sync] forces synchronisation with the server, if
379379+ the filesystem is a network-backed one. *)
380380+257381 val statx_dont_sync : t
382382+ (** [statx_dont_sync] signals that locally cached timestamps are
383383+ sufficient, if run on a network-backed filesystem. *)
258384 end
259385260386 module Attr : sig
261387 include FLAGS
262388263389 val compressed : t
390390+ (** The file is compressed by the filesystem. *)
391391+264392 val immutable : t
393393+ (** The file cannot be modified, as defined by chattr(1). *)
394394+265395 val append : t
396396+ (** The file can only be opened in append mode for writing.
397397+ See chattr(1). *)
398398+266399 val nodump : t
400400+ (** The file is not a candidate for backup when a backup
401401+ program scans the filesystem. *)
402402+267403 val encrypted : t
404404+ (** A key is required for the file to be encrypted by the
405405+ filesystem. *)
406406+268407 val verity : t
408408+ (** The file has fs-verity enabled. It cannot be written to,
409409+ and all reads from it will be verified against a
410410+ cryptographic hash that covers the entire file. *)
269411270412 val dax : t
271271- (** Since Linux 5.8 *)
413413+ (** The file is in the DAX (cpu direct access) state, which
414414+ minimises page-cache effects for both I/O and memory mappings
415415+ of this file.
416416+ @see <https://www.kernel.org/doc/Documentation/filesystems/dax.txt> Direct Access for Files
417417+ @since Linux 5.8 *)
272418273419 val check : ?mask:Int64.t -> Int64.t -> t -> bool
274420 (** [check ?mask attr t] will check if [t] is set in [attr].
···278424 end
279425280426 module Mask : sig
427427+ (** The mask flags are used to tell the kernel which fields the {!statx} invocation
428428+ is interested in. You may wish to use {! Mask.check} on the returned {!Statx.t} to
429429+ verify the field has actually been filled in with a sensible value first.
430430+ In general, the kernel never refused values specified in the mask, but may choose
431431+ to not set the mask in the returned buffer from {!statx}. *)
432432+281433 include FLAGS
282434283435 val type' : t
436436+ (** Retrieve the kind of file field, accessible afterwards via {!val:Statx.kind}. *)
437437+284438 val mode : t
439439+ (** Retrieve the permissions field, accessible afterwards via {!Statx.perm}. *)
440440+285441 val nlink : t
442442+ (** Retrieve the number of links field, accessible afterwards via {!Statx.nlink}. *)
443443+286444 val uid : t
445445+ (** Retrieve the user ID field, accessible afterwards via {!Statx.uid}. *)
446446+287447 val gid : t
448448+ (** Retrieve the group ID field, accessible afterwards via {!Statx.gid}. *)
449449+288450 val atime : t
451451+ (** Retrieve the last access field, accessible afterwards
452452+ via {!atime_nsec} and {!atime_sec}. *)
453453+289454 val mtime : t
455455+ (** Retrieve the last modification field, accessible afterwards
456456+ via {!mtime_nsec} and {!mtime_sec}. *)
457457+290458 val ctime : t
459459+ (** Retrieve the last status change field, accessible afterwards
460460+ via {!ctime_nsec} and {!ctime_sec}. *)
461461+291462 val ino : t
463463+ (** Retrieve the inode number, accessible afterwards via {!Statx.ino}. *)
464464+292465 val size : t
466466+ (** Retrieve the total size in bytes, accessible afterwards via {!Statx.size}. *)
467467+293468 val blocks : t
294294- val basic_stats : t (** All of the above flags. *)
469469+ (** Retrieve the number of 512B blocks allocate, accessible afterwards via {!Statx.blocks}. *)
470470+471471+ val basic_stats : t
472472+ (** Retrieve all of the above flags. *)
295473296474 val btime : t
475475+ (** Retrieve the birthtime field, accessible afterwards via {!btime_nsec} and {!btime_sec}. *)
297476298477 val mnt_id : t
299299- (** As of Linux 5.8 *)
478478+ (** @since Linux 5.8 *)
300479301480 val dioalign : t
302302- (** As of Linux 6.1 *)
481481+ (** @since Linux 6.1 *)
303482304483 val check : Int64.t -> t -> bool
305484 (** [check mask t] checks if [t] is set in [mask]. *)
306485 end
307307-308308- (** You may wish to use {! Mask.check} to verify the field has actually
309309- been returned with a sensible value first. *)
310486311487 val blksize : t -> Int64.t
312488 val attributes : t -> Int64.t