From 815b98650de7e0d302e2e70ddb1479f628468e2c Mon Sep 17 00:00:00 2001 From: cos Date: Sun, 14 Jun 2026 14:07:46 +0200 Subject: [PATCH] fix: use portable ioctl request codes Using the constants under the `std.c` prefix rather than under `std.os.` works on more platforms. This change can make the compile fail with an actual error rather than "unsupported OS" on obscure platforms, but it should be safe to assume anyone building on such niche systems prefers this. --- src/pty.zig | 9 ++++----- test/integration.zig | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/pty.zig b/src/pty.zig index b245b40..fa4db71 100644 --- a/src/pty.zig +++ b/src/pty.zig @@ -18,12 +18,11 @@ pub const Tio = switch (builtin.os.tag) { pub const IOCSWINSZ: c_ulong = 0x80087467; pub const IOCSCTTY: c_ulong = 0x20007461; }, - .linux => struct { - pub const IOCGWINSZ: c_ulong = std.os.linux.T.IOCGWINSZ; - pub const IOCSWINSZ: c_ulong = std.os.linux.T.IOCSWINSZ; - pub const IOCSCTTY: c_ulong = std.os.linux.T.IOCSCTTY; + else => struct { + pub const IOCGWINSZ: c_ulong = std.c.T.IOCGWINSZ; + pub const IOCSWINSZ: c_ulong = std.c.T.IOCSWINSZ; + pub const IOCSCTTY: c_ulong = std.c.T.IOCSCTTY; }, - else => @compileError("unsupported OS"), }; pub const Winsize = std.posix.winsize; diff --git a/test/integration.zig b/test/integration.zig index 5eee342..e1df836 100644 --- a/test/integration.zig +++ b/test/integration.zig @@ -25,11 +25,10 @@ const Tio = switch (@import("builtin").os.tag) { const IOCSWINSZ: c_ulong = 0x80087467; const IOCSCTTY: c_ulong = 0x20007461; }, - .linux => struct { - const IOCSWINSZ: c_ulong = std.os.linux.T.IOCSWINSZ; - const IOCSCTTY: c_ulong = std.os.linux.T.IOCSCTTY; + else => struct { + const IOCSWINSZ: c_ulong = std.c.T.IOCSWINSZ; + const IOCSCTTY: c_ulong = std.c.T.IOCSCTTY; }, - else => @compileError("unsupported OS"), }; /// Per-test environment: an isolated socket directory under /tmp (kept