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