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
type dir_fd =
| Fd of fd
Confined to fd
.
| Cwd
Confined to "."
*)| Fs
Unconfined "."; also allows absolute paths
*)val await_readable : string -> fd -> unit
val await_writable : string -> fd -> 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 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 read_link : dir_fd -> string -> string
val mkdir : mode:int -> dir_fd -> string -> unit
val unlink : dir:bool -> dir_fd -> string -> unit
val symlink : link_to:string -> dir_fd -> string -> unit
symlink ~link_to dir path
will create a new symlink at dir / path
linking to link_to
.
val readdir : dir_fd -> string -> string array
val readv : fd -> Cstruct.t array -> int
val writev : fd -> Cstruct.t array -> int
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 :
sw:Eio.Std.Switch.t ->
mode:int ->
dir_fd ->
string ->
Open_flags.t ->
fd
Note: the returned FD is always non-blocking and close-on-exec.
module Process : sig ... end