| author | |
| committer | |
| log | 0c88f927f161224f5c5ce2b12a76133a421af081 |
| tree | 831c20b2d51a9beabe94700aea986a8be92c7961 |
| parent | 9a643185540a3bba31e449fdf6f25643a2ea3394 |
10 files changed, 135 insertions(+), 203 deletions(-)
lib/std/c.zig+78| ... | ... | @@ -790,6 +790,84 @@ pub const NCCS = switch (native_os) { |
| 790 | 790 | else => @compileError("target libc does not have NCCS"), |
| 791 | 791 | }; |
| 792 | 792 | |
| 793 | pub const termios = switch (native_os) { | |
| 794 | .linux => std.os.linux.termios, | |
| 795 | .macos, .ios, .tvos, .watchos => extern struct { | |
| 796 | iflag: tcflag_t, | |
| 797 | oflag: tcflag_t, | |
| 798 | cflag: tcflag_t, | |
| 799 | lflag: tcflag_t, | |
| 800 | cc: [NCCS]cc_t, | |
| 801 | ispeed: speed_t align(8), | |
| 802 | ospeed: speed_t, | |
| 803 | }, | |
| 804 | .freebsd, .kfreebsd, .netbsd, .dragonfly, .openbsd => extern struct { | |
| 805 | iflag: tcflag_t, | |
| 806 | oflag: tcflag_t, | |
| 807 | cflag: tcflag_t, | |
| 808 | lflag: tcflag_t, | |
| 809 | cc: [NCCS]cc_t, | |
| 810 | ispeed: speed_t, | |
| 811 | ospeed: speed_t, | |
| 812 | }, | |
| 813 | .haiku => extern struct { | |
| 814 | iflag: tcflag_t, | |
| 815 | oflag: tcflag_t, | |
| 816 | cflag: tcflag_t, | |
| 817 | lflag: tcflag_t, | |
| 818 | line: cc_t, | |
| 819 | ispeed: speed_t, | |
| 820 | ospeed: speed_t, | |
| 821 | cc: [NCCS]cc_t, | |
| 822 | }, | |
| 823 | .solaris, .illumos => extern struct { | |
| 824 | iflag: tcflag_t, | |
| 825 | oflag: tcflag_t, | |
| 826 | cflag: tcflag_t, | |
| 827 | lflag: tcflag_t, | |
| 828 | cc: [NCCS]cc_t, | |
| 829 | }, | |
| 830 | .emscripten, .wasi => extern struct { | |
| 831 | iflag: tcflag_t, | |
| 832 | oflag: tcflag_t, | |
| 833 | cflag: tcflag_t, | |
| 834 | lflag: tcflag_t, | |
| 835 | line: std.c.cc_t, | |
| 836 | cc: [NCCS]cc_t, | |
| 837 | ispeed: speed_t, | |
| 838 | ospeed: speed_t, | |
| 839 | }, | |
| 840 | else => @compileError("target libc does not have termios"), | |
| 841 | }; | |
| 842 | ||
| 843 | pub const tcflag_t = switch (native_os) { | |
| 844 | .linux => std.os.linux.tcflag_t, | |
| 845 | .macos, .ios, .tvos, .watchos => u64, | |
| 846 | .freebsd, .kfreebsd => c_uint, | |
| 847 | .netbsd => c_uint, | |
| 848 | .dragonfly => c_uint, | |
| 849 | .openbsd => c_uint, | |
| 850 | .haiku => u32, | |
| 851 | .solaris, .illumos => c_uint, | |
| 852 | .emscripten => u32, | |
| 853 | .wasi => c_uint, | |
| 854 | else => @compileError("target libc does not have tcflag_t"), | |
| 855 | }; | |
| 856 | ||
| 857 | pub const speed_t = switch (native_os) { | |
| 858 | .linux => std.os.linux.speed_t, | |
| 859 | .macos, .ios, .tvos, .watchos => u64, | |
| 860 | .freebsd, .kfreebsd => c_uint, | |
| 861 | .netbsd => c_uint, | |
| 862 | .dragonfly => c_uint, | |
| 863 | .openbsd => c_uint, | |
| 864 | .haiku => u8, | |
| 865 | .solaris, .illumos => c_uint, | |
| 866 | .emscripten => u32, | |
| 867 | .wasi => c_uint, | |
| 868 | else => @compileError("target libc does not have speed_t"), | |
| 869 | }; | |
| 870 | ||
| 793 | 871 | pub const whence_t = if (native_os == .wasi) std.os.wasi.whence_t else c_int; |
| 794 | 872 | |
| 795 | 873 | // Unix-like systems |
lib/std/c/darwin.zig-13| ... | ... | @@ -2692,9 +2692,6 @@ pub const SHUT = struct { |
| 2692 | 2692 | pub const RDWR = 2; |
| 2693 | 2693 | }; |
| 2694 | 2694 | |
| 2695 | pub const speed_t = u64; | |
| 2696 | pub const tcflag_t = u64; | |
| 2697 | ||
| 2698 | 2695 | pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition |
| 2699 | 2696 | pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINTR |
| 2700 | 2697 | pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors |
| ... | ... | @@ -2829,16 +2826,6 @@ pub const TCOON: tcflag_t = 2; |
| 2829 | 2826 | pub const TCIOFF: tcflag_t = 3; |
| 2830 | 2827 | pub const TCION: tcflag_t = 4; |
| 2831 | 2828 | |
| 2832 | pub const termios = extern struct { | |
| 2833 | iflag: tcflag_t, // input flags | |
| 2834 | oflag: tcflag_t, // output flags | |
| 2835 | cflag: tcflag_t, // control flags | |
| 2836 | lflag: tcflag_t, // local flags | |
| 2837 | cc: [std.c.NCCS]std.c.cc_t, // control chars | |
| 2838 | ispeed: speed_t align(8), // input speed | |
| 2839 | ospeed: speed_t, // output speed | |
| 2840 | }; | |
| 2841 | ||
| 2842 | 2829 | pub const winsize = extern struct { |
| 2843 | 2830 | ws_row: u16, |
| 2844 | 2831 | ws_col: u16, |
lib/std/c/emscripten.zig-14| ... | ... | @@ -178,17 +178,3 @@ pub const dirent = struct { |
| 178 | 178 | type: u8, |
| 179 | 179 | name: [256]u8, |
| 180 | 180 | }; |
| 181 | ||
| 182 | pub const speed_t = u32; | |
| 183 | pub const tcflag_t = u32; | |
| 184 | ||
| 185 | pub const termios = extern struct { | |
| 186 | iflag: tcflag_t, | |
| 187 | oflag: tcflag_t, | |
| 188 | cflag: tcflag_t, | |
| 189 | lflag: tcflag_t, | |
| 190 | line: std.c.cc_t, | |
| 191 | cc: [std.c.NCCS]std.c.cc_t, | |
| 192 | ispeed: speed_t, | |
| 193 | ospeed: speed_t, | |
| 194 | }; |
lib/std/c/haiku.zig-14| ... | ... | @@ -950,18 +950,4 @@ pub const directory_which = enum(c_int) { |
| 950 | 950 | _, |
| 951 | 951 | }; |
| 952 | 952 | |
| 953 | pub const speed_t = u8; | |
| 954 | pub const tcflag_t = u32; | |
| 955 | ||
| 956 | pub const termios = extern struct { | |
| 957 | c_iflag: tcflag_t, | |
| 958 | c_oflag: tcflag_t, | |
| 959 | c_cflag: tcflag_t, | |
| 960 | c_lflag: tcflag_t, | |
| 961 | c_line: std.c.cc_t, | |
| 962 | c_ispeed: speed_t, | |
| 963 | c_ospeed: speed_t, | |
| 964 | cc_t: [std.c.NCCS]std.c.cc_t, | |
| 965 | }; | |
| 966 | ||
| 967 | 953 | pub const MSG_NOSIGNAL = 0x0800; |
lib/std/c/linux.zig-2| ... | ... | @@ -85,8 +85,6 @@ pub const sigset_t = linux.sigset_t; |
| 85 | 85 | pub const sockaddr = linux.sockaddr; |
| 86 | 86 | pub const socklen_t = linux.socklen_t; |
| 87 | 87 | pub const stack_t = linux.stack_t; |
| 88 | pub const tcflag_t = linux.tcflag_t; | |
| 89 | pub const termios = linux.termios; | |
| 90 | 88 | pub const time_t = linux.time_t; |
| 91 | 89 | pub const timespec = linux.timespec; |
| 92 | 90 | pub const timeval = linux.timeval; |
lib/std/c/netbsd.zig-13| ... | ... | @@ -850,19 +850,6 @@ pub const CDTRCTS: tcflag_t = 0x00020000; // DTR/CTS full-duplex flow control |
| 850 | 850 | pub const MDMBUF: tcflag_t = 0x00100000; // DTR/DCD hardware flow control |
| 851 | 851 | pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS | CDTRCTS); // all types of hw flow control |
| 852 | 852 | |
| 853 | pub const tcflag_t = c_uint; | |
| 854 | pub const speed_t = c_uint; | |
| 855 | ||
| 856 | pub const termios = extern struct { | |
| 857 | iflag: tcflag_t, // input flags | |
| 858 | oflag: tcflag_t, // output flags | |
| 859 | cflag: tcflag_t, // control flags | |
| 860 | lflag: tcflag_t, // local flags | |
| 861 | cc: [std.c.NCCS]std.c.cc_t, // control chars | |
| 862 | ispeed: c_int, // input speed | |
| 863 | ospeed: c_int, // output speed | |
| 864 | }; | |
| 865 | ||
| 866 | 853 | // Commands passed to tcsetattr() for setting the termios structure. |
| 867 | 854 | pub const TCSA = struct { |
| 868 | 855 | pub const NOW = 0; // make change immediate |
lib/std/c/openbsd.zig-13| ... | ... | @@ -768,9 +768,6 @@ pub const AUTH = struct { |
| 768 | 768 | pub const ALLOW: c_int = (OKAY | ROOTOKAY | SECURE); |
| 769 | 769 | }; |
| 770 | 770 | |
| 771 | pub const tcflag_t = c_uint; | |
| 772 | pub const speed_t = c_uint; | |
| 773 | ||
| 774 | 771 | // Input flags - software input processing |
| 775 | 772 | pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition |
| 776 | 773 | pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT |
| ... | ... | @@ -816,16 +813,6 @@ pub const CCTS_OFLOW: tcflag_t = CRTSCTS; // XXX compat |
| 816 | 813 | pub const MDMBUF: tcflag_t = 0x00100000; // DTR/DCD hardware flow control |
| 817 | 814 | pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS); // all types of hw flow control |
| 818 | 815 | |
| 819 | pub const termios = extern struct { | |
| 820 | iflag: tcflag_t, // input flags | |
| 821 | oflag: tcflag_t, // output flags | |
| 822 | cflag: tcflag_t, // control flags | |
| 823 | lflag: tcflag_t, // local flags | |
| 824 | cc: [std.c.NCCS]std.c.cc_t, // control chars | |
| 825 | ispeed: c_int, // input speed | |
| 826 | ospeed: c_int, // output speed | |
| 827 | }; | |
| 828 | ||
| 829 | 816 | // Commands passed to tcsetattr() for setting the termios structure. |
| 830 | 817 | pub const TCSA = struct { |
| 831 | 818 | pub const NOW = 0; // make change immediate |
lib/std/c/solaris.zig-11| ... | ... | @@ -698,17 +698,6 @@ pub const SEEK = struct { |
| 698 | 698 | pub const HOLE = 4; |
| 699 | 699 | }; |
| 700 | 700 | |
| 701 | pub const tcflag_t = c_uint; | |
| 702 | pub const speed_t = c_uint; | |
| 703 | ||
| 704 | pub const termios = extern struct { | |
| 705 | c_iflag: tcflag_t, | |
| 706 | c_oflag: tcflag_t, | |
| 707 | c_cflag: tcflag_t, | |
| 708 | c_lflag: tcflag_t, | |
| 709 | c_cc: [std.c.NCCS]std.c.cc_t, | |
| 710 | }; | |
| 711 | ||
| 712 | 701 | fn tioc(t: u16, num: u8) u16 { |
| 713 | 702 | return (t << 8) | num; |
| 714 | 703 | } |
lib/std/os.zig+2| ... | ... | @@ -106,6 +106,7 @@ 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; | |
| 109 | 110 | pub const O = system.O; |
| 110 | 111 | pub const PATH_MAX = system.PATH_MAX; |
| 111 | 112 | pub const POLL = system.POLL; |
| ... | ... | @@ -172,6 +173,7 @@ pub const siginfo_t = system.siginfo_t; |
| 172 | 173 | pub const sigset_t = system.sigset_t; |
| 173 | 174 | pub const sockaddr = system.sockaddr; |
| 174 | 175 | pub const socklen_t = system.socklen_t; |
| 176 | pub const speed_t = system.speed_t; | |
| 175 | 177 | pub const stack_t = system.stack_t; |
| 176 | 178 | pub const tcflag_t = system.tcflag_t; |
| 177 | 179 | pub const termios = system.termios; |
lib/std/os/linux.zig+55-123| ... | ... | @@ -5005,6 +5005,7 @@ pub const rusage = extern struct { |
| 5005 | 5005 | }; |
| 5006 | 5006 | |
| 5007 | 5007 | pub const speed_t = u32; |
| 5008 | pub const tcflag_t = u32; | |
| 5008 | 5009 | |
| 5009 | 5010 | pub const NCCS = switch (native_arch) { |
| 5010 | 5011 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => 19, |
| ... | ... | @@ -5044,88 +5045,7 @@ pub const B3000000 = 0o0010015; |
| 5044 | 5045 | pub const B3500000 = 0o0010016; |
| 5045 | 5046 | pub const B4000000 = 0o0010017; |
| 5046 | 5047 | |
| 5047 | pub const V = switch (native_arch) { | |
| 5048 | .powerpc, .powerpc64, .powerpc64le => struct { | |
| 5049 | pub const INTR = 0; | |
| 5050 | pub const QUIT = 1; | |
| 5051 | pub const ERASE = 2; | |
| 5052 | pub const KILL = 3; | |
| 5053 | pub const EOF = 4; | |
| 5054 | pub const MIN = 5; | |
| 5055 | pub const EOL = 6; | |
| 5056 | pub const TIME = 7; | |
| 5057 | pub const EOL2 = 8; | |
| 5058 | pub const SWTC = 9; | |
| 5059 | pub const WERASE = 10; | |
| 5060 | pub const REPRINT = 11; | |
| 5061 | pub const SUSP = 12; | |
| 5062 | pub const START = 13; | |
| 5063 | pub const STOP = 14; | |
| 5064 | pub const LNEXT = 15; | |
| 5065 | pub const DISCARD = 16; | |
| 5066 | }, | |
| 5067 | .sparc, .sparc64 => struct { | |
| 5068 | pub const INTR = 0; | |
| 5069 | pub const QUIT = 1; | |
| 5070 | pub const ERASE = 2; | |
| 5071 | pub const KILL = 3; | |
| 5072 | pub const EOF = 4; | |
| 5073 | pub const EOL = 5; | |
| 5074 | pub const EOL2 = 6; | |
| 5075 | pub const SWTC = 7; | |
| 5076 | pub const START = 8; | |
| 5077 | pub const STOP = 9; | |
| 5078 | pub const SUSP = 10; | |
| 5079 | pub const DSUSP = 11; | |
| 5080 | pub const REPRINT = 12; | |
| 5081 | pub const DISCARD = 13; | |
| 5082 | pub const WERASE = 14; | |
| 5083 | pub const LNEXT = 15; | |
| 5084 | pub const MIN = EOF; | |
| 5085 | pub const TIME = EOL; | |
| 5086 | }, | |
| 5087 | .mips, .mipsel, .mips64, .mips64el => struct { | |
| 5088 | pub const INTR = 0; | |
| 5089 | pub const QUIT = 1; | |
| 5090 | pub const ERASE = 2; | |
| 5091 | pub const KILL = 3; | |
| 5092 | pub const MIN = 4; | |
| 5093 | pub const TIME = 5; | |
| 5094 | pub const EOL2 = 6; | |
| 5095 | pub const SWTC = 7; | |
| 5096 | pub const SWTCH = 7; | |
| 5097 | pub const START = 8; | |
| 5098 | pub const STOP = 9; | |
| 5099 | pub const SUSP = 10; | |
| 5100 | pub const REPRINT = 12; | |
| 5101 | pub const DISCARD = 13; | |
| 5102 | pub const WERASE = 14; | |
| 5103 | pub const LNEXT = 15; | |
| 5104 | pub const EOF = 16; | |
| 5105 | pub const EOL = 17; | |
| 5106 | }, | |
| 5107 | else => struct { | |
| 5108 | pub const INTR = 0; | |
| 5109 | pub const QUIT = 1; | |
| 5110 | pub const ERASE = 2; | |
| 5111 | pub const KILL = 3; | |
| 5112 | pub const EOF = 4; | |
| 5113 | pub const TIME = 5; | |
| 5114 | pub const MIN = 6; | |
| 5115 | pub const SWTC = 7; | |
| 5116 | pub const START = 8; | |
| 5117 | pub const STOP = 9; | |
| 5118 | pub const SUSP = 10; | |
| 5119 | pub const EOL = 11; | |
| 5120 | pub const REPRINT = 12; | |
| 5121 | pub const DISCARD = 13; | |
| 5122 | pub const WERASE = 14; | |
| 5123 | pub const LNEXT = 15; | |
| 5124 | pub const EOL2 = 16; | |
| 5125 | }, | |
| 5126 | }; | |
| 5127 | ||
| 5128 | pub const tc_iflag_t = packed struct (u32) { | |
| 5048 | pub const tc_iflag_t = packed struct(u32) { | |
| 5129 | 5049 | IGNBRK: bool = false, |
| 5130 | 5050 | BRKINT: bool = false, |
| 5131 | 5051 | IGNPAR: bool = false, |
| ... | ... | @@ -5145,42 +5065,42 @@ pub const tc_iflag_t = packed struct (u32) { |
| 5145 | 5065 | }; |
| 5146 | 5066 | |
| 5147 | 5067 | pub const cc_t = switch (native_arch) { |
| 5148 | .mips, .mipsel, .mips64, .mips64el => enum(u8){ | |
| 5149 | VINTR = 0, | |
| 5150 | VQUIT = 1, | |
| 5151 | VERASE = 2, | |
| 5152 | VKILL = 3, | |
| 5153 | VMIN = 4, | |
| 5154 | VTIME = 5, | |
| 5155 | VEOL2 = 6, | |
| 5156 | VSWTC = 7, | |
| 5157 | VSTART = 8, | |
| 5158 | VSTOP = 9, | |
| 5159 | VSUSP = 10, | |
| 5068 | .mips, .mipsel, .mips64, .mips64el => enum(u8) { | |
| 5069 | VINTR = 0, | |
| 5070 | VQUIT = 1, | |
| 5071 | VERASE = 2, | |
| 5072 | VKILL = 3, | |
| 5073 | VMIN = 4, | |
| 5074 | VTIME = 5, | |
| 5075 | VEOL2 = 6, | |
| 5076 | VSWTC = 7, | |
| 5077 | VSTART = 8, | |
| 5078 | VSTOP = 9, | |
| 5079 | VSUSP = 10, | |
| 5160 | 5080 | VREPRINT = 12, |
| 5161 | 5081 | VDISCARD = 13, |
| 5162 | VWERASE = 14, | |
| 5163 | VLNEXT = 15, | |
| 5164 | VEOF = 16, | |
| 5165 | VEOL = 17, | |
| 5082 | VWERASE = 14, | |
| 5083 | VLNEXT = 15, | |
| 5084 | VEOF = 16, | |
| 5085 | VEOL = 17, | |
| 5166 | 5086 | }, |
| 5167 | .powerpc, .powerpc64, .powerpc64le => enum(u8) { | |
| 5168 | VINTR = 0, | |
| 5169 | VQUIT = 1, | |
| 5170 | VERASE = 2, | |
| 5171 | VKILL = 3, | |
| 5172 | VEOF = 4, | |
| 5173 | VMIN = 5, | |
| 5174 | VEOL = 6, | |
| 5175 | VTIME = 7, | |
| 5176 | VEOL2 = 8, | |
| 5177 | VSWTC = 9, | |
| 5178 | VWERASE = 10, | |
| 5087 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => enum(u8) { | |
| 5088 | VINTR = 0, | |
| 5089 | VQUIT = 1, | |
| 5090 | VERASE = 2, | |
| 5091 | VKILL = 3, | |
| 5092 | VEOF = 4, | |
| 5093 | VMIN = 5, | |
| 5094 | VEOL = 6, | |
| 5095 | VTIME = 7, | |
| 5096 | VEOL2 = 8, | |
| 5097 | VSWTC = 9, | |
| 5098 | VWERASE = 10, | |
| 5179 | 5099 | VREPRINT = 11, |
| 5180 | VSUSP = 12, | |
| 5181 | VSTART = 13, | |
| 5182 | VSTOP = 14, | |
| 5183 | VLNEXT = 15, | |
| 5100 | VSUSP = 12, | |
| 5101 | VSTART = 13, | |
| 5102 | VSTOP = 14, | |
| 5103 | VLNEXT = 15, | |
| 5184 | 5104 | VDISCARD = 16, |
| 5185 | 5105 | }, |
| 5186 | 5106 | else => enum(u8) { |
| ... | ... | @@ -5246,15 +5166,27 @@ pub const TCSA = enum(c_uint) { |
| 5246 | 5166 | _, |
| 5247 | 5167 | }; |
| 5248 | 5168 | |
| 5249 | pub const termios = extern struct { | |
| 5250 | iflag: tc_iflag_t, | |
| 5251 | oflag: tc_oflag_t, | |
| 5252 | cflag: tc_cflag_t, | |
| 5253 | lflag: tc_lflag_t, | |
| 5254 | line: cc_t, | |
| 5255 | cc: [NCCS]cc_t, | |
| 5256 | ispeed: speed_t, | |
| 5257 | ospeed: speed_t, | |
| 5169 | pub const termios = switch (native_arch) { | |
| 5170 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => extern struct { | |
| 5171 | iflag: tcflag_t, | |
| 5172 | oflag: tcflag_t, | |
| 5173 | cflag: tcflag_t, | |
| 5174 | lflag: tcflag_t, | |
| 5175 | cc: [NCCS]cc_t, | |
| 5176 | line: cc_t, | |
| 5177 | ispeed: speed_t, | |
| 5178 | ospeed: speed_t, | |
| 5179 | }, | |
| 5180 | else => extern struct { | |
| 5181 | iflag: tcflag_t, | |
| 5182 | oflag: tcflag_t, | |
| 5183 | cflag: tcflag_t, | |
| 5184 | lflag: tcflag_t, | |
| 5185 | line: cc_t, | |
| 5186 | cc: [NCCS]cc_t, | |
| 5187 | ispeed: speed_t, | |
| 5188 | ospeed: speed_t, | |
| 5189 | }, | |
| 5258 | 5190 | }; |
| 5259 | 5191 | |
| 5260 | 5192 | pub const SIOCGIFINDEX = 0x8933; |