Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › posix › sysctl Public Function sysctl Doc Source Public Function std.posix.sysctl
pub fn sysctl (
name : []const c_int ,
oldp : ?*anyopaque ,
oldlenp : ?*usize ,
newp : ?*anyopaque ,
newlen : usize ,
) SysCtlError !void Params name : []const c_int oldp : ?*anyopaque oldlenp : ?*usize newp : ?*anyopaque newlen : usize File posix.zig: 751
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774 pub fn sysctl (
name : []const c_int ,
oldp : ?*anyopaque ,
oldlenp : ?*usize ,
newp : ?*anyopaque ,
newlen : usize ,
) SysCtlError !void {
if (native_os == .wasi ) {
@compileError ("sysctl not supported on WASI" );
}
if (native_os == .haiku ) {
@compileError ("sysctl not supported on Haiku" );
}
const name_len = cast (c_uint , name .len ) orelse return error .NameTooLong ;
switch (errno (system .sysctl (name .ptr , name_len , oldp , oldlenp , newp , newlen ))) {
.SUCCESS => return ,
.FAULT => unreachable ,
.PERM => return error .PermissionDenied ,
.NOMEM => return error .SystemResources ,
.NOENT => return error .UnknownName ,
else => |err | return unexpectedErrno (err ),
}
}