mirror of
https://github.com/ziglang/zig.git
synced 2025-12-23 22:53:06 +00:00
std.os: sysctl* wrappers, better warning at compile time
This commit is contained in:
parent
2dbcc03fb8
commit
c66151a226
@ -4722,11 +4722,8 @@ pub fn sysctl(
|
||||
newp: ?*anyopaque,
|
||||
newlen: usize,
|
||||
) SysCtlError!void {
|
||||
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
|
||||
if (builtin.os.tag == .wasi or builtin.os.tag == .haiku) {
|
||||
@compileError("unsupported OS");
|
||||
}
|
||||
|
||||
const name_len = math.cast(c_uint, name.len) orelse return error.NameTooLong;
|
||||
@ -4747,11 +4744,8 @@ pub fn sysctlbynameZ(
|
||||
newp: ?*anyopaque,
|
||||
newlen: usize,
|
||||
) SysCtlError!void {
|
||||
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
|
||||
if (builtin.os.tag == .wasi or builtin.os.tag == .haiku) {
|
||||
@compileError("unsupported OS");
|
||||
}
|
||||
|
||||
switch (errno(system.sysctlbyname(name, oldp, oldlenp, newp, newlen))) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user