authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-13 12:34:06-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-13 20:10:32-08:00
log5f925582909916b3843323c77b2edc05acc3f172
treedb6bc34f58774ceff3cc660dfd37ca325d72c9b8
parent9ec0cf23ca5e26e7d6a8f0f053505b05b56bf645

std.posix.termios: bring V back

In d7563a7753393d7f0d1af445276a64b8a55cb857, I misunderstood what `cc_t` was supposed to do. Those V enum values are indices into the array.

3 files changed, 159 insertions(+), 154 deletions(-)

lib/std/c.zig+98-98
...@@ -679,104 +679,104 @@ pub const MAP = switch (native_os) {...@@ -679,104 +679,104 @@ pub const MAP = switch (native_os) {
679/// Used by libc to communicate failure. Not actually part of the underlying syscall.679/// Used by libc to communicate failure. Not actually part of the underlying syscall.
680pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize));680pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize));
681681
682pub const cc_t = switch (native_os) {682pub const cc_t = u8;
683 .linux => std.os.linux.cc_t,683
684 .macos, .ios, .tvos, .watchos, .netbsd, .openbsd => enum(u8) {684/// Indices into the `cc` array in the `termios` struct.
685 VEOF = 0,685pub const V = switch (native_os) {
686 VEOL = 1,686 .linux => std.os.linux.V,
687 VEOL2 = 2,687 .macos, .ios, .tvos, .watchos, .netbsd, .openbsd => enum {
688 VERASE = 3,688 EOF,
689 VWERASE = 4,689 EOL,
690 VKILL = 5,690 EOL2,
691 VREPRINT = 6,691 ERASE,
692 VINTR = 8,692 WERASE,
693 VQUIT = 9,693 KILL,
694 VSUSP = 10,694 REPRINT,
695 VDSUSP = 11,695 reserved,
696 VSTART = 12,696 INTR,
697 VSTOP = 13,697 QUIT,
698 VLNEXT = 14,698 SUSP,
699 VDISCARD = 15,699 DSUSP,
700 VMIN = 16,700 START,
701 VTIME = 17,701 STOP,
702 VSTATUS = 18,702 LNEXT,
703 },703 DISCARD,
704 .freebsd, .kfreebsd => enum(u8) {704 MIN,
705 VEOF = 0,705 TIME,
706 VEOL = 1,706 STATUS,
707 VEOL2 = 2,707 },
708 VERASE = 3,708 .freebsd, .kfreebsd => enum {
709 VWERASE = 4,709 EOF,
710 VKILL = 5,710 EOL,
711 VREPRINT = 6,711 EOL2,
712 VERASE2 = 7,712 ERASE,
713 VINTR = 8,713 WERASE,
714 VQUIT = 9,714 KILL,
715 VSUSP = 10,715 REPRINT,
716 VDSUSP = 11,716 ERASE2,
717 VSTART = 12,717 INTR,
718 VSTOP = 13,718 QUIT,
719 VLNEXT = 14,719 SUSP,
720 VDISCARD = 15,720 DSUSP,
721 VMIN = 16,721 START,
722 VTIME = 17,722 STOP,
723 VSTATUS = 18,723 LNEXT,
724 },724 DISCARD,
725 .haiku => enum(u8) {725 MIN,
726 VINTR = 0,726 TIME,
727 VQUIT = 1,727 STATUS,
728 VERASE = 2,728 },
729 VKILL = 3,729 .haiku => enum {
730 VEOF = 4,730 INTR,
731 VEOL = 5,731 QUIT,
732 VMIN = 4,732 ERASE,
733 VTIME = 5,733 KILL,
734 VEOL2 = 6,734 EOF,
735 VSWTCH = 7,735 EOL,
736 VSTART = 8,736 EOL2,
737 VSTOP = 9,737 SWTCH,
738 VSUSP = 10,738 START,
739 },739 STOP,
740 .solaris, .illumos => enum(u8) {740 SUSP,
741 VINTR = 0,741 },
742 VQUIT = 1,742 .solaris, .illumos => enum {
743 VERASE = 2,743 INTR,
744 VKILL = 3,744 QUIT,
745 VEOF = 4,745 ERASE,
746 VEOL = 5,746 KILL,
747 VEOL2 = 6,747 EOF,
748 VMIN = 4,748 EOL,
749 VTIME = 5,749 EOL2,
750 VSWTCH = 7,750 SWTCH,
751 VSTART = 8,751 START,
752 VSTOP = 9,752 STOP,
753 VSUSP = 10,753 SUSP,
754 VDSUSP = 11,754 DSUSP,
755 VREPRINT = 12,755 REPRINT,
756 VDISCARD = 13,756 DISCARD,
757 VWERASE = 14,757 WERASE,
758 VLNEXT = 15,758 LNEXT,
759 VSTATUS = 16,759 STATUS,
760 VERASE2 = 17,760 ERASE2,
761 },761 },
762 .emscripten, .wasi => enum(u8) {762 .emscripten, .wasi => enum {
763 VINTR = 0,763 INTR,
764 VQUIT = 1,764 QUIT,
765 VERASE = 2,765 ERASE,
766 VKILL = 3,766 KILL,
767 VEOF = 4,767 EOF,
768 VTIME = 5,768 TIME,
769 VMIN = 6,769 MIN,
770 VSWTC = 7,770 SWTC,
771 VSTART = 8,771 START,
772 VSTOP = 9,772 STOP,
773 VSUSP = 10,773 SUSP,
774 VEOL = 11,774 EOL,
775 VREPRINT = 12,775 REPRINT,
776 VDISCARD = 13,776 DISCARD,
777 VWERASE = 14,777 WERASE,
778 VLNEXT = 15,778 LNEXT,
779 VEOL2 = 16,779 EOL2,
780 },780 },
781 else => @compileError("target libc does not have cc_t"),781 else => @compileError("target libc does not have cc_t"),
782};782};
lib/std/os.zig+2-1
...@@ -139,7 +139,6 @@ pub const W = system.W;...@@ -139,7 +139,6 @@ pub const W = system.W;
139pub const addrinfo = system.addrinfo;139pub const addrinfo = system.addrinfo;
140pub const blkcnt_t = system.blkcnt_t;140pub const blkcnt_t = system.blkcnt_t;
141pub const blksize_t = system.blksize_t;141pub const blksize_t = system.blksize_t;
142pub const cc_t = system.cc_t;
143pub const clock_t = system.clock_t;142pub const clock_t = system.clock_t;
144pub const cpu_set_t = system.cpu_set_t;143pub const cpu_set_t = system.cpu_set_t;
145pub const dev_t = system.dev_t;144pub const dev_t = system.dev_t;
...@@ -186,6 +185,8 @@ pub const utsname = system.utsname;...@@ -186,6 +185,8 @@ pub const utsname = system.utsname;
186pub const termios = system.termios;185pub const termios = system.termios;
187pub const CSIZE = system.CSIZE;186pub const CSIZE = system.CSIZE;
188pub const NCCS = system.NCCS;187pub const NCCS = system.NCCS;
188pub const cc_t = system.cc_t;
189pub const V = system.V;
189pub const speed_t = system.speed_t;190pub const speed_t = system.speed_t;
190pub const tc_iflag_t = system.tc_iflag_t;191pub const tc_iflag_t = system.tc_iflag_t;
191pub const tc_oflag_t = system.tc_oflag_t;192pub const tc_oflag_t = system.tc_oflag_t;
lib/std/os/linux.zig+59-55
...@@ -5230,63 +5230,67 @@ pub const tc_lflag_t = switch (native_arch) {...@@ -5230,63 +5230,67 @@ pub const tc_lflag_t = switch (native_arch) {
5230 },5230 },
5231};5231};
52325232
5233pub const cc_t = switch (native_arch) {5233pub const cc_t = u8;
5234 .mips, .mipsel, .mips64, .mips64el => enum(u8) {5234
5235 VINTR = 0,5235/// Indices into the `cc` array in the `termios` struct.
5236 VQUIT = 1,5236pub const V = switch (native_arch) {
5237 VERASE = 2,5237 .mips, .mipsel, .mips64, .mips64el => enum {
5238 VKILL = 3,5238 INTR,
5239 VMIN = 4,5239 QUIT,
5240 VTIME = 5,5240 ERASE,
5241 VEOL2 = 6,5241 KILL,
5242 VSWTC = 7,5242 MIN,
5243 VSTART = 8,5243 TIME,
5244 VSTOP = 9,5244 EOL2,
5245 VSUSP = 10,5245 SWTC,
5246 VREPRINT = 12,5246 START,
5247 VDISCARD = 13,5247 STOP,
5248 VWERASE = 14,5248 SUSP,
5249 VLNEXT = 15,5249 reserved,
5250 VEOF = 16,5250 REPRINT,
5251 VEOL = 17,5251 DISCARD,
5252 WERASE,
5253 LNEXT,
5254 EOF,
5255 EOL,
5252 },5256 },
5253 .powerpc, .powerpcle, .powerpc64, .powerpc64le => enum(u8) {5257 .powerpc, .powerpcle, .powerpc64, .powerpc64le => enum {
5254 VINTR = 0,5258 INTR,
5255 VQUIT = 1,5259 QUIT,
5256 VERASE = 2,5260 ERASE,
5257 VKILL = 3,5261 KILL,
5258 VEOF = 4,5262 EOF,
5259 VMIN = 5,5263 MIN,
5260 VEOL = 6,5264 EOL,
5261 VTIME = 7,5265 TIME,
5262 VEOL2 = 8,5266 EOL2,
5263 VSWTC = 9,5267 SWTC,
5264 VWERASE = 10,5268 WERASE,
5265 VREPRINT = 11,5269 REPRINT,
5266 VSUSP = 12,5270 SUSP,
5267 VSTART = 13,5271 START,
5268 VSTOP = 14,5272 STOP,
5269 VLNEXT = 15,5273 LNEXT,
5270 VDISCARD = 16,5274 DISCARD,
5271 },5275 },
5272 else => enum(u8) {5276 else => enum {
5273 VINTR = 0,5277 INTR,
5274 VQUIT = 1,5278 QUIT,
5275 VERASE = 2,5279 ERASE,
5276 VKILL = 3,5280 KILL,
5277 VEOF = 4,5281 EOF,
5278 VTIME = 5,5282 TIME,
5279 VMIN = 6,5283 MIN,
5280 VSWTC = 7,5284 SWTC,
5281 VSTART = 8,5285 START,
5282 VSTOP = 9,5286 STOP,
5283 VSUSP = 10,5287 SUSP,
5284 VEOL = 11,5288 EOL,
5285 VREPRINT = 12,5289 REPRINT,
5286 VDISCARD = 13,5290 DISCARD,
5287 VWERASE = 14,5291 WERASE,
5288 VLNEXT = 15,5292 LNEXT,
5289 VEOL2 = 16,5293 EOL2,
5290 },5294 },
5291};5295};
52925296