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 library itself.

errno

Get the errno from a syscall return value. SUCCESS means no error.

linux.errno
pub fn errno(r: u64) E

File

lib/std/os/linux.zig:755

Code

pub fn errno(r: u64) E {
    const signed_r: i32 = @bitCast(@as(u32, @truncate(r)));
    const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0;
    return @fromBackingInt(@intCast(int));
}