mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge pull request #25217 from blblack/setsiderr
std.os.linux.setsid(): return raw syscall0 result
This commit is contained in:
commit
d2e4ad613b
2 changed files with 9 additions and 6 deletions
|
|
@ -1834,20 +1834,23 @@ pub fn setgroups(size: usize, list: [*]const gid_t) usize {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn setsid() pid_t {
|
||||
return @bitCast(@as(u32, @truncate(syscall0(.setsid))));
|
||||
pub fn setsid() usize {
|
||||
return syscall0(.setsid);
|
||||
}
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -7000,7 +7000,7 @@ pub const SetSidError = error{
|
|||
pub fn setsid() SetSidError!pid_t {
|
||||
const rc = system.setsid();
|
||||
switch (errno(rc)) {
|
||||
.SUCCESS => return rc,
|
||||
.SUCCESS => return @intCast(rc),
|
||||
.PERM => return error.PermissionDenied,
|
||||
else => |err| return unexpectedErrno(err),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue