From 86388e3c32e238c88174cf9c91600f11add84d0a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 31 Jul 2023 11:20:31 -0700 Subject: [PATCH] Revert "std.os: sysctl* wrappers, better warning at compile time" This reverts commit c66151a22619b4f3ce028076c67f495ff5f99d2c. --- lib/std/os.zig | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/std/os.zig b/lib/std/os.zig index 8696e47c7d..c8720257b8 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -4696,8 +4696,11 @@ pub fn sysctl( newp: ?*anyopaque, newlen: usize, ) SysCtlError!void { - if (builtin.os.tag == .wasi or builtin.os.tag == .haiku) { - @compileError("unsupported OS"); + if (builtin.os.tag == .wasi) { + @panic("unsupported"); // TODO should be compile error, not panic + } + if (builtin.os.tag == .haiku) { + @panic("unsupported"); // TODO should be compile error, not panic } const name_len = math.cast(c_uint, name.len) orelse return error.NameTooLong; @@ -4718,8 +4721,11 @@ pub fn sysctlbynameZ( newp: ?*anyopaque, newlen: usize, ) SysCtlError!void { - if (builtin.os.tag == .wasi or builtin.os.tag == .haiku) { - @compileError("unsupported OS"); + if (builtin.os.tag == .wasi) { + @panic("unsupported"); // TODO should be compile error, not panic + } + if (builtin.os.tag == .haiku) { + @panic("unsupported"); // TODO should be compile error, not panic } switch (errno(system.sysctlbyname(name, oldp, oldlenp, newp, newlen))) {