package eio_posix
Module Low_level.FdSource
A safe wrapper for Unix.file_descr.
A wrapper around a Unix.file_descr.
of_unix ~sw ~blocking ~close_unix fd wraps fd.
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.
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).
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.
Get the underlying ref-counted FD. Note: you must not close this directly, as that will not remove the hook.
type Eio.Generic.ty += | FD : t Eio.Generic.ty(*Resources that wrap FDs can handle this in their
*)probemethod to expose the FD.
get_fd_opt r returns the t being wrapped by a resource, if any.
This just probes r using FD.