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.

Merge pull request #120 from patricoferris/mkdirat

Add mkdirat

authored by

Thomas Leonard and committed by
GitHub
82f80fbd 63e0ef9e

+48
+7
vendor/opam/uring/lib/uring/uring.ml
··· 331 331 external submit_openat2 : t -> id -> Unix.file_descr -> Open_how.t -> bool = "ocaml_uring_submit_openat2" [@@noalloc] 332 332 external submit_linkat : t -> id -> Unix.file_descr -> Sketch.ptr -> Unix.file_descr -> Sketch.ptr -> int -> bool = "ocaml_uring_submit_linkat_byte" "ocaml_uring_submit_linkat_native" [@@noalloc] 333 333 external submit_unlinkat : t -> id -> Unix.file_descr -> Sketch.ptr -> bool -> bool = "ocaml_uring_submit_unlinkat" [@@noalloc] 334 + external submit_mkdirat : t -> id -> Unix.file_descr -> Sketch.ptr -> int -> bool = "ocaml_uring_submit_mkdirat" [@@noalloc] 334 335 external submit_send_msg : t -> id -> Unix.file_descr -> Msghdr.t -> Sketch.ptr -> bool = "ocaml_uring_submit_send_msg" [@@noalloc] 335 336 external submit_recv_msg : t -> id -> Unix.file_descr -> Msghdr.t -> Sketch.ptr -> bool = "ocaml_uring_submit_recv_msg" [@@noalloc] 336 337 external submit_fsync : t -> id -> Unix.file_descr -> int64 -> int -> bool = "ocaml_uring_submit_fsync" [@@noalloc] ··· 485 486 with_id t (fun id -> 486 487 let buf = Sketch.String.alloc t.sketch path in 487 488 Uring.submit_unlinkat t.uring id fd buf dir 489 + ) user_data 490 + 491 + let mkdirat t ~mode ?(fd=at_fdcwd) path user_data = 492 + with_id t (fun id -> 493 + let buf = Sketch.String.alloc t.sketch path in 494 + Uring.submit_mkdirat t.uring id fd buf mode 488 495 ) user_data 489 496 490 497 let read t ~file_offset fd (buf : Cstruct.t) user_data =
+5
vendor/opam/uring/lib/uring/uring.mli
··· 284 284 @param dir If [true], this acts like [rmdir] (only removing empty directories). 285 285 If [false], it acts like [unlink] (only removing non-directories). *) 286 286 287 + val mkdirat : 'a t -> mode:Unix.file_perm -> ?fd:Unix.file_descr -> string -> 'a -> 'a job option 288 + (** [mkdirat t ~mode ~fd path] makes a directory [path], which is resolved relative to [fd]. 289 + If [fd] is not given, then the current working directory is used. 290 + @param mode The mode used to create the directory. *) 291 + 287 292 module Poll_mask : sig 288 293 include FLAGS 289 294
+11
vendor/opam/uring/lib/uring/uring_stubs.c
··· 854 854 } 855 855 856 856 value /* noalloc */ 857 + ocaml_uring_submit_mkdirat(value v_uring, value v_id, value v_fd, value v_sketch_ptr, value v_mode) { 858 + struct io_uring *ring = Ring_val(v_uring); 859 + struct io_uring_sqe *sqe = io_uring_get_sqe(ring); 860 + char *path = Sketch_ptr_val(v_sketch_ptr); 861 + if (!sqe) return (Val_false); 862 + io_uring_prep_mkdirat(sqe, Int_val(v_fd), path, Int_val(v_mode)); 863 + io_uring_sqe_set_data(sqe, (void *)Long_val(v_id)); 864 + return (Val_true); 865 + } 866 + 867 + value /* noalloc */ 857 868 ocaml_uring_submit_fsync(value v_uring, value v_id, value v_fd, value v_off, value v_len) 858 869 { 859 870 struct io_uring *ring = Ring_val(v_uring);
+25
vendor/opam/uring/tests/main.md
··· 865 865 - : unit = () 866 866 ``` 867 867 868 + ## Mkdirat 869 + 870 + ```ocaml 871 + # let t : [ `Mkdir of int ] Uring.t = Uring.create ~queue_depth:1 ();; 872 + val t : [ `Mkdir of int ] Uring.t = <abstr> 873 + # Uring.mkdirat t ~mode:0o755 "mkdir" (`Mkdir 0);; 874 + - : [ `Mkdir of int ] Uring.job option = Some <abstr> 875 + # Uring.submit t;; 876 + - : int = 1 877 + # Uring.wait t;; 878 + - : [ `Mkdir of int ] Uring.completion_option = 879 + Uring.Some {Uring.result = 0; data = `Mkdir 0} 880 + # (Unix.stat "mkdir").st_perm;; 881 + - : int = 448 882 + # let v = Uring.mkdirat t ~mode:0o755 "mkdir" (`Mkdir 1);; 883 + val v : [ `Mkdir of int ] Uring.job option = Some <abstr> 884 + # Uring.submit t;; 885 + - : int = 1 886 + # Uring.wait t;; 887 + - : [ `Mkdir of int ] Uring.completion_option = 888 + Uring.Some {Uring.result = -17; data = `Mkdir 1} 889 + # Uring.exit t;; 890 + - : unit = () 891 + ``` 892 + 868 893 ## Timeout 869 894 870 895 Timeout should return (-ETIME). This is defined in https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/errno.h#L45