src/vmm/hostfiles.bend checks
raw source on the hub · import 0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/vmm/hostfiles.bend as Hostfiles
2 imports
import Base import ../lib/u64.bend as U
Types
type Listen source · line 29 · raw
Data
LBindListen
LReplaceListen
LInUseListen
LNotSocketListen
type Facts source · line 144 · raw
Data
Files for a program that embeds the VMM (main.bend's Fs, asked by
bend-vk8s): what a path is (Hvf.path_facts' words, decoded) and the
directories mkdir -p makes, in order.
Facts@kind:U32 -> @size:0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/lib/u64.U64 -> @mtime:0xee7f0dd7e7a8915ce966ea5d2ce153b5/src/lib/u64.U64 -> Facts
Definitions
def Files.private source · line 23 · raw
U32
def Files.private_dir source · line 26 · raw
U32
def Files.listen.sock source · line 37 · raw
@live:Bool -> Listen
kind: 0 nothing, 1 a socket, 2 anything else (as lstat sees it, so a symlink is anything else); live: a process accepted a connection on it.
def Files.listen source · line 44 · raw
@+kind:U32 -> @live:Bool -> Listen
def Files.listen.why source · line 48 · raw
@l:Listen -> String
Why a listen was refused, for the error message; "" when it may go on.
def Files.listen.replace source · line 59 · raw
@l:Listen -> Bool
def Files.dir_trusted source · line 68 · raw
@+kind:U32 -> @mine:Bool -> @+perm:U32 -> Bool
kind: 0 nothing, 1 a directory, 2 anything else (lstat); mine: this user's; perm: its permission bits.
def Files.hex2 source · line 74 · raw
@+b:U32 -> String
A VM's socket in the LAN directory: its MAC, two lowercase hex digits a byte joined by "-", then ".sock" (host/hvf.c binds and sends to the names Bend gives it).
def Files.mac.go source · line 77 · raw
@bs:List<&2, U32> -> String
def Files.lan_sock source · line 86 · raw
@+mac:List<&2, U32> -> String
def Files.lan_peer source · line 91 · raw
@+self:String -> @+name:String -> Bool
A broadcast's recipients: of Hvf.lan_names' answer (this VM's socket, then the names in the LAN directory), every VM's socket but this one's.
def Files.lan_peers.keep source · line 94 · raw
@keep:Bool -> @n:String -> @rest:List<&1, String> -> List<&1, String>
def Files.lan_peers.go source · line 101 · raw
@+self:String -> @names:List<&1, String> -> List<&1, String>
def Files.lan_peers source · line 108 · raw
@names:List<&1, String> -> List<&1, String>
def Files.exec_path source · line 119 · raw
@+sys:String -> @+argv0:String -> String
The program a guest reset starts again (Hvf.reexec): this executable as the system names it (Hvf.exe_path; "" when it cannot), else the first argument as given, found from the working directory; "" when there is neither, and the reset fails.
def Files.utf8_len source · line 123 · raw
@s:String -> U32
A socket path's bytes (UTF-8, as the host passes it to bind).
def Files.sock_path_fits source · line 135 · raw
@+path:String -> @+max:U32 -> Bool
Whether a Unix socket can be bound at path: its bytes fit the address's path field, which holds max of them and the closing 0 (Hvf.sock_path_max: 103 on macOS, 107 on Linux). Checked before listening, so a long path is an error that says so.
def Files.sock_path_why source · line 138 · raw
@+path:String -> @+max:U32 -> String
def Files.facts.at source · line 147 · raw
@+ws:List<&2, U32> -> @+i:Nat -> U32
def Files.kind source · line 153 · raw
@+there:U32 -> @+mode:U32 -> U32
kind: 0 nothing, 1 a directory, 2 a regular file, 3 a symlink, 4 else; from the mode's file type (st_mode & 0o170000, the same on macOS and Linux: 0o040000 a directory, 0o100000 a regular file, 0o120000 a symlink).
def Files.facts source · line 161 · raw
@+ws:List<&2, U32> -> Facts
Hvf.path_facts' words: [there, mode, size (hi, lo), mtime (hi, lo)].
def Files.prefixes.with source · line 165 · raw
@+acc:String -> @+p:String -> String
acc then the directories under it that parts name (empty parts skipped).
def Files.prefixes.go source · line 168 · raw
@parts:List<&2, String> -> @+acc:String -> List<&2, String>
def Files.prefixes.first source · line 176 · raw
@parts:List<&2, String> -> List<&2, String>
def Files.prefixes source · line 185 · raw
@path:String -> List<&2, String>
The directories mkdir -p path makes, outermost first: "/a/b" is "/a"
then "/a/b", "a//b/" is "a" then "a/b".
def Files.is_link source · line 190 · raw
@f:Facts -> Bool
Whether a path's facts say it is a symlink (Fs.no_symlinks refuses a path with one anywhere along it).