std.posix.termios: bring V back

In d7563a7753, I misunderstood what `cc_t`
was supposed to do. Those V enum values are indices into the array.
This commit is contained in:
Andrew Kelley 2024-02-13 12:34:06 -07:00
parent 9ec0cf23ca
commit 5f92558290
3 changed files with 155 additions and 150 deletions

View file

@ -679,104 +679,104 @@ pub const MAP = switch (native_os) {
/// Used by libc to communicate failure. Not actually part of the underlying syscall. /// Used by libc to communicate failure. Not actually part of the underlying syscall.
pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize)); pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize));
pub const cc_t = switch (native_os) { pub const cc_t = u8;
.linux => std.os.linux.cc_t,
.macos, .ios, .tvos, .watchos, .netbsd, .openbsd => enum(u8) { /// Indices into the `cc` array in the `termios` struct.
VEOF = 0, pub const V = switch (native_os) {
VEOL = 1, .linux => std.os.linux.V,
VEOL2 = 2, .macos, .ios, .tvos, .watchos, .netbsd, .openbsd => enum {
VERASE = 3, EOF,
VWERASE = 4, EOL,
VKILL = 5, EOL2,
VREPRINT = 6, ERASE,
VINTR = 8, WERASE,
VQUIT = 9, KILL,
VSUSP = 10, REPRINT,
VDSUSP = 11, reserved,
VSTART = 12, INTR,
VSTOP = 13, QUIT,
VLNEXT = 14, SUSP,
VDISCARD = 15, DSUSP,
VMIN = 16, START,
VTIME = 17, STOP,
VSTATUS = 18, LNEXT,
DISCARD,
MIN,
TIME,
STATUS,
}, },
.freebsd, .kfreebsd => enum(u8) { .freebsd, .kfreebsd => enum {
VEOF = 0, EOF,
VEOL = 1, EOL,
VEOL2 = 2, EOL2,
VERASE = 3, ERASE,
VWERASE = 4, WERASE,
VKILL = 5, KILL,
VREPRINT = 6, REPRINT,
VERASE2 = 7, ERASE2,
VINTR = 8, INTR,
VQUIT = 9, QUIT,
VSUSP = 10, SUSP,
VDSUSP = 11, DSUSP,
VSTART = 12, START,
VSTOP = 13, STOP,
VLNEXT = 14, LNEXT,
VDISCARD = 15, DISCARD,
VMIN = 16, MIN,
VTIME = 17, TIME,
VSTATUS = 18, STATUS,
}, },
.haiku => enum(u8) { .haiku => enum {
VINTR = 0, INTR,
VQUIT = 1, QUIT,
VERASE = 2, ERASE,
VKILL = 3, KILL,
VEOF = 4, EOF,
VEOL = 5, EOL,
VMIN = 4, EOL2,
VTIME = 5, SWTCH,
VEOL2 = 6, START,
VSWTCH = 7, STOP,
VSTART = 8, SUSP,
VSTOP = 9,
VSUSP = 10,
}, },
.solaris, .illumos => enum(u8) { .solaris, .illumos => enum {
VINTR = 0, INTR,
VQUIT = 1, QUIT,
VERASE = 2, ERASE,
VKILL = 3, KILL,
VEOF = 4, EOF,
VEOL = 5, EOL,
VEOL2 = 6, EOL2,
VMIN = 4, SWTCH,
VTIME = 5, START,
VSWTCH = 7, STOP,
VSTART = 8, SUSP,
VSTOP = 9, DSUSP,
VSUSP = 10, REPRINT,
VDSUSP = 11, DISCARD,
VREPRINT = 12, WERASE,
VDISCARD = 13, LNEXT,
VWERASE = 14, STATUS,
VLNEXT = 15, ERASE2,
VSTATUS = 16,
VERASE2 = 17,
}, },
.emscripten, .wasi => enum(u8) { .emscripten, .wasi => enum {
VINTR = 0, INTR,
VQUIT = 1, QUIT,
VERASE = 2, ERASE,
VKILL = 3, KILL,
VEOF = 4, EOF,
VTIME = 5, TIME,
VMIN = 6, MIN,
VSWTC = 7, SWTC,
VSTART = 8, START,
VSTOP = 9, STOP,
VSUSP = 10, SUSP,
VEOL = 11, EOL,
VREPRINT = 12, REPRINT,
VDISCARD = 13, DISCARD,
VWERASE = 14, WERASE,
VLNEXT = 15, LNEXT,
VEOL2 = 16, EOL2,
}, },
else => @compileError("target libc does not have cc_t"), else => @compileError("target libc does not have cc_t"),
}; };

View file

@ -139,7 +139,6 @@ pub const W = system.W;
pub const addrinfo = system.addrinfo; pub const addrinfo = system.addrinfo;
pub const blkcnt_t = system.blkcnt_t; pub const blkcnt_t = system.blkcnt_t;
pub const blksize_t = system.blksize_t; pub const blksize_t = system.blksize_t;
pub const cc_t = system.cc_t;
pub const clock_t = system.clock_t; pub const clock_t = system.clock_t;
pub const cpu_set_t = system.cpu_set_t; pub const cpu_set_t = system.cpu_set_t;
pub const dev_t = system.dev_t; pub const dev_t = system.dev_t;
@ -186,6 +185,8 @@ pub const utsname = system.utsname;
pub const termios = system.termios; pub const termios = system.termios;
pub const CSIZE = system.CSIZE; pub const CSIZE = system.CSIZE;
pub const NCCS = system.NCCS; pub const NCCS = system.NCCS;
pub const cc_t = system.cc_t;
pub const V = system.V;
pub const speed_t = system.speed_t; pub const speed_t = system.speed_t;
pub const tc_iflag_t = system.tc_iflag_t; pub const tc_iflag_t = system.tc_iflag_t;
pub const tc_oflag_t = system.tc_oflag_t; pub const tc_oflag_t = system.tc_oflag_t;

View file

@ -5230,63 +5230,67 @@ pub const tc_lflag_t = switch (native_arch) {
}, },
}; };
pub const cc_t = switch (native_arch) { pub const cc_t = u8;
.mips, .mipsel, .mips64, .mips64el => enum(u8) {
VINTR = 0, /// Indices into the `cc` array in the `termios` struct.
VQUIT = 1, pub const V = switch (native_arch) {
VERASE = 2, .mips, .mipsel, .mips64, .mips64el => enum {
VKILL = 3, INTR,
VMIN = 4, QUIT,
VTIME = 5, ERASE,
VEOL2 = 6, KILL,
VSWTC = 7, MIN,
VSTART = 8, TIME,
VSTOP = 9, EOL2,
VSUSP = 10, SWTC,
VREPRINT = 12, START,
VDISCARD = 13, STOP,
VWERASE = 14, SUSP,
VLNEXT = 15, reserved,
VEOF = 16, REPRINT,
VEOL = 17, DISCARD,
WERASE,
LNEXT,
EOF,
EOL,
}, },
.powerpc, .powerpcle, .powerpc64, .powerpc64le => enum(u8) { .powerpc, .powerpcle, .powerpc64, .powerpc64le => enum {
VINTR = 0, INTR,
VQUIT = 1, QUIT,
VERASE = 2, ERASE,
VKILL = 3, KILL,
VEOF = 4, EOF,
VMIN = 5, MIN,
VEOL = 6, EOL,
VTIME = 7, TIME,
VEOL2 = 8, EOL2,
VSWTC = 9, SWTC,
VWERASE = 10, WERASE,
VREPRINT = 11, REPRINT,
VSUSP = 12, SUSP,
VSTART = 13, START,
VSTOP = 14, STOP,
VLNEXT = 15, LNEXT,
VDISCARD = 16, DISCARD,
}, },
else => enum(u8) { else => enum {
VINTR = 0, INTR,
VQUIT = 1, QUIT,
VERASE = 2, ERASE,
VKILL = 3, KILL,
VEOF = 4, EOF,
VTIME = 5, TIME,
VMIN = 6, MIN,
VSWTC = 7, SWTC,
VSTART = 8, START,
VSTOP = 9, STOP,
VSUSP = 10, SUSP,
VEOL = 11, EOL,
VREPRINT = 12, REPRINT,
VDISCARD = 13, DISCARD,
VWERASE = 14, WERASE,
VLNEXT = 15, LNEXT,
VEOL2 = 16, EOL2,
}, },
}; };