From ed50bd1b655ff028bdd650edecdcdd6675f1dee0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 17 Aug 2016 20:11:04 -0700 Subject: progress toward stack trace printing --- std/os.zig | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'std/os.zig') diff --git a/std/os.zig b/std/os.zig index a60cd6a575..869054e012 100644 --- a/std/os.zig +++ b/std/os.zig @@ -4,7 +4,7 @@ const errno = @import("errno.zig"); pub error SigInterrupt; pub error Unexpected; -pub fn get_random_bytes(buf: []u8) -> %void { +pub fn getRandomBytes(buf: []u8) -> %void { switch (@compileVar("os")) { linux => { const ret = linux.getrandom(buf.ptr, buf.len, 0); @@ -18,14 +18,18 @@ pub fn get_random_bytes(buf: []u8) -> %void { } } }, - else => @compile_err("unsupported os"), + else => @compileErr("unsupported os"), } } #attribute("cold") pub fn abort() -> unreachable { - linux.raise(linux.SIGABRT); - linux.raise(linux.SIGKILL); - while (true) {} + switch (@compileVar("os")) { + linux => { + linux.raise(linux.SIGABRT); + linux.raise(linux.SIGKILL); + while (true) {} + }, + else => @compileErr("unsupported os"), + } } - -- cgit v1.2.3