Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/apps/interplane-forge/tools/bring/src/plat-linux.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / apps / interplane-forge / tools / bring / src / plat-linux.om` 132 lines ยท 2282 bytes Raw Blame History 1 note Linux aarch64 platform; flags are Linux ABI values, not policy limits. 2 fn pl_open p view uchar * how ulong mode int to long 3 ret fopen p 0 len p pl_oflag how mode 4 end 5 fn pl_close fd int to void 6 x = fclose fd 7 end 8 fn pl_unlink p view uchar * to long 9 ret unlink p 0 len p 10 end 11 fn pl_rmdir p view uchar * to long 12 ret rmdir p 0 len p 13 end 14 fn pl_mkdir p view uchar * mode int to long 15 ret makedir p 0 len p mode 16 end 17 fn pl_cd p view uchar * to long 18 ret chdir p 0 len p 19 end 20 fn pl_fcd fd int to long 21 ret fchdir fd 22 end 23 note directories: the handle is the O_DIRECTORY descriptor itself, 0 on error 24 fn pl_dopen p view uchar * to ulong 25 fd = pl_open p 1 0 26 if lt fd 0 27 ret 0 28 end 29 ret ulong fd 30 end 31 fn pl_dfd h ulong to int 32 ret int h 33 end 34 fn pl_dclose h ulong to void 35 pl_close int h 36 end 37 fn pl_dents h ulong b edit uchar * to long 38 ret getdnts int h b 0 len b 39 end 40 fn pl_dname to ulong 41 ret 19 42 end 43 fn pl_dlen b view uchar * o ulong to ulong 44 ret rd16 b add o 16 45 end 46 fn pl_stat p view uchar * b edit uchar * to long 47 ret lstat p 0 len p b 0 len b 48 end 49 fn pl_fstat fd int b edit uchar * to long 50 ret fstat fd b 0 len b 51 end 52 fn pl_readat fd int b edit uchar * pos ulong to long 53 ret pread fd b 0 len b long pos 54 end 55 fn pl_seek fd int pos ulong to long 56 ret fseek fd long pos 0 57 end 58 fn pl_trunc fd int n ulong to long 59 ret ftrunc fd long n 60 end 61 fn pl_argc to long 62 ret argcnt 63 end 64 fn pl_arg i ulong b edit uchar * to long 65 ret argread i b 0 len b 66 end 67 fn pl_envc to long 68 ret envcnt 69 end 70 fn pl_env i ulong b edit uchar * to long 71 ret envread i b 0 len b 72 end 73 fn pl_pid to long 74 ret getpid 75 end 76 fn pl_sleep to void 77 x = sleepns `1000000000` 78 end 79 fn pl_run a view uchar * inf int outf int errf int to long 80 pid = fork 81 if lt pid 0 82 ret -1 83 end 84 if eq pid 0 85 if ne inf 0 86 x = dupfd inf 0 0 87 if lt x 0 88 exit 126 89 end 90 end 91 if ne outf 1 92 x = dupfd outf 1 0 93 if lt x 0 94 exit 126 95 end 96 end 97 if ne errf 2 98 x = dupfd errf 2 0 99 if lt x 0 100 exit 126 101 end 102 end 103 x = execprog a 0 len a 104 exit 127 105 end 106 st = new uchar 4 0 107 while true bound `9223372036854775807` 108 r = waitpid int pid st 0 4 0 109 if eq r -4 110 continue 111 end 112 if ne r pid 113 ret -1 114 end 115 break 116 end 117 v = rd32 st 0 118 if ne and v 127 0 119 ret -1 120 end 121 ret long and shr v 8 255 122 end 123 fn pl_cwd o edit uchar * to ulong 124 r = cwd o 0 len o 125 if le r 0 126 die terrio 127 end 128 ret sub ulong r 1 129 end 130 fn pl_skip fd int n ulong to long 131 ret fseek fd long n 1 132 end