The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add Uring.fsync and Uring.fdatasync ops

+60
+8
vendor/opam/uring/lib/uring/uring.ml
··· 332 332 external submit_unlinkat : t -> id -> Unix.file_descr -> Sketch.ptr -> bool -> bool = "ocaml_uring_submit_unlinkat" [@@noalloc] 333 333 external submit_send_msg : t -> id -> Unix.file_descr -> Msghdr.t -> Sketch.ptr -> bool = "ocaml_uring_submit_send_msg" [@@noalloc] 334 334 external submit_recv_msg : t -> id -> Unix.file_descr -> Msghdr.t -> Sketch.ptr -> bool = "ocaml_uring_submit_recv_msg" [@@noalloc] 335 + external submit_fsync : t -> id -> Unix.file_descr -> int64 -> int -> bool = "ocaml_uring_submit_fsync" [@@noalloc] 336 + external submit_fdatasync : t -> id -> Unix.file_descr -> int64 -> int -> bool = "ocaml_uring_submit_fdatasync" [@@noalloc] 335 337 336 338 type cqe_option = private 337 339 | Cqe_none ··· 540 542 with_id_full t (fun id -> 541 543 let iovec = Sketch.Iovec.alloc t.sketch buffers in 542 544 Uring.submit_recv_msg t.uring id fd msghdr iovec) user_data ~extra_data:msghdr 545 + 546 + let fsync t ?(off=0L) ?(len=0) fd user_data = 547 + with_id t (fun id -> Uring.submit_fsync t.uring id fd off len) user_data 548 + 549 + let fdatasync t ?(off=0L) ?(len=0) fd user_data = 550 + with_id t (fun id -> Uring.submit_fdatasync t.uring id fd off len) user_data 543 551 544 552 let cancel t job user_data = 545 553 ignore (Heap.ptr job : Uring.id); (* Check it's still valid *)
+10
vendor/opam/uring/lib/uring/uring.mli
··· 403 403 (** [recv_msg t fd msghdr d] will submit a [recvmsg(2)] request. If the request is 404 404 successful then the [msghdr] will contain the sender address and the data received. *) 405 405 406 + val fsync : 'a t -> ?off:int64 -> ?len:int -> Unix.file_descr -> 'a -> 'a job option 407 + (** [fsync t ?off ?len fd d] will submit an [fsync(2)] request, with the optional 408 + offset [off] and length [len] specifying the subset of the file to perform the 409 + synchronisation on. *) 410 + 411 + val fdatasync : 'a t -> ?off:int64 -> ?len:int -> Unix.file_descr -> 'a -> 'a job option 412 + (** [fdatasync t ?off ?len fd d] will submit an [fdatasync(2)] request, with the optional 413 + offset [off] and length [len] specifying the subset of the file to perform the 414 + synchronisation on. *) 415 + 406 416 (** {2 Probing} 407 417 408 418 You can check which operations are supported by the running kernel. *)
+26
vendor/opam/uring/lib/uring/uring_stubs.c
··· 850 850 } 851 851 852 852 value /* noalloc */ 853 + ocaml_uring_submit_fsync(value v_uring, value v_id, value v_fd, value v_off, value v_len) 854 + { 855 + struct io_uring *ring = Ring_val(v_uring); 856 + struct io_uring_sqe *sqe = io_uring_get_sqe(ring); 857 + if (!sqe) return (Val_false); 858 + io_uring_prep_fsync(sqe, Int_val(v_fd), 0); 859 + sqe->off = Int64_val(v_off); 860 + sqe->len = Int_val(v_len); 861 + io_uring_sqe_set_data(sqe, (void *)Long_val(v_id)); 862 + return (Val_true); 863 + } 864 + 865 + value /* noalloc */ 866 + ocaml_uring_submit_fdatasync(value v_uring, value v_id, value v_fd, value v_off, value v_len) 867 + { 868 + struct io_uring *ring = Ring_val(v_uring); 869 + struct io_uring_sqe *sqe = io_uring_get_sqe(ring); 870 + if (!sqe) return (Val_false); 871 + io_uring_prep_fsync(sqe, Int_val(v_fd), IORING_FSYNC_DATASYNC); 872 + sqe->off = Int64_val(v_off); 873 + sqe->len = Int_val(v_len); 874 + io_uring_sqe_set_data(sqe, (void *)Long_val(v_id)); 875 + return (Val_true); 876 + } 877 + 878 + value /* noalloc */ 853 879 ocaml_uring_submit_cancel(value v_uring, value v_id, value v_target) { 854 880 struct io_uring *ring = Ring_val(v_uring); 855 881 struct io_uring_sqe *sqe;
+16
vendor/opam/uring/tests/main.md
··· 184 184 x.st_kind, Printf.sprintf "0o%o" x.st_perm, x.st_size;; 185 185 - : Unix.file_kind * string * int = (Unix.S_REG, "0o600", 9) 186 186 187 + # Uring.fsync t fd `Create;; 188 + - : [ `Create ] Uring.job option = Some <abstr> 189 + # Uring.submit t;; 190 + - : int = 1 191 + # let v, read = consume t;; 192 + val v : [ `Create ] = `Create 193 + val read : int = 0 194 + 195 + # Uring.fdatasync t ~off:1L ~len:5 fd `Create;; 196 + - : [ `Create ] Uring.job option = Some <abstr> 197 + # Uring.submit t;; 198 + - : int = 1 199 + # let v, read = consume t;; 200 + val v : [ `Create ] = `Create 201 + val read : int = 0 202 + 187 203 # let fd : unit = Unix.close fd;; 188 204 val fd : unit = () 189 205