I think this gets us on master zig...

This commit is contained in:
Mitchell Hashimoto
2022-10-13 11:31:02 -07:00
parent 225de43062
commit 8decfa6452
2 changed files with 11 additions and 5 deletions

View File

@ -14,10 +14,13 @@ final: prev: rec {
# Last known working self-hosted with -fstage1, due to
# https://github.com/ziglang/zig/issues/12944
zig = final.zigpkgs.master-2022-09-13;
# I ended up finding a workaround for this but I still feel
# weird about it so I'm going to keep this around in case
# we want to rollback.
#zig = final.zigpkgs.master-2022-09-13;
# zig we want to be the latest nightly since 0.9.0 is not released yet.
#zig = final.zigpkgs.master;
zig = final.zigpkgs.master;
# last known working stage1 build, the rest in the future are stage3
#zig = final.zigpkgs.master-2022-08-19;

View File

@ -19,6 +19,9 @@ const c = switch (builtin.os.tag) {
}),
};
// https://github.com/ziglang/zig/issues/12944
const ioctl = if (builtin.os.tag == .macos) c.ioctl else std.c.ioctl;
/// Redeclare this winsize struct so we can just use a Zig struct. This
/// layout should be correct on all tested platforms.
const winsize = extern struct {
@ -64,7 +67,7 @@ pub fn deinit(self: *Pty) void {
/// Return the size of the pty.
pub fn getSize(self: Pty) !winsize {
var ws: winsize = undefined;
if (c.ioctl(self.master, c.TIOCGWINSZ, @ptrToInt(&ws)) < 0)
if (ioctl(self.master, c.TIOCGWINSZ, @ptrToInt(&ws)) < 0)
return error.IoctlFailed;
return ws;
@ -72,7 +75,7 @@ pub fn getSize(self: Pty) !winsize {
/// Set the size of the pty.
pub fn setSize(self: Pty, size: winsize) !void {
if (c.ioctl(self.master, c.TIOCSWINSZ, @ptrToInt(&size)) < 0)
if (ioctl(self.master, c.TIOCSWINSZ, @ptrToInt(&size)) < 0)
return error.IoctlFailed;
}
@ -83,7 +86,7 @@ pub fn childPreExec(self: Pty) !void {
if (setsid() < 0) return error.ProcessGroupFailed;
// Set controlling terminal
if (std.c.ioctl(self.slave, c.TIOCSCTTY, @as(c_ulong, 0)) < 0)
if (ioctl(self.slave, c.TIOCSCTTY, @as(c_ulong, 0)) < 0)
return error.SetControllingTerminalFailed;
// Can close master/slave pair now