~/bend-docscommunity

main.bend relies on unsafe/foreign

raw source on the hub · import 0xee7f0dd7e7a8915ce966ea5d2ce153b5/main.bend as Main

7 imports
import Base
import ./host/main.bend as H
import ./host/api.bend as A
import ./host/hvf.bend as Hv
import ./src/vmm/snapdir.bend as Sd
import ./src/vmm/hostfiles.bend as Hf
import ./src/lib/u64.bend as U

Definitions

def Vmm.status source · line 32 · raw

@+vm:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Status>)

Calls on a VM from another process. vm is its folder or its --control socket; each answers a Result whose error (A.Err) tells no socket, not running and timeout apart. Snapshots need a folder (src/vmm/snapdir.bend: DIR/snapshots/NAME). Nothing prints or ends the process.

def Vmm.pause source · line 35 · raw

@+vm:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.resume source · line 38 · raw

@+vm:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.stop source · line 41 · raw

@+vm:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.powerdown source · line 44 · raw

@+vm:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.ctl source · line 47 · raw

@+vm:String -> @+line:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.create source · line 50 · raw

@+dir:String -> @+flags:List<&2, String> -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.snapshot source · line 53 · raw

@+vm:String -> @+name:String -> @+note:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/vmm/snapdir.Info>)

def Vmm.snapshots source · line 56 · raw

@+vm:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, List<&2, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/vmm/snapdir.Info>>)

def Vmm.snapshot_rm source · line 59 · raw

@+vm:String -> @+name:String -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, String>)

def Vmm.prune source · line 62 · raw

@+vm:String -> @+keep:U32 -> IO(Result<&1, &1, 0xee7f0dd7e7a8915ce966ea5d2ce153b5/host/api.Err, List<&2, String>>)

def Fs.ls source · line 73 · raw

@+dir:String -> IO(List<&1, String>)

The names in a directory, but . and .. ([] when it cannot be read).

def Fs.facts source · line 78 · raw

@+path:String -> IO(0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/vmm/hostfiles.Facts)

What path is: kind (0 nothing, 1 a directory, 2 a regular file, 3 a symlink, 4 anything else), size in bytes, mtime in seconds since 1970.

def Fs.rename source · line 82 · raw

@+from:String -> @+to:String -> IO(U32)

Replaces a file or symlink at to.

def Fs.remove source · line 86 · raw

@+path:String -> IO(U32)

Removes a file (not a directory).

def Fs.rmdir source · line 90 · raw

@+path:String -> IO(U32)

Removes an empty directory.

def Fs.mkdir_p source · line 94 · raw

@+path:String -> @+mode:U32 -> IO(U32)

mkdir -p with mode for each directory it makes.

def Fs.set_mtime source · line 98 · raw

@+path:String -> @t:0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/lib/u64.U64 -> IO(U32)

Sets path's modification time (seconds since 1970); its access time stays.

def Fs.now source · line 102 · raw

IO(0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/lib/u64.U64)

The wall clock, in seconds since 1970.

def Fs.fsync source · line 107 · raw

@+path:String -> IO(U32)

Writes a file's data (fsync) or a directory's entries (fsync_dir) to the disk, so a publish (write, fsync, rename, fsync_dir) survives a crash.

def Fs.fsync_dir source · line 110 · raw

@+path:String -> IO(U32)

def Fs.chmod source · line 114 · raw

@+path:String -> @+mode:U32 -> IO(U32)

Sets path's permission bits (mode & 0o7777), never through a symlink.

Unsafe

unsafe Vmm.run source · line 16 · raw

@+prog:List<&1, String> -> @+flags:List<&1, String> -> IO(Unit)

unsafe Vmm.run_dir source · line 22 · raw

@+prog:List<&1, String> -> @+dir:String -> IO(Unit)

A VM folder (bend-vmm create): runs its VM (vm.conf, its control socket DIR/control.sock), or runs it from one of its snapshots, saving the current state first (bend-vmm restore).

unsafe Vmm.restore source · line 25 · raw

@+prog:List<&1, String> -> @+vm:String -> @+name:String -> IO(Unit)

unsafe main source · line 65 · raw

IO(Unit)