╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ c.zig ────────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
43 } 44 45 /// Given a low-level syscall return value, sets errno and returns `-1`, or on 46 /// success returns the result. 47 pub fn errno(syscall_return_value: usize) c_int { 48 return switch (builtin.os.tag) { 49 .linux => { 50 const signed: isize = @bitCast(syscall_return_value); 51 const casted: c_int = @intCast(signed); 52 if (casted < 0) { 53 @branchHint(.unlikely); 54 std.c._errno().* = -casted; 55 return -1; 56 } 57 return casted; 58 }, 59 else => comptime unreachable, 60 }; 61 } 62 63 comptime { 64 _ = @import("c/ctype.zig"); 65 _ = @import("c/fcntl.zig"); 66 _ = @import("c/inttypes.zig"); 67 if (!builtin.target.isMinGW()) { 68 _ = @import("c/malloc.zig"); 69 } 70 _ = @import("c/math.zig"); 71 _ = @import("c/pthread.zig"); 72 _ = @import("c/search.zig"); 73 _ = @import("c/stdlib.zig"); 74 _ = @import("c/string.zig"); 75 _ = @import("c/strings.zig"); 76 _ = @import("c/stropts.zig"); 77 78 _ = @import("c/sys/capability.zig"); 79 _ = @import("c/sys/file.zig"); 80 _ = @import("c/sys/mman.zig"); 81 _ = @import("c/sys/reboot.zig"); 82 _ = @import("c/sys/utsname.zig"); 83 84 _ = @import("c/unistd.zig"); 85 _ = @import("c/wchar.zig"); 86 } 87