interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / host / execenv / oracle.om

45 lines · 1322 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note seed/host/execenv/oracle.om: execenv against an independent ORACLE, /usr/bin/printenv (a host
3note binary, never shipped). Without arguments the program replaces itself, through execenv, with
4note /usr/bin/printenv under an environment of exactly the three records below, so stdout must be those
5note three lines in packet order (seed/host/execenv/printenv.want). With one argument it is the
6note negative control: the same argv through execprog, whose child gets an empty environment, so
7note printenv prints nothing. Exit 99 means the exec returned.
8om2
9text pe "/usr/bin/printenv"
10text tok "AIEN_COCKPIT_TOKEN=fixture-token-execenv"
11text addr "AIEN_COCKPIT_ADDR=127.0.0.1:1"
12text db "HIVE_DB_PATH=/nonexistent/hive.db"
13global argv uchar 64
14global envp uchar 4096
15
16fn erec pos ulong s view uchar * to ulong
17put envp pos uchar and len s 255
18put envp add pos 1 uchar shr len s 8
19for i ulong len s
20put envp add add pos 2 i get s i
21end
22ret add add pos 2 len s
23end
24
25fn main to int
26put argv 0 1
27put argv 1 0
28put argv 2 uchar len pe
29put argv 3 0
30for i ulong len pe
31put argv add i 4 get pe i
32end
33an = add len pe 4
34put envp 0 3
35put envp 1 0
36en = erec 2 tok
37en = erec en addr
38en = erec en db
39if eq argcnt 2
40r = execprog argv 0 an
41ret 99
42end
43r = execenv argv 0 an envp 0 en
44ret 99
45end