diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index 3319f08fc7..a62655d577 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -1839,15 +1839,18 @@ pub fn setsid() usize { } pub fn getpid() pid_t { - return @bitCast(@as(u32, @truncate(syscall0(.getpid)))); + // Casts result to a pid_t, safety-checking >= 0, because getpid() cannot fail + return @intCast(@as(u32, @truncate(syscall0(.getpid)))); } pub fn getppid() pid_t { - return @bitCast(@as(u32, @truncate(syscall0(.getppid)))); + // Casts result to a pid_t, safety-checking >= 0, because getppid() cannot fail + return @intCast(@as(u32, @truncate(syscall0(.getppid)))); } pub fn gettid() pid_t { - return @bitCast(@as(u32, @truncate(syscall0(.gettid)))); + // Casts result to a pid_t, safety-checking >= 0, because gettid() cannot fail + return @intCast(@as(u32, @truncate(syscall0(.gettid)))); } pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?*sigset_t) usize {