Files
Odin/base/runtime/os_specific.odin
Yawning Angel e1ba69ea51 base/runtime: Add rand_bytes and HAS_RAND_BYTES
Having the OS/runtime provide a cryptographic entropy source is the
right thing to do, and we need it to initialize the default random
number generator.
2025-11-29 10:45:53 +09:00

21 lines
412 B
Odin

package runtime
_OS_Errno :: distinct int
HAS_RAND_BYTES :: _HAS_RAND_BYTES
stderr_write :: proc "contextless" (data: []byte) -> (int, _OS_Errno) {
return _stderr_write(data)
}
rand_bytes :: proc "contextless" (dst: []byte) {
when HAS_RAND_BYTES {
_rand_bytes(dst)
} else {
panic_contextless("base/runtime: no runtime entropy source")
}
}
exit :: proc "contextless" (code: int) -> ! {
_exit(code)
}