From bc156266c6a653a6d6071a73a3f1cca6131b285d Mon Sep 17 00:00:00 2001 From: rhodes-b <59537185+rhodes-b@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:27:10 -0600 Subject: [PATCH 1/2] fix errno handle --- src/os/cgroup.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/cgroup.zig b/src/os/cgroup.zig index bef101acc..095c90aa3 100644 --- a/src/os/cgroup.zig +++ b/src/os/cgroup.zig @@ -130,7 +130,7 @@ pub fn cloneInto(cgroup: []const u8) !posix.pid_t { }; const rc = linux.syscall2(linux.SYS.clone3, @intFromPtr(&args), @sizeOf(@TypeOf(args))); - return switch (posix.errno(rc)) { + return switch (std.os.linux.E.init(rc)) { .SUCCESS => @as(posix.pid_t, @intCast(rc)), else => |errno| err: { log.err("unable to clone: {}", .{errno}); From fb2516fbf68a171ffd3223cc46ffb423518bed90 Mon Sep 17 00:00:00 2001 From: rhodes-b <59537185+rhodes-b@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:35:20 -0600 Subject: [PATCH 2/2] comment on why to not use posix.errno --- src/os/cgroup.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/os/cgroup.zig b/src/os/cgroup.zig index 095c90aa3..d94a4a728 100644 --- a/src/os/cgroup.zig +++ b/src/os/cgroup.zig @@ -130,6 +130,7 @@ pub fn cloneInto(cgroup: []const u8) !posix.pid_t { }; const rc = linux.syscall2(linux.SYS.clone3, @intFromPtr(&args), @sizeOf(@TypeOf(args))); + // do not use posix.errno, when linking libc it will use the libc errno which will not be set when making the syscall directly return switch (std.os.linux.E.init(rc)) { .SUCCESS => @as(posix.pid_t, @intCast(rc)), else => |errno| err: {