diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-03-16 18:09:23 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-03-18 21:52:52 +0100 |
| commit | e35c8a2fd6bb0eb16b45e76a39f4602f1161f357 (patch) | |
| tree | 31eb0552afc8f284604dc3bf8e735c67bf8cce3d | |
| parent | a23ef3783bb5357376acdce12f73b0285636d6cf (diff) | |
| download | zig-e35c8a2fd6bb0eb16b45e76a39f4602f1161f357.tar.gz zig-e35c8a2fd6bb0eb16b45e76a39f4602f1161f357.zip | |
link: use std.os.ptrace wrapper on linux
| -rw-r--r-- | src/link.zig | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/link.zig b/src/link.zig index a919ffa999..c91d621305 100644 --- a/src/link.zig +++ b/src/link.zig @@ -389,11 +389,8 @@ pub const File = struct { try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, tmp_sub_path, .{}); try emit.directory.handle.rename(tmp_sub_path, emit.sub_path); switch (builtin.os.tag) { - .linux => { - switch (std.os.errno(std.os.linux.ptrace(std.os.linux.PTRACE.ATTACH, pid, 0, 0, 0))) { - .SUCCESS => {}, - else => |errno| log.warn("ptrace failure: {s}", .{@tagName(errno)}), - } + .linux => std.os.ptrace(std.os.linux.PTRACE.ATTACH, pid, 0, 0) catch |err| { + log.warn("ptrace failure: {s}", .{@errorName(err)}); }, else => return error.HotSwapUnavailableOnHostOperatingSystem, } @@ -430,11 +427,8 @@ pub const File = struct { if (base.child_pid) |pid| { switch (builtin.os.tag) { - .linux => { - switch (std.os.errno(std.os.linux.ptrace(std.os.linux.PTRACE.DETACH, pid, 0, 0, 0))) { - .SUCCESS => {}, - else => |errno| log.warn("ptrace failure: {s}", .{@tagName(errno)}), - } + .linux => std.os.ptrace(std.os.linux.PTRACE.DETACH, pid, 0, 0) catch |err| { + log.warn("ptrace failure: {s}", .{@errorName(err)}); }, else => return error.HotSwapUnavailableOnHostOperatingSystem, } |
