Shells in OCaml
at wip 17 lines 588 B view raw
1(* A simple file descriptor pool to deal with overwriting low 2 file descriptor by mistake that might be our own pipe's and 3 stuff! *) 4 5type t 6(** A file descriptor pool *) 7 8val make : ?min:int -> int -> t 9(** [make ?min size] creates a new pool of [size] where the lowest FD is [min]. 10*) 11 12val with_fd : t -> (Unix.file_descr -> 'a) -> 'a 13(** [with_fd pool fn] runs [fn] with the next available file descriptor, when 14 the function returns the [fd] is returned to the pool to be reused. *) 15 16val pipe : 17 t -> Eio.Switch.t -> Eio_unix.source_ty Eio.Std.r * Eio_unix.sink_ty Eio.Std.r