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 / tests / chmod.om

37 lines · 635 bytes Raw Blame History
1note chmod: path permissions through fchmodat; mode 0600 is 384, checked in st_mode at byte 16.
2text p "mode.tmp"
3text miss "no.such.file"
4fn main to int
5fd = int fopen p 0 len p 578 420
6if lt fd 0
7ret 1
8end
9r = fclose fd
10if ne r 0
11ret 2
12end
13r = chmod p 0 len p 384
14if ne r 0
15ret 3
16end
17buf = new uchar 128 0
18r = stat p 0 len p buf 0 128
19if ne r 0
20ret 4
21end
22m = add ulong get buf 16 shl ulong get buf 17 ulong 8
23m = add m shl ulong get buf 18 ulong 16
24m = add m shl ulong get buf 19 ulong 24
25if ne and m ulong 4095 ulong 384
26ret 5
27end
28r = chmod miss 0 len miss 384
29if ge r 0
30ret 6
31end
32r = unlink p 0 len p
33if ne r 0
34ret 7
35end
36ret 0
37end