Skip to content

Commit

Permalink
Update for latest breaking Zig changes - std.os => std.posix.
Browse files Browse the repository at this point in the history
Signed-off-by: moderation <[email protected]>
  • Loading branch information
moderation authored and andrewrk committed Mar 24, 2024
1 parent 719b0db commit a45329e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");
const PERF = std.os.linux.PERF;
const fd_t = std.os.fd_t;
const fd_t = std.posix.fd_t;
const pid_t = std.os.pid_t;
const assert = std.debug.assert;
const progress = @import("./progress.zig");
Expand Down Expand Up @@ -198,7 +198,7 @@ pub fn main() !void {
.enable_on_exec = true,
},
};
perf_fd.* = std.os.perf_event_open(&attr, 0, -1, perf_fds[0], PERF.FLAG.FD_CLOEXEC) catch |err| {
perf_fd.* = std.posix.perf_event_open(&attr, 0, -1, perf_fds[0], PERF.FLAG.FD_CLOEXEC) catch |err| {
std.debug.panic("unable to open perf event: {s}\n", .{@errorName(err)});
};
}
Expand Down Expand Up @@ -293,7 +293,7 @@ pub fn main() !void {
.branch_misses = readPerfFd(perf_fds[4]),
};
for (&perf_fds) |*perf_fd| {
std.os.close(perf_fd.*);
std.posix.close(perf_fd.*);
perf_fd.* = -1;
}

Expand Down Expand Up @@ -399,7 +399,7 @@ fn parseCmd(list: *std.ArrayList([]const u8), cmd: []const u8) !void {

fn readPerfFd(fd: fd_t) usize {
var result: usize = 0;
const n = std.os.read(fd, std.mem.asBytes(&result)) catch |err| {
const n = std.posix.read(fd, std.mem.asBytes(&result)) catch |err| {
std.debug.panic("unable to read perf fd: {s}\n", .{@errorName(err)});
};
assert(n == @sizeOf(usize));
Expand Down
2 changes: 1 addition & 1 deletion src/progress.zig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Winsize = extern struct {
ws_ypixel: c_ushort,
};

pub fn getScreenWidth(stdout: std.os.fd_t) usize {
pub fn getScreenWidth(stdout: std.posix.fd_t) usize {
var winsize: Winsize = undefined;
_ = std.os.linux.ioctl(stdout, TIOCGWINSZ, @intFromPtr(&winsize));
return @intCast(winsize.ws_col);
Expand Down

0 comments on commit a45329e

Please sign in to comment.