2018-10-23 22:13:47 +00:00
|
|
|
(* (c) 2018 Hannes Mehnert, all rights reserved *)
|
|
|
|
|
2019-10-12 00:15:44 +00:00
|
|
|
val conn_metrics : string -> [ `Close | `Open ] -> unit
|
|
|
|
|
2019-10-29 22:37:42 +00:00
|
|
|
val set_tmpdir : Fpath.t -> unit
|
|
|
|
|
2018-10-23 22:03:36 +00:00
|
|
|
type service = [ `Console | `Log | `Stats | `Vmmd ]
|
|
|
|
|
|
|
|
val socket_path : service -> string
|
|
|
|
val pp_socket : service Fmt.t
|
|
|
|
|
2018-10-22 23:48:24 +00:00
|
|
|
module IS : sig
|
2018-11-11 02:09:37 +00:00
|
|
|
include Set.S with type elt = int
|
2018-10-22 23:48:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
module IM : sig
|
2018-11-11 02:09:37 +00:00
|
|
|
include Map.S with type key = int
|
2018-10-22 23:48:24 +00:00
|
|
|
end
|
|
|
|
|
2018-11-11 00:21:12 +00:00
|
|
|
module Name : sig
|
|
|
|
type t
|
|
|
|
|
|
|
|
val is_root : t -> bool
|
2018-11-12 22:56:29 +00:00
|
|
|
val equal : t -> t -> bool
|
2018-11-11 00:21:12 +00:00
|
|
|
|
|
|
|
val image_file : t -> Fpath.t
|
|
|
|
val fifo_file : t -> Fpath.t
|
|
|
|
|
|
|
|
val of_list : string list -> (t, [> `Msg of string ]) result
|
|
|
|
val to_list : t -> string list
|
2019-10-10 20:26:36 +00:00
|
|
|
val drop : t -> t
|
2019-11-09 01:44:31 +00:00
|
|
|
val drop_front : t -> t
|
2018-11-11 00:21:12 +00:00
|
|
|
val append : string -> t -> (t, [> `Msg of string ]) result
|
|
|
|
val prepend : string -> t -> (t, [> `Msg of string ]) result
|
|
|
|
val append_exn : string -> t -> t
|
2019-11-09 01:44:31 +00:00
|
|
|
val concat : t -> t -> t
|
2018-11-11 00:21:12 +00:00
|
|
|
|
|
|
|
val root : t
|
|
|
|
val valid_label : string -> bool
|
|
|
|
val to_string : t -> string
|
|
|
|
val of_string : string -> (t, [> `Msg of string ]) result
|
|
|
|
val drop_super : super:t -> sub:t -> t option
|
|
|
|
val is_sub : super:t -> sub:t -> bool
|
|
|
|
val domain : t -> t
|
|
|
|
val pp : t Fmt.t
|
|
|
|
val block_name : t -> string -> t
|
2019-10-11 22:20:58 +00:00
|
|
|
|
|
|
|
val mac : t -> string -> Macaddr.t
|
|
|
|
(** [mac t bridge] outputs deterministically a mac address for [t] on [bridge].
|
|
|
|
The resulting mac address is computed as follows: as prefix, the (no longer
|
|
|
|
active) 00:80:41 (VEB Kombinat Robotron) is used, the remaining three bytes
|
|
|
|
are the first three bytes of the MD5 digest of [bridge ^ "." ^ to_string t].
|
|
|
|
|
|
|
|
i.e., [mac ["foo";"bar"] "default" = 00:80:41:1b:11:78] *)
|
2018-11-11 00:21:12 +00:00
|
|
|
end
|
2018-10-22 23:48:24 +00:00
|
|
|
|
2018-11-11 02:09:37 +00:00
|
|
|
module Policy : sig
|
|
|
|
type t = {
|
|
|
|
vms : int;
|
|
|
|
cpuids : IS.t;
|
|
|
|
memory : int;
|
|
|
|
block : int option;
|
2018-11-12 21:07:45 +00:00
|
|
|
bridges : Astring.String.Set.t;
|
2018-11-11 02:09:37 +00:00
|
|
|
}
|
2018-10-28 18:41:06 +00:00
|
|
|
|
2018-11-11 02:09:37 +00:00
|
|
|
val equal : t -> t -> bool
|
2018-10-22 23:48:24 +00:00
|
|
|
|
2018-11-11 02:09:37 +00:00
|
|
|
val pp : t Fmt.t
|
|
|
|
end
|
2018-10-22 23:48:24 +00:00
|
|
|
|
2018-11-13 00:02:05 +00:00
|
|
|
module Unikernel : sig
|
2019-10-11 21:40:27 +00:00
|
|
|
type typ = [ `Solo5 ]
|
2018-11-13 00:02:05 +00:00
|
|
|
val pp_typ : typ Fmt.t
|
2018-11-11 02:20:22 +00:00
|
|
|
|
2019-10-11 22:01:36 +00:00
|
|
|
type fail_behaviour = [ `Quit | `Restart of IS.t option ]
|
2019-10-10 23:10:33 +00:00
|
|
|
|
2018-11-11 02:20:22 +00:00
|
|
|
type config = {
|
2019-10-11 21:40:27 +00:00
|
|
|
typ : typ ;
|
|
|
|
compressed : bool ;
|
|
|
|
image : Cstruct.t ;
|
2019-10-10 23:10:33 +00:00
|
|
|
fail_behaviour : fail_behaviour;
|
2019-10-11 21:40:27 +00:00
|
|
|
cpuid : int ;
|
|
|
|
memory : int ;
|
|
|
|
block_devices : string list ;
|
2020-03-25 14:19:28 +00:00
|
|
|
bridges : (string * string option) list ;
|
2019-10-11 21:40:27 +00:00
|
|
|
argv : string list option ;
|
2018-11-11 02:20:22 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 14:19:28 +00:00
|
|
|
val bridges : config -> string list
|
|
|
|
|
2018-11-11 02:20:22 +00:00
|
|
|
val pp_config : config Fmt.t
|
|
|
|
|
2019-10-11 22:01:36 +00:00
|
|
|
val restart_handler : config -> bool
|
|
|
|
|
2018-11-11 02:20:22 +00:00
|
|
|
type t = {
|
|
|
|
config : config;
|
|
|
|
cmd : Bos.Cmd.t;
|
|
|
|
pid : int;
|
|
|
|
taps : string list;
|
|
|
|
}
|
|
|
|
|
|
|
|
val pp : t Fmt.t
|
|
|
|
end
|
2018-10-22 23:48:24 +00:00
|
|
|
|
2018-10-23 22:03:36 +00:00
|
|
|
module Stats : sig
|
|
|
|
type rusage = {
|
|
|
|
utime : int64 * int;
|
|
|
|
stime : int64 * int;
|
|
|
|
maxrss : int64;
|
|
|
|
ixrss : int64;
|
|
|
|
idrss : int64;
|
|
|
|
isrss : int64;
|
|
|
|
minflt : int64;
|
|
|
|
majflt : int64;
|
|
|
|
nswap : int64;
|
|
|
|
inblock : int64;
|
|
|
|
outblock : int64;
|
|
|
|
msgsnd : int64;
|
|
|
|
msgrcv : int64;
|
|
|
|
nsignals : int64;
|
|
|
|
nvcsw : int64;
|
|
|
|
nivcsw : int64;
|
|
|
|
}
|
|
|
|
val pp_rusage : rusage Fmt.t
|
2019-01-06 00:12:56 +00:00
|
|
|
val pp_rusage_mem : rusage Fmt.t
|
|
|
|
|
|
|
|
type kinfo_mem = {
|
|
|
|
vsize : int64 ;
|
|
|
|
rss : int64 ;
|
|
|
|
tsize : int64 ;
|
|
|
|
dsize : int64 ;
|
|
|
|
ssize : int64 ;
|
2019-10-02 20:02:07 +00:00
|
|
|
runtime : int64 ;
|
|
|
|
cow : int ;
|
|
|
|
start : (int64 * int) ;
|
2019-01-06 00:12:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
val pp_kinfo_mem : kinfo_mem Fmt.t
|
2018-10-23 22:03:36 +00:00
|
|
|
|
|
|
|
type vmm = (string * int64) list
|
|
|
|
val pp_vmm : vmm Fmt.t
|
2019-01-06 00:12:56 +00:00
|
|
|
val pp_vmm_mem : vmm Fmt.t
|
2018-10-23 22:03:36 +00:00
|
|
|
|
|
|
|
type ifdata = {
|
2019-01-14 23:25:59 +00:00
|
|
|
bridge : string;
|
2018-10-23 22:03:36 +00:00
|
|
|
flags : int32;
|
|
|
|
send_length : int32;
|
|
|
|
max_send_length : int32;
|
|
|
|
send_drops : int32;
|
|
|
|
mtu : int32;
|
|
|
|
baudrate : int64;
|
|
|
|
input_packets : int64;
|
|
|
|
input_errors : int64;
|
|
|
|
output_packets : int64;
|
|
|
|
output_errors : int64;
|
|
|
|
collisions : int64;
|
|
|
|
input_bytes : int64;
|
|
|
|
output_bytes : int64;
|
|
|
|
input_mcast : int64;
|
|
|
|
output_mcast : int64;
|
|
|
|
input_dropped : int64;
|
|
|
|
output_dropped : int64;
|
|
|
|
}
|
|
|
|
val pp_ifdata : ifdata Fmt.t
|
|
|
|
|
2019-01-06 00:12:56 +00:00
|
|
|
type t = rusage * kinfo_mem option * vmm option * ifdata list
|
2018-10-23 22:03:36 +00:00
|
|
|
val pp : t Fmt.t
|
|
|
|
end
|
|
|
|
|
|
|
|
type process_exit = [ `Exit of int | `Signal of int | `Stop of int ]
|
|
|
|
|
|
|
|
val pp_process_exit : process_exit Fmt.t
|
|
|
|
|
2019-10-11 22:01:36 +00:00
|
|
|
val should_restart : Unikernel.config -> Name.t -> process_exit -> bool
|
|
|
|
|
2018-10-23 22:03:36 +00:00
|
|
|
module Log : sig
|
|
|
|
type log_event = [
|
2018-11-11 00:21:12 +00:00
|
|
|
| `Login of Name.t * Ipaddr.V4.t * int
|
|
|
|
| `Logout of Name.t * Ipaddr.V4.t * int
|
2018-10-23 22:03:36 +00:00
|
|
|
| `Startup
|
2019-09-28 17:09:45 +00:00
|
|
|
| `Unikernel_start of Name.t * int * (string * string) list * (string * Name.t) list
|
2018-12-06 21:53:15 +00:00
|
|
|
| `Unikernel_stop of Name.t * int * process_exit
|
|
|
|
| `Hup
|
|
|
|
]
|
2018-10-23 22:03:36 +00:00
|
|
|
|
2018-11-11 00:21:12 +00:00
|
|
|
val name : log_event -> Name.t
|
2018-10-23 22:03:36 +00:00
|
|
|
|
|
|
|
val pp_log_event : log_event Fmt.t
|
|
|
|
|
|
|
|
type t = Ptime.t * log_event
|
|
|
|
|
|
|
|
val pp : t Fmt.t
|
|
|
|
end
|