Eio_posix.Low_level
Low-level API for making POSIX calls directly.
This module provides an effects-based API for calling POSIX functions.
Normally it's better to use the cross-platform Eio
APIs instead, which uses these functions automatically where appropriate.
These functions mostly copy the POSIX APIs directly, except that:
EAGAIN
or similar.EINTR
by automatically restarting the call.Unix.file_descr
in Fd
, to avoid use-after-close bugs.type fd := Eio_unix.Fd.t
val await_readable : string -> fd -> unit
val await_writable : string -> fd -> unit
val sleep_until : Mtime.t -> unit
val read : fd -> bytes -> int -> int -> int
val write : fd -> bytes -> int -> int -> int
val socket :
sw:Eio.Std.Switch.t ->
Unix.socket_domain ->
Unix.socket_type ->
int ->
fd
val connect : fd -> Unix.sockaddr -> unit
val accept : sw:Eio.Std.Switch.t -> fd -> fd * Unix.sockaddr
val shutdown : fd -> Unix.shutdown_command -> unit
val recv_msg : fd -> Cstruct.t array -> Unix.sockaddr * int
val recv_msg_with_fds :
sw:Eio.Std.Switch.t ->
max_fds:int ->
fd ->
Cstruct.t array ->
Unix.sockaddr * int * fd list
val send_msg :
fd ->
?fds:fd list ->
?dst:Unix.sockaddr ->
Cstruct.t array ->
int
val getrandom : Cstruct.t -> unit
val lseek : fd -> Optint.Int63.t -> [ `Set | `Cur | `End ] -> Optint.Int63.t
val fsync : fd -> unit
val ftruncate : fd -> Optint.Int63.t -> unit
val create_stat : unit -> stat
val blksize : stat -> int64
val nlink : stat -> int64
val uid : stat -> int64
val gid : stat -> int64
val ino : stat -> int64
val size : stat -> int64
val rdev : stat -> int64
val dev : stat -> int64
val perm : stat -> int
val mode : stat -> int
val kind : stat -> Eio.File.Stat.kind
val atime_sec : stat -> int64
val ctime_sec : stat -> int64
val mtime_sec : stat -> int64
val atime_nsec : stat -> int
val ctime_nsec : stat -> int
val mtime_nsec : stat -> int
val mkdir : ?dirfd:fd -> mode:int -> string -> unit
val unlink : ?dirfd:fd -> dir:bool -> string -> unit
val preadv : file_offset:Optint.Int63.t -> fd -> Cstruct.t array -> int
val pwritev : file_offset:Optint.Int63.t -> fd -> Cstruct.t array -> int
val pipe : sw:Eio.Std.Switch.t -> fd * fd
module Open_flags : sig ... end
val openat :
?dirfd:fd ->
sw:Eio.Std.Switch.t ->
mode:int ->
string ->
Open_flags.t ->
fd
Note: the returned FD is always non-blocking and close-on-exec.
module Process : sig ... end