src/vmm/control.bend checks
raw source on the hub · import 0xab9fd5982a23be6a9b632b364492ce07/src/vmm/control.bend as Control
3 imports
import Base import ../lib/u64.bend as U import ../disk/pack.bend as Pk
Types
type Cmd source · line 10 · raw
Data
CPauseCmd
CResumeCmd
CStatusCmd
CQuitCmd
CNetCmd
CPowerdownCmd
CSnapshot@path:String -> Cmd
CScreendump@path:String -> Cmd
CType@text:String -> Cmd
CPointer@x:U32 -> @y:U32 -> Cmd
CPointerUsageCmd
CUnknownCmd
CBad@why:String -> Cmd
CStatusJsonCmd
CBalloon@mib:U32 -> Cmd
balloon MiB: the balloon's target (--balloon free-page-reporting).
CBalloonAutoCmd
balloon auto: the automatic balloon takes over again (the default; balloon MiB sets a target by hand and stops it).
CHibernate@path:String -> Cmd
hibernate PATH: the VM pauses and stays paused, and its RAM moves into a file at PATH that guest RAM then maps; the file is removed at once (its space comes back when the next snapshot or the VM's exit lets it go). Disks are not kept: the file is no snapshot to restore.
CPackAdd@path:String -> Cmd
pack add PATH: the file joins the pack (--pack NAME) at its end; the reply is its OFFSET and LENGTH in bytes. pack drop OFFSET: the entry there is dead (src/disk/pack.bend).
CPackDrop@off:0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64 -> Cmd
Definitions
def Ctl.usage source · line 41 · raw
String
def Ctl.pointer_usage source · line 44 · raw
String
def Ctl.pointer.mk source · line 48 · raw
@x:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cmd
pointer X Y: two numbers on the tablet's 0..32767 scale.
def Ctl.pointer source · line 55 · raw
@ws:List<&2, String> -> Cmd
def Ctl.balloon_usage source · line 64 · raw
String
balloon MiB: the memory the guest is asked to give to the balloon, 0 to 1048576 MiB (0: give it all back).
def Ctl.balloon source · line 67 · raw
@m:Maybe<&2, U32> -> Cmd
def Ctl.mib_pages source · line 75 · raw
@+mib:U32 -> U32
MiB as 4 KiB pages, and back (rounded down).
def Ctl.pages_mib source · line 78 · raw
@+pages:U32 -> U32
def Ctl.balloon_reply source · line 82 · raw
@+target:U32 -> @+actual:U32 -> String
The balloon's reply: its target and how much is in it now, in MiB.
def Ctl.no_balloon source · line 85 · raw
String
def Ctl.status_json_balloon source · line 90 · raw
@paused:Bool -> @+target:U32 -> @+actual:U32 -> String
status json with a balloon: the state, then the balloon's target and what is in it, in MiB (without one, Ctl.status_json).
def Ctl.status_json_kept source · line 96 · raw
@paused:Bool -> @+target:U32 -> @+actual:U32 -> @+kept:U32 -> String
status json with a balloon and what of it the host still holds: kept_mib is the memory in the balloon the host could not release (pages of 16 KiB blocks the balloon holds only part of).
def Ctl.ram_json source · line 101 · raw
@+resident_kib:U32 -> @+compressed_kib:U32 -> String
status json's guest RAM: what of it the host holds, resident and (macOS) compressed, in MiB from KiB; spliced before the object's closing brace.
def Ctl.with_hibernated source · line 106 · raw
@+json:String -> @hib:Bool -> String
status json says whether the VM is hibernated (hibernate PATH, until it resumes): its state stays "paused", for readers that know only that.
def Ctl.with_ram source · line 109 · raw
@+json:String -> @+resident_kib:U32 -> @+compressed_kib:U32 -> String
def Ctl.exit_name source · line 115 · raw
@+b:U32 -> String
An exit bucket's name (host/hvf.c's hvf_exit_bucket): 0..63 an exception's class on Hypervisor.framework, 64 a vtimer, 65 canceled (a kick), 66 + a KVM exit reason, 127 anything else.
def Ctl.exits_go source · line 134 · raw
@ws:List<&2, U32> -> @left:Nat -> String
Hvf.exit_counts' words ([cpu, n, n pairs of (bucket, count)] per vCPU) as JSON: each vCPU opens with "},{" (Ctl.exits_json trims the first).
def Ctl.exits_json source · line 143 · raw
@ws:List<&2, U32> -> String
def Ctl.with_exits source · line 148 · raw
@+json:String -> @ws:List<&2, U32> -> String
status json's exits by vCPU, spliced before the object's closing brace.
def Ctl.needs source · line 152 · raw
@+arg:String -> @c:Cmd -> @why:String -> Cmd
A command that takes an argument, given none: its usage.
def Ctl.status_json source · line 156 · raw
@paused:Bool -> String
status json: the VM's state as one JSON object, for programs.
def Ctl.pack_usage source · line 159 · raw
String
def Ctl.pack_drop source · line 162 · raw
@m:Maybe<&2, 0xab9fd5982a23be6a9b632b364492ce07/src/lib/u64.U64> -> Cmd
def Ctl.pack source · line 170 · raw
@+arg:String -> Cmd
pack add PATH, pack drop OFFSET (decimal bytes).
def Ctl.with_pack source · line 179 · raw
@+json:String -> @+pj:String -> String
status json with the pack's table ("pack":{...}) before the closing brace, when the VM has one (pj empty: it has none).
def Ctl.verb source · line 182 · raw
@+verb:String -> @+arg:String -> Cmd
def Ctl.parse source · line 200 · raw
@line:String -> Cmd
One command line: its first word is the verb, the rest (one space between words) its argument.
def Ctl.chars source · line 205 · raw
@bs:List<&2, U32> -> String
Bytes as characters, one per byte (as host/fs.bend's Fs.chars).
def Ctl.frame.got source · line 212 · raw
@+status:U32 -> @+line:List<&2, U32> -> Maybe<&2, Cmd>
def Ctl.frame source · line 219 · raw
@bs:List<&2, U32> -> Maybe<&2, Cmd>
What the host read from a control client (Hvf.ctl_next): [0, a line's bytes...] is a command (an empty line too: it gets the usage), [1, ...] a line cut short, anything else (no control socket) ends the service.