jon.recoil.org

Module Eio_posix.Low_levelSource

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:

  1. They suspend the calling fiber instead of returning EAGAIN or similar.
  2. They handle EINTR by automatically restarting the call.
  3. They wrap Unix.file_descr in Fd, to avoid use-after-close bugs.
  4. They attach new FDs to switches, to avoid resource leaks.
type fd := Eio_unix.Fd.t
Sourcetype dir_fd =
  1. | Fd of Eio_posix.Low_level.fd
    (*

    Confined to fd.

    *)
  2. | Cwd
    (*

    Confined to "."

    *)
  3. | Fs
    (*

    Unconfined "."; also allows absolute paths

    *)
Sourceval await_readable : string -> Eio_posix.Low_level.fd -> unit
Sourceval await_writable : string -> Eio_posix.Low_level.fd -> unit
Sourceval sleep_until : Mtime.t -> unit
Sourceval read : Eio_posix.Low_level.fd -> bytes -> int -> int -> int
Sourceval write : Eio_posix.Low_level.fd -> bytes -> int -> int -> int
Sourceval recv_msg : Eio_posix.Low_level.fd -> Cstruct.t array -> Unix.sockaddr * int
Sourceval recv_msg_with_fds : sw:Eio.Std.Switch.t -> max_fds:int -> Eio_posix.Low_level.fd -> Cstruct.t array -> Unix.sockaddr * int * Eio_posix.Low_level.fd list
Sourceval send_msg : Eio_posix.Low_level.fd -> ?fds:Eio_posix.Low_level.fd list -> ?dst:Unix.sockaddr -> Cstruct.t array -> int
Sourceval getrandom : Cstruct.t -> unit
Sourceval lseek : Eio_posix.Low_level.fd -> Optint.Int63.t -> [ `Set | `Cur | `End ] -> Optint.Int63.t
Sourceval fsync : Eio_posix.Low_level.fd -> unit
Sourceval ftruncate : Eio_posix.Low_level.fd -> Optint.Int63.t -> unit
Sourcetype stat
Sourceval create_stat : unit -> Eio_posix.Low_level.stat
Sourceval fstatat : buf:Eio_posix.Low_level.stat -> follow:bool -> Eio_posix.Low_level.dir_fd -> string -> unit
Sourceval blksize : Eio_posix.Low_level.stat -> int64
Sourceval size : Eio_posix.Low_level.stat -> int64
Sourceval rdev : Eio_posix.Low_level.stat -> int64
Sourceval atime_sec : Eio_posix.Low_level.stat -> int64
Sourceval ctime_sec : Eio_posix.Low_level.stat -> int64
Sourceval mtime_sec : Eio_posix.Low_level.stat -> int64
Sourceval atime_nsec : Eio_posix.Low_level.stat -> int
Sourceval ctime_nsec : Eio_posix.Low_level.stat -> int
Sourceval mtime_nsec : Eio_posix.Low_level.stat -> int
Sourceval realpath : string -> string
Sourceval mkdir : mode:int -> Eio_posix.Low_level.dir_fd -> string -> unit
Sourceval rename : Eio_posix.Low_level.dir_fd -> string -> Eio_posix.Low_level.dir_fd -> string -> unit

symlink ~link_to dir path will create a new symlink at dir / path linking to link_to.

Sourceval readdir : Eio_posix.Low_level.dir_fd -> string -> string array
Sourceval readv : Eio_posix.Low_level.fd -> Cstruct.t array -> int
Sourceval writev : Eio_posix.Low_level.fd -> Cstruct.t array -> int
Sourceval preadv : file_offset:Optint.Int63.t -> Eio_posix.Low_level.fd -> Cstruct.t array -> int
Sourceval pwritev : file_offset:Optint.Int63.t -> Eio_posix.Low_level.fd -> Cstruct.t array -> int
Sourcemodule Open_flags : sig ... end

Note: the returned FD is always non-blocking and close-on-exec.

Sourcemodule Process : sig ... end