| author | |
| committer | |
| log | 47643cc5cc4db4c0fb2aaa7f37cedb049fce7def |
| tree | b1028914cc897c70278973d47239dfb41efb57c1 |
| parent | 0c88f927f161224f5c5ce2b12a76133a421af081 |
This creates `tc_iflag_t` even though such a type is not defined by
libc.
I also collected the missing flag bits from all the operating systems.6 files changed, 161 insertions(+), 72 deletions(-)
lib/std/c.zig+115-5| ... | ... | @@ -793,7 +793,7 @@ pub const NCCS = switch (native_os) { |
| 793 | 793 | pub const termios = switch (native_os) { |
| 794 | 794 | .linux => std.os.linux.termios, |
| 795 | 795 | .macos, .ios, .tvos, .watchos => extern struct { |
| 796 | iflag: tcflag_t, | |
| 796 | iflag: tc_iflag_t, | |
| 797 | 797 | oflag: tcflag_t, |
| 798 | 798 | cflag: tcflag_t, |
| 799 | 799 | lflag: tcflag_t, |
| ... | ... | @@ -802,7 +802,7 @@ pub const termios = switch (native_os) { |
| 802 | 802 | ospeed: speed_t, |
| 803 | 803 | }, |
| 804 | 804 | .freebsd, .kfreebsd, .netbsd, .dragonfly, .openbsd => extern struct { |
| 805 | iflag: tcflag_t, | |
| 805 | iflag: tc_iflag_t, | |
| 806 | 806 | oflag: tcflag_t, |
| 807 | 807 | cflag: tcflag_t, |
| 808 | 808 | lflag: tcflag_t, |
| ... | ... | @@ -811,7 +811,7 @@ pub const termios = switch (native_os) { |
| 811 | 811 | ospeed: speed_t, |
| 812 | 812 | }, |
| 813 | 813 | .haiku => extern struct { |
| 814 | iflag: tcflag_t, | |
| 814 | iflag: tc_iflag_t, | |
| 815 | 815 | oflag: tcflag_t, |
| 816 | 816 | cflag: tcflag_t, |
| 817 | 817 | lflag: tcflag_t, |
| ... | ... | @@ -821,14 +821,14 @@ pub const termios = switch (native_os) { |
| 821 | 821 | cc: [NCCS]cc_t, |
| 822 | 822 | }, |
| 823 | 823 | .solaris, .illumos => extern struct { |
| 824 | iflag: tcflag_t, | |
| 824 | iflag: tc_iflag_t, | |
| 825 | 825 | oflag: tcflag_t, |
| 826 | 826 | cflag: tcflag_t, |
| 827 | 827 | lflag: tcflag_t, |
| 828 | 828 | cc: [NCCS]cc_t, |
| 829 | 829 | }, |
| 830 | 830 | .emscripten, .wasi => extern struct { |
| 831 | iflag: tcflag_t, | |
| 831 | iflag: tc_iflag_t, | |
| 832 | 832 | oflag: tcflag_t, |
| 833 | 833 | cflag: tcflag_t, |
| 834 | 834 | lflag: tcflag_t, |
| ... | ... | @@ -840,6 +840,116 @@ pub const termios = switch (native_os) { |
| 840 | 840 | else => @compileError("target libc does not have termios"), |
| 841 | 841 | }; |
| 842 | 842 | |
| 843 | pub const tc_iflag_t = switch (native_os) { | |
| 844 | .linux => std.os.linux.tc_iflag_t, | |
| 845 | .macos, .ios, .tvos, .watchos => packed struct(u32) { | |
| 846 | IGNBRK: bool = false, | |
| 847 | BRKINT: bool = false, | |
| 848 | IGNPAR: bool = false, | |
| 849 | PARMRK: bool = false, | |
| 850 | INPCK: bool = false, | |
| 851 | ISTRIP: bool = false, | |
| 852 | INLCR: bool = false, | |
| 853 | IGNCR: bool = false, | |
| 854 | ICRNL: bool = false, | |
| 855 | IXON: bool = false, | |
| 856 | IXOFF: bool = false, | |
| 857 | IXANY: bool = false, | |
| 858 | _12: u1 = 0, | |
| 859 | IMAXBEL: bool = false, | |
| 860 | IUTF8: bool = false, | |
| 861 | _: u17 = 0, | |
| 862 | }, | |
| 863 | .netbsd, .freebsd, .kfreebsd, .dragonfly => packed struct(u32) { | |
| 864 | IGNBRK: bool = false, | |
| 865 | BRKINT: bool = false, | |
| 866 | IGNPAR: bool = false, | |
| 867 | PARMRK: bool = false, | |
| 868 | INPCK: bool = false, | |
| 869 | ISTRIP: bool = false, | |
| 870 | INLCR: bool = false, | |
| 871 | IGNCR: bool = false, | |
| 872 | ICRNL: bool = false, | |
| 873 | IXON: bool = false, | |
| 874 | IXOFF: bool = false, | |
| 875 | IXANY: bool = false, | |
| 876 | _12: u1 = 0, | |
| 877 | IMAXBEL: bool = false, | |
| 878 | _: u18 = 0, | |
| 879 | }, | |
| 880 | .openbsd => packed struct(u32) { | |
| 881 | IGNBRK: bool = false, | |
| 882 | BRKINT: bool = false, | |
| 883 | IGNPAR: bool = false, | |
| 884 | PARMRK: bool = false, | |
| 885 | INPCK: bool = false, | |
| 886 | ISTRIP: bool = false, | |
| 887 | INLCR: bool = false, | |
| 888 | IGNCR: bool = false, | |
| 889 | ICRNL: bool = false, | |
| 890 | IXON: bool = false, | |
| 891 | IXOFF: bool = false, | |
| 892 | IXANY: bool = false, | |
| 893 | IUCLC: bool = false, | |
| 894 | IMAXBEL: bool = false, | |
| 895 | _: u18 = 0, | |
| 896 | }, | |
| 897 | .haiku => packed struct(u32) { | |
| 898 | IGNBRK: bool = false, | |
| 899 | BRKINT: bool = false, | |
| 900 | IGNPAR: bool = false, | |
| 901 | PARMRK: bool = false, | |
| 902 | INPCK: bool = false, | |
| 903 | ISTRIP: bool = false, | |
| 904 | INLCR: bool = false, | |
| 905 | IGNCR: bool = false, | |
| 906 | ICRNL: bool = false, | |
| 907 | IUCLC: bool = false, | |
| 908 | IXON: bool = false, | |
| 909 | IXANY: bool = false, | |
| 910 | IXOFF: bool = false, | |
| 911 | _: u19 = 0, | |
| 912 | }, | |
| 913 | .solaris, .illumos => packed struct(u32) { | |
| 914 | IGNBRK: bool = false, | |
| 915 | BRKINT: bool = false, | |
| 916 | IGNPAR: bool = false, | |
| 917 | PARMRK: bool = false, | |
| 918 | INPCK: bool = false, | |
| 919 | ISTRIP: bool = false, | |
| 920 | INLCR: bool = false, | |
| 921 | IGNCR: bool = false, | |
| 922 | ICRNL: bool = false, | |
| 923 | IUCLC: bool = false, | |
| 924 | IXON: bool = false, | |
| 925 | IXANY: bool = false, | |
| 926 | _12: u1 = 0, | |
| 927 | IMAXBEL: bool = false, | |
| 928 | _14: u1 = 0, | |
| 929 | DOSMODE: bool = false, | |
| 930 | _: u16 = 0, | |
| 931 | }, | |
| 932 | .emscripten, .wasi => packed struct(u32) { | |
| 933 | IGNBRK: bool = false, | |
| 934 | BRKINT: bool = false, | |
| 935 | IGNPAR: bool = false, | |
| 936 | PARMRK: bool = false, | |
| 937 | INPCK: bool = false, | |
| 938 | ISTRIP: bool = false, | |
| 939 | INLCR: bool = false, | |
| 940 | IGNCR: bool = false, | |
| 941 | ICRNL: bool = false, | |
| 942 | IUCLC: bool = false, | |
| 943 | IXON: bool = false, | |
| 944 | IXANY: bool = false, | |
| 945 | IXOFF: bool = false, | |
| 946 | IMAXBEL: bool = false, | |
| 947 | IUTF8: bool = false, | |
| 948 | _: u17 = 0, | |
| 949 | }, | |
| 950 | else => @compileError("target libc does not have tc_iflag_t"), | |
| 951 | }; | |
| 952 | ||
| 843 | 953 | pub const tcflag_t = switch (native_os) { |
| 844 | 954 | .linux => std.os.linux.tcflag_t, |
| 845 | 955 | .macos, .ios, .tvos, .watchos => u64, |
lib/std/c/darwin.zig-15| ... | ... | @@ -2692,21 +2692,6 @@ pub const SHUT = struct { |
| 2692 | 2692 | pub const RDWR = 2; |
| 2693 | 2693 | }; |
| 2694 | 2694 | |
| 2695 | pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition | |
| 2696 | pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINTR | |
| 2697 | pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors | |
| 2698 | pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors | |
| 2699 | pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors | |
| 2700 | pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars | |
| 2701 | pub const INLCR: tcflag_t = 0x00000040; // map NL into CR | |
| 2702 | pub const IGNCR: tcflag_t = 0x00000080; // ignore CR | |
| 2703 | pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD) | |
| 2704 | pub const IXON: tcflag_t = 0x00000200; // enable output flow control | |
| 2705 | pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control | |
| 2706 | pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop | |
| 2707 | pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full | |
| 2708 | pub const IUTF8: tcflag_t = 0x00004000; // maintain state for UTF-8 VERASE | |
| 2709 | ||
| 2710 | 2695 | pub const OPOST: tcflag_t = 0x00000001; //enable following output processing |
| 2711 | 2696 | pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD) |
| 2712 | 2697 | pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces |
lib/std/c/netbsd.zig-14| ... | ... | @@ -806,20 +806,6 @@ pub const T = struct { |
| 806 | 806 | pub const IOCXMTFRAME = 0x80087444; |
| 807 | 807 | }; |
| 808 | 808 | |
| 809 | // Input flags - software input processing | |
| 810 | pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition | |
| 811 | pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT | |
| 812 | pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors | |
| 813 | pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors | |
| 814 | pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors | |
| 815 | pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars | |
| 816 | pub const INLCR: tcflag_t = 0x00000040; // map NL into CR | |
| 817 | pub const IGNCR: tcflag_t = 0x00000080; // ignore CR | |
| 818 | pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD) | |
| 819 | pub const IXON: tcflag_t = 0x00000200; // enable output flow control | |
| 820 | pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control | |
| 821 | pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop | |
| 822 | pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full | |
| 823 | 809 | |
| 824 | 810 | // Output flags - software output processing |
| 825 | 811 | pub const OPOST: tcflag_t = 0x00000001; // enable following output processing |
lib/std/c/openbsd.zig-15| ... | ... | @@ -768,21 +768,6 @@ pub const AUTH = struct { |
| 768 | 768 | pub const ALLOW: c_int = (OKAY | ROOTOKAY | SECURE); |
| 769 | 769 | }; |
| 770 | 770 | |
| 771 | // Input flags - software input processing | |
| 772 | pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition | |
| 773 | pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT | |
| 774 | pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors | |
| 775 | pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors | |
| 776 | pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors | |
| 777 | pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars | |
| 778 | pub const INLCR: tcflag_t = 0x00000040; // map NL into CR | |
| 779 | pub const IGNCR: tcflag_t = 0x00000080; // ignore CR | |
| 780 | pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD) | |
| 781 | pub const IXON: tcflag_t = 0x00000200; // enable output flow control | |
| 782 | pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control | |
| 783 | pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop | |
| 784 | pub const IUCLC: tcflag_t = 0x00001000; // translate upper to lower case | |
| 785 | pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full | |
| 786 | 771 | |
| 787 | 772 | // Output flags - software output processing |
| 788 | 773 | pub const OPOST: tcflag_t = 0x00000001; // enable following output processing |
lib/std/os.zig+5-3| ... | ... | @@ -106,7 +106,6 @@ pub const MFD = system.MFD; |
| 106 | 106 | pub const MMAP2_UNIT = system.MMAP2_UNIT; |
| 107 | 107 | pub const MSG = system.MSG; |
| 108 | 108 | pub const NAME_MAX = system.NAME_MAX; |
| 109 | pub const NCCS = system.NCCS; | |
| 110 | 109 | pub const O = system.O; |
| 111 | 110 | pub const PATH_MAX = system.PATH_MAX; |
| 112 | 111 | pub const POLL = system.POLL; |
| ... | ... | @@ -173,9 +172,7 @@ pub const siginfo_t = system.siginfo_t; |
| 173 | 172 | pub const sigset_t = system.sigset_t; |
| 174 | 173 | pub const sockaddr = system.sockaddr; |
| 175 | 174 | pub const socklen_t = system.socklen_t; |
| 176 | pub const speed_t = system.speed_t; | |
| 177 | 175 | pub const stack_t = system.stack_t; |
| 178 | pub const tcflag_t = system.tcflag_t; | |
| 179 | 176 | pub const termios = system.termios; |
| 180 | 177 | pub const time_t = system.time_t; |
| 181 | 178 | pub const timespec = system.timespec; |
| ... | ... | @@ -187,6 +184,11 @@ pub const uid_t = system.uid_t; |
| 187 | 184 | pub const user_desc = system.user_desc; |
| 188 | 185 | pub const utsname = system.utsname; |
| 189 | 186 | |
| 187 | pub const NCCS = system.NCCS; | |
| 188 | pub const speed_t = system.speed_t; | |
| 189 | pub const tcflag_t = system.tcflag_t; | |
| 190 | pub const tc_iflag_t = system.tc_iflag_t; | |
| 191 | ||
| 190 | 192 | pub const F_OK = system.F_OK; |
| 191 | 193 | pub const R_OK = system.R_OK; |
| 192 | 194 | pub const W_OK = system.W_OK; |
lib/std/os/linux.zig+41-20| ... | ... | @@ -5005,7 +5005,6 @@ pub const rusage = extern struct { |
| 5005 | 5005 | }; |
| 5006 | 5006 | |
| 5007 | 5007 | pub const speed_t = u32; |
| 5008 | pub const tcflag_t = u32; | |
| 5009 | 5008 | |
| 5010 | 5009 | pub const NCCS = switch (native_arch) { |
| 5011 | 5010 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => 19, |
| ... | ... | @@ -5045,23 +5044,43 @@ pub const B3000000 = 0o0010015; |
| 5045 | 5044 | pub const B3500000 = 0o0010016; |
| 5046 | 5045 | pub const B4000000 = 0o0010017; |
| 5047 | 5046 | |
| 5048 | pub const tc_iflag_t = packed struct(u32) { | |
| 5049 | IGNBRK: bool = false, | |
| 5050 | BRKINT: bool = false, | |
| 5051 | IGNPAR: bool = false, | |
| 5052 | PARMRK: bool = false, | |
| 5053 | INPCK: bool = false, | |
| 5054 | ISTRIP: bool = false, | |
| 5055 | INLCR: bool = false, | |
| 5056 | IGNCR: bool = false, | |
| 5057 | ICRNL: bool = false, | |
| 5058 | IUCLC: bool = false, | |
| 5059 | IXON: bool = false, | |
| 5060 | IXANY: bool = false, | |
| 5061 | IXOFF: bool = false, | |
| 5062 | IMAXBEL: bool = false, | |
| 5063 | IUTF8: bool = false, | |
| 5064 | _: u17 = 0, | |
| 5047 | pub const tc_iflag_t = switch (native_arch) { | |
| 5048 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) { | |
| 5049 | IGNBRK: bool = false, | |
| 5050 | BRKINT: bool = false, | |
| 5051 | IGNPAR: bool = false, | |
| 5052 | PARMRK: bool = false, | |
| 5053 | INPCK: bool = false, | |
| 5054 | ISTRIP: bool = false, | |
| 5055 | INLCR: bool = false, | |
| 5056 | IGNCR: bool = false, | |
| 5057 | ICRNL: bool = false, | |
| 5058 | IXON: bool = false, | |
| 5059 | IXOFF: bool = false, | |
| 5060 | IXANY: bool = false, | |
| 5061 | IUCLC: bool = false, | |
| 5062 | IMAXBEL: bool = false, | |
| 5063 | IUTF8: bool = false, | |
| 5064 | _: u17 = 0, | |
| 5065 | }, | |
| 5066 | else => packed struct(u32) { | |
| 5067 | IGNBRK: bool = false, | |
| 5068 | BRKINT: bool = false, | |
| 5069 | IGNPAR: bool = false, | |
| 5070 | PARMRK: bool = false, | |
| 5071 | INPCK: bool = false, | |
| 5072 | ISTRIP: bool = false, | |
| 5073 | INLCR: bool = false, | |
| 5074 | IGNCR: bool = false, | |
| 5075 | ICRNL: bool = false, | |
| 5076 | IUCLC: bool = false, | |
| 5077 | IXON: bool = false, | |
| 5078 | IXANY: bool = false, | |
| 5079 | IXOFF: bool = false, | |
| 5080 | IMAXBEL: bool = false, | |
| 5081 | IUTF8: bool = false, | |
| 5082 | _: u17 = 0, | |
| 5083 | }, | |
| 5065 | 5084 | }; |
| 5066 | 5085 | |
| 5067 | 5086 | pub const cc_t = switch (native_arch) { |
| ... | ... | @@ -5124,6 +5143,8 @@ pub const cc_t = switch (native_arch) { |
| 5124 | 5143 | }, |
| 5125 | 5144 | }; |
| 5126 | 5145 | |
| 5146 | pub const tcflag_t = u32; | |
| 5147 | ||
| 5127 | 5148 | pub const OPOST: tcflag_t = 1; |
| 5128 | 5149 | pub const OLCUC: tcflag_t = 2; |
| 5129 | 5150 | pub const ONLCR: tcflag_t = 4; |
| ... | ... | @@ -5168,7 +5189,7 @@ pub const TCSA = enum(c_uint) { |
| 5168 | 5189 | |
| 5169 | 5190 | pub const termios = switch (native_arch) { |
| 5170 | 5191 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => extern struct { |
| 5171 | iflag: tcflag_t, | |
| 5192 | iflag: tc_iflag_t, | |
| 5172 | 5193 | oflag: tcflag_t, |
| 5173 | 5194 | cflag: tcflag_t, |
| 5174 | 5195 | lflag: tcflag_t, |
| ... | ... | @@ -5178,7 +5199,7 @@ pub const termios = switch (native_arch) { |
| 5178 | 5199 | ospeed: speed_t, |
| 5179 | 5200 | }, |
| 5180 | 5201 | else => extern struct { |
| 5181 | iflag: tcflag_t, | |
| 5202 | iflag: tc_iflag_t, | |
| 5182 | 5203 | oflag: tcflag_t, |
| 5183 | 5204 | cflag: tcflag_t, |
| 5184 | 5205 | lflag: tcflag_t, |