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-bridge/blob/main/tests/native/v2/dev/context-ro.c # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / tests / native / v2 / dev / context-ro.c` 31 lines ยท 987 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ 2 #define _GNU_SOURCE 3 /* White-box oracle only: production consumers include omega_native.h. */ 4 #include "omega_native.c" 5 #include 6 #include 7 #include 8 #include 9 static void cannot_write(const ombr_rt *rt) 10 { 11 pid_t pid = fork(); 12 assert(pid >= 0); 13 if (pid == 0) { 14 const void *volatile *entry = (const void *volatile *)(uintptr_t)rt; 15 entry[31] = 0; 16 _exit(0); 17 } 18 int status; 19 assert(waitpid(pid, &status, 0) == pid); 20 assert(WIFSIGNALED(status) && (WTERMSIG(status) == SIGSEGV || WTERMSIG(status) == SIGBUS)); 21 } 22 int main(void) 23 { 24 omega_native_context *c = 0; 25 assert(omega_native_context_create(1, &c) == OMEGA_OK); 26 cannot_write(c->rt); 27 cannot_write(&ombr_rt_table); 28 assert(omega_native_context_destroy(c) == OMEGA_OK); 29 puts("NATIVE-CONTEXT-RO PASS default and explicit dispatch tables reject writes"); 30 return 0; 31 }