···28282929val ptr : 'a entry -> ptr
3030(** [ptr e] is the index of [e].
3131- @raise Invalid_arg if [e] has already been freed. *)
3131+ @raise Invalid_argument if [e] has already been freed. *)
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
+31-2
vendor/opam/uring/lib/uring/include/discover.ml
···9999 "IORING_OP_URING_CMD";
100100]
101101102102-let ops c =
102102+let uring_setup_flags = [
103103+ "IORING_SETUP_IOPOLL";
104104+ (* "IORING_SETUP_SQPOLL" *) (* Enabled by passing a polling timeout instead *)
105105+ (* "IORING_SETUP_SQ_AFF"; *) (* todo: requires setting sq_thread_cpu too *)
106106+ (* "IORING_SETUP_CQSIZE"; *) (* todo: requires setting cq_entries *)
107107+ "IORING_SETUP_CLAMP";
108108+ (* "IORING_SETUP_ATTACH_WQ"; *) (* todo: requires setting wq_fd *)
109109+ "IORING_SETUP_R_DISABLED";
110110+ "IORING_SETUP_SUBMIT_ALL";
111111+ "IORING_SETUP_COOP_TASKRUN";
112112+ "IORING_SETUP_TASKRUN_FLAG";
113113+ "IORING_SETUP_SQE128";
114114+ "IORING_SETUP_CQE32";
115115+ "IORING_SETUP_SINGLE_ISSUER";
116116+ "IORING_SETUP_DEFER_TASKRUN";
117117+]
118118+119119+let uring_defs c =
103120 Gen.abstract_module "Op" (
104121 C.C_define.import c (List.map (fun name -> name, C.C_define.Type.Int) uring_ops)
105122 ~c_flags:["-D_GNU_SOURCE"; "-I"; include_dir]
···107124 |> List.map (function
108125 | name, C.C_define.Value.Int v ->
109126 let prefix_len = String.length "IORING_OP_" in
127127+ let ocaml_name = String.sub name prefix_len (String.length name - prefix_len) |> String.lowercase_ascii in
128128+ (ocaml_name, v)
129129+ | _ -> assert false
130130+ )
131131+ ) @
132132+ Gen.hex_module "Ioring_setup" (
133133+ C.C_define.import c (List.map (fun name -> name, C.C_define.Type.Int) uring_setup_flags)
134134+ ~c_flags:["-D_GNU_SOURCE"; "-I"; include_dir]
135135+ ~includes:["liburing.h"]
136136+ |> List.map (function
137137+ | name, C.C_define.Value.Int v ->
138138+ let prefix_len = String.length "IORING_SETUP_" in
110139 let ocaml_name = String.sub name prefix_len (String.length name - prefix_len) |> String.lowercase_ascii in
111140 (ocaml_name, v)
112141 | _ -> assert false
···199228 C.main ~name:"discover" (fun c ->
200229 C.Flags.write_lines "config.ml" @@ List.flatten @@ List.map (fun f -> f c) [
201230 toplevel_defs;
202202- ops;
231231+ uring_defs;
203232 stat_flags;
204233 ]
205234 )
+1-1
vendor/opam/uring/lib/uring/primitives.h
···5757CAMLprim value ocaml_uring_set_string(value, value);
5858CAMLprim value ocaml_uring_make_msghdr(value, value, value);
5959CAMLprim value ocaml_uring_get_msghdr_fds(value);
6060-CAMLprim value ocaml_uring_setup(value, value);
6060+CAMLprim value ocaml_uring_setup(value, value, value);
6161CAMLprim value ocaml_uring_exit(value);
6262CAMLprim value ocaml_uring_unregister_buffers(value);
6363CAMLprim value ocaml_uring_register_ba(value, value);
+8-3
vendor/opam/uring/lib/uring/uring.ml
···8686 let pollhup = Config.pollhup
8787end
88888989+module Setup_flags = struct
9090+ include Flags
9191+ include Config.Ioring_setup
9292+end
9393+8994module Statx = struct
9095 type t
9196···299304module Uring = struct
300305 type t
301306302302- external create : int -> int option -> t = "ocaml_uring_setup"
307307+ external create : int -> int option -> Setup_flags.t -> t = "ocaml_uring_setup"
303308 external exit : t -> unit = "ocaml_uring_exit"
304309305310 external unregister_buffers : t -> unit = "ocaml_uring_unregister_buffers"
···394399let unregister_gc_root t =
395400 update_gc_roots (Ring_set.remove (Generic_ring.T t))
396401397397-let create ?polling_timeout ~queue_depth () =
402402+let create ?(flags=Setup_flags.empty) ?polling_timeout ~queue_depth () =
398403 if queue_depth < 1 then Fmt.invalid_arg "Non-positive queue depth: %d" queue_depth;
399399- let uring = Uring.create queue_depth polling_timeout in
404404+ let uring = Uring.create queue_depth polling_timeout flags in
400405 let data = Heap.create queue_depth in
401406 let id = object end in
402407 let fixed_iobuf = Cstruct.empty.buffer in
+52-16
vendor/opam/uring/lib/uring/uring.mli
···23232424module Region = Region
25252626+(** Type of flags that can be combined. *)
2727+module type FLAGS = sig
2828+ type t = private int
2929+ (** A set of flags. *)
3030+3131+ val empty : t
3232+3333+ val of_int : int -> t
3434+3535+ val ( + ) : t -> t -> t
3636+ (** [a + b] is the union of the sets. *)
3737+3838+ val mem : t -> t -> bool
3939+ (** [mem x flags] is [true] iff [x] is a subset of [flags]. *)
4040+end
4141+4242+(** Flags that can be passed to {!create}. *)
4343+module Setup_flags : sig
4444+ include FLAGS
4545+4646+ val iopoll : t
4747+ (** io_context is polled *)
4848+4949+ val clamp : t
5050+ (** Clamp SQ/CQ ring sizes *)
5151+5252+ val r_disabled : t
5353+ (** Start with ring disabled *)
5454+5555+ val submit_all : t
5656+ (** Continue submit on error *)
5757+5858+ val coop_taskrun : t
5959+ (** Cooperative task running *)
6060+6161+ val taskrun_flag : t
6262+ (** Get notified if task work is available *)
6363+6464+ val sqe128 : t
6565+ (** SQEs are 128 byte *)
6666+6767+ val cqe32 : t
6868+ (** CQEs are 32 byte *)
6969+7070+ val single_issuer : t
7171+ (** Only one task is allowed to submit requests *)
7272+7373+ val defer_taskrun : t
7474+ (** Defer running task work to get events *)
7575+end
7676+2677type 'a t
2778(** ['a t] is a reference to an Io_uring structure. *)
2879···3081(** A handle for a submitted job, which can be used to cancel it.
3182 If an operation returns [None], this means that submission failed because the ring is full. *)
32833333-val create : ?polling_timeout:int -> queue_depth:int -> unit -> 'a t
8484+val create : ?flags:Setup_flags.t -> ?polling_timeout:int -> queue_depth:int -> unit -> 'a t
3485(** [create ~queue_depth] will return a fresh Io_uring structure [t].
3586 Initially, [t] has no fixed buffer. Use {!set_fixed_buffer} if you want one.
3687 @param polling_timeout If given, use polling mode with the given idle timeout (in ms).
···85136 [absolute] denotes how [clock] and [ns] relate to one another. Default value is [false]
8613787138 [ns] is the timeout time in nanoseconds *)
8888-8989-module type FLAGS = sig
9090- type t = private int
9191- (** A set of flags. *)
9292-9393- val empty : t
9494-9595- val of_int : int -> t
9696-9797- val ( + ) : t -> t -> t
9898- (** [a + b] is the union of the sets. *)
9999-100100- val mem : t -> t -> bool
101101- (** [mem x flags] is [true] iff [x] is a subset of [flags]. *)
102102-end
103139104140(** Flags that can be passed to {!openat2}. *)
105141module Open_flags : sig