Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
A safe wrapper for Unix.file_descr
.
A wrapper around a Unix.file_descr
.
val of_unix :
sw:Eio.Std.Switch.t ->
blocking:bool ->
close_unix:bool ->
Unix.file_descr ->
t
of_unix ~sw ~blocking ~close_unix fd
wraps fd
.
val use_exn : string -> t -> (Unix.file_descr -> 'a) -> 'a
use_exn op t fn
calls fn wrapped_fd
, ensuring that wrapped_fd
will not be closed before fn
returns.
If t
is already closed, it raises an exception, using op
as the name of the failing operation.
val close : t -> unit
close t
marks t
as closed, so that use_exn
can no longer be used to start new operations.
The wrapped FD will be closed once all current users of the FD have finished (unless close_unix = false
).
val stdin : t
val stdout : t
val stderr : t
val to_unix : [ `Peek | `Take ] -> t -> Unix.file_descr
to_unix `Take t
closes t
without closing the wrapped FD, which it returns to the caller once all operations on it have finished.
to_unix `Peek t
returns the wrapped FD directly. You must ensure that it is not closed while using it.
val to_rcfd : t -> Eio_unix.Private.Rcfd.t
Get the underlying ref-counted FD. Note: you must not close this directly, as that will not remove the hook.
type has_fd = < fd : t >
Resources that have FDs are sub-types of has_fd
.
type Eio.Generic.ty +=
| FD : t Eio.Generic.ty
Resources that wrap FDs can handle this in their probe
method to expose the FD.
val get_fd_opt : Eio.Generic.t -> t option
get_fd_opt r
returns the t
being wrapped by a resource, if any.
This just probes r
using FD
.