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