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.

OCaml bindings for socket bind and listen operations

Add support for the IORING_OP_BIND and IORING_OP_LISTEN operations

+44
+9
vendor/opam/uring/lib/uring/uring.ml
··· 330 330 external submit_close : t -> Unix.file_descr -> id -> bool = "ocaml_uring_submit_close" [@@noalloc] 331 331 external submit_statx : t -> id -> Unix.file_descr -> Statx.t -> Sketch.ptr -> int -> int -> bool = "ocaml_uring_submit_statx_byte" "ocaml_uring_submit_statx_native" [@@noalloc] 332 332 external submit_splice : t -> id -> Unix.file_descr -> Unix.file_descr -> int -> bool = "ocaml_uring_submit_splice" [@@noalloc] 333 + external submit_bind : t -> id -> Unix.file_descr -> Sockaddr.t -> bool = "ocaml_uring_submit_bind" [@@noalloc] 334 + external submit_listen : t -> id -> Unix.file_descr -> int -> bool = "ocaml_uring_submit_listen" [@@noalloc] 333 335 external submit_connect : t -> id -> Unix.file_descr -> Sockaddr.t -> bool = "ocaml_uring_submit_connect" [@@noalloc] 334 336 external submit_accept : t -> id -> Unix.file_descr -> Sockaddr.t -> bool = "ocaml_uring_submit_accept" [@@noalloc] 335 337 external submit_cancel : t -> id -> id -> bool = "ocaml_uring_submit_cancel" [@@noalloc] ··· 545 547 546 548 let splice t ~src ~dst ~len user_data = 547 549 with_id t (fun id -> Uring.submit_splice t.uring id src dst len) user_data 550 + 551 + let bind t fd addr user_data = 552 + let addr = Sockaddr.of_unix addr in 553 + with_id_full t (fun id -> Uring.submit_bind t.uring id fd addr) user_data ~extra_data:addr 554 + 555 + let listen t fd backlog user_data = 556 + with_id t (fun id -> Uring.submit_listen t.uring id fd backlog) user_data 548 557 549 558 let connect t fd addr user_data = 550 559 let addr = Sockaddr.of_unix addr in
+6
vendor/opam/uring/lib/uring/uring.mli
··· 595 595 (** [statx t ?fd ~mask path stat flags] stats [path], which is resolved relative to [fd] 596 596 (or the current directory if [fd] is not given). *) 597 597 598 + val bind : 'a t -> Unix.file_descr -> Unix.sockaddr -> 'a -> 'a job option 599 + (** [bind t fd addr d] will submit a request to bind [fd] to [addr]. *) 600 + 601 + val listen : 'a t -> Unix.file_descr -> int -> 'a -> 'a job option 602 + (** [listen t fd backlog d] will submit a request to listen on [fd] with [backlog] maximum pending connections. *) 603 + 598 604 val connect : 'a t -> Unix.file_descr -> Unix.sockaddr -> 'a -> 'a job option 599 605 (** [connect t fd addr d] will submit a request to connect [fd] to [addr]. *) 600 606
+24
vendor/opam/uring/lib/uring/uring_stubs.c
··· 778 778 779 779 // v_sockaddr must not be GC'd while the call is in progress 780 780 value /* noalloc */ 781 + ocaml_uring_submit_bind(value v_uring, value v_id, value v_fd, value v_sockaddr) { 782 + struct io_uring *ring = Ring_val(v_uring); 783 + struct io_uring_sqe *sqe; 784 + struct sock_addr_data *addr = Sock_addr_val(v_sockaddr); 785 + sqe = io_uring_get_sqe(ring); 786 + if (!sqe) return (Val_false); 787 + io_uring_prep_bind(sqe, Int_val(v_fd), &(addr->sock_addr_addr.s_gen), addr->sock_addr_len); 788 + io_uring_sqe_set_data(sqe, (void *)Long_val(v_id)); 789 + return (Val_true); 790 + } 791 + 792 + value /* noalloc */ 793 + ocaml_uring_submit_listen(value v_uring, value v_id, value v_fd, value v_backlog) { 794 + struct io_uring *ring = Ring_val(v_uring); 795 + struct io_uring_sqe *sqe; 796 + sqe = io_uring_get_sqe(ring); 797 + if (!sqe) return (Val_false); 798 + io_uring_prep_listen(sqe, Int_val(v_fd), Int_val(v_backlog)); 799 + io_uring_sqe_set_data(sqe, (void *)Long_val(v_id)); 800 + return (Val_true); 801 + } 802 + 803 + // v_sockaddr must not be GC'd while the call is in progress 804 + value /* noalloc */ 781 805 ocaml_uring_submit_connect(value v_uring, value v_id, value v_fd, value v_sockaddr) { 782 806 struct io_uring *ring = Ring_val(v_uring); 783 807 struct io_uring_sqe *sqe;
+5
vendor/opam/uring/tests/dune
··· 39 39 (modules poll_add) 40 40 (libraries unix uring logs logs.fmt)) 41 41 42 + (executable 43 + (name socket_ops) 44 + (modules socket_ops) 45 + (libraries unix uring)) 46 + 42 47 (rule 43 48 (alias runtest) 44 49 (package uring)