-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.16.0-dev.1424+d3e20e71b
Steps to Reproduce and Observed Behavior
Kill is not returning errors.
I have been trying to reimplement kill because of #26011 and debugging why it is not working as before.
fn kill(pid: std.c.pid_t, sig: u8) std.posix.KillError!void {
const rc = std.os.linux.syscall2(.kill, @as(usize, @bitCast(@as(isize, pid))), sig);
// const as_isize: isize = @bitCast(rc);
// std.debug.print("rc={d}, as_isize={d}\n", .{ rc, as_isize });
switch (std.posix.errno(rc)) {
.SUCCESS => return,
.INVAL => unreachable, // invalid signal
.PERM => return error.PermissionDenied,
.SRCH => return error.ProcessNotFound,
else => |err| return std.posix.unexpectedErrno(err),
}
}With this function, which is remiplementation of the kill without some indirection and SIG enum, it never returns me error when I call kill(9999999, 0), the commented out comment prints out "rc=18446744073709551613, as_isize=-3". The value is -3, but std.posix errno checks for -1
Expected Behavior
Kill should return error on error.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior