package devkit

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Devkit_core.NixSource

*nix support

Sourceval fork : unit -> [> `Child | `Forked of int ]
Sourceval unparent : unit -> unit

fork off and die

Sourceval daemonize : unit -> unit
Sourceval write_pidfile : string -> unit
Sourceval read_pidfile : string -> int
Sourceval probe_pidfile : string -> [> `Alive of int | `Error of exn | `Missing | `Stale ]
Sourceval check_pidfile : string -> unit
Sourceval manage_pidfile : string -> unit
Sourceval restart : ('a -> 'b) -> 'a -> 'b
Sourceval handle_sig_exit_with : exit:bool -> (unit -> unit) -> unit

NB be careful with mutexes in signal handlers. Outputting anything to ocaml channels is a potential deadlock. Use signalfd which invokes signal handlers in predictable context.

  • deprecated

    easy to deadlock, use signalfd instead

Sourceval handle_sig_reload_with : (unit -> unit) -> unit
  • deprecated

    easy to deadlock, use signalfd instead

Sourceval show_addr : Unix.sockaddr -> string
Sourceval get_inet_addr_exn : Unix.sockaddr -> Unix.inet_addr
Sourceval show_inet_addr_exn : Unix.sockaddr -> string
Sourceval make_inet_addr_exn : string -> int -> Unix.sockaddr
Sourceval inet_addr_of_string : string -> Unix.sockaddr
Sourceval unix_addr_of_string : string -> Unix.sockaddr
Sourceval parse_addr_port_exn : string -> string * int
Sourceval parse_ip_port_exn : string -> Unix.inet_addr * int

Parse input as ip:port

  • returns

    a tuple representing ip and port

Sourceval sockaddr_of_string : string -> Unix.sockaddr

Convert a string to a Unix.sockaddr.

Formats supported are:

  • unix:file_path
  • host:port
  • *:port, using Unix.inet_addr_any
  • port, using Unix.inet_addr_loopback
Sourceval read_process : string -> string

Execute process and capture stdout to string,

  • returns

    empty string on error

module Ev = Libevent
Sourceval output_process_exit : string -> Unix.process_status IO.output
  • returns

    IO.t to feed stdin of spawned process

Sourceval output_process : string -> unit IO.output
  • returns

    IO.t to feed stdin of spawned process

Sourceval write_process_exn : string -> Bytes.t -> unit
Sourceval write_process : string -> Bytes.t -> bool
Sourceval mounts : unit -> (string * string * string list) list
Sourceval find_mount : string -> string * string * string list
  • parameter path

    must be normalized

Sourceval sleep : float -> unit
Sourceval output_buf_fd : ?bufsize:int -> Unix.file_descr -> unit IO.output

Buffered output to Unix.file_descr. Doesn't own the file descriptor.

Sourceval unlimit_soft : Devkit_core.Prelude.U.resource -> unit
Sourceval raise_limits : unit -> unit

raise core and nofile soft limits (to the corresponding hard limits)

Sourceval connect : Unix.file_descr -> Unix.sockaddr -> unit
Sourceval get_xdg_dir : env:string -> string -> string
Sourceval xdg_cache_dir : string lazy_t
Sourceval xdg_config_dir : string lazy_t
Sourceval quote_if_needed : string -> string
Sourceval args : string list
Sourceval cmdline : string
OCaml

Innovation. Community. Security.