| author | |
| committer | |
| log | a280ff2767cbb8da1a10d70eaddb0d6c0730443f |
| tree | e1355608beacddcecd71dbc8e732b45df7c18492 |
| parent | e97fa8b03803dfb5d2046d9b2ebecbee85a0e1f9 |
This creates `tc_cflag_t` even though such a type is not defined by
libc.
I also collected the missing flag bits from all the operating systems.4 files changed, 155 insertions(+), 88 deletions(-)
lib/std/c.zig+105-17| ... | ... | @@ -796,7 +796,7 @@ pub const termios = switch (native_os) { |
| 796 | 796 | iflag: tc_iflag_t, |
| 797 | 797 | oflag: tc_oflag_t, |
| 798 | 798 | cflag: tc_cflag_t, |
| 799 | lflag: tcflag_t, | |
| 799 | lflag: tc_lflag_t, | |
| 800 | 800 | cc: [NCCS]cc_t, |
| 801 | 801 | ispeed: speed_t align(8), |
| 802 | 802 | ospeed: speed_t, |
| ... | ... | @@ -805,7 +805,7 @@ pub const termios = switch (native_os) { |
| 805 | 805 | iflag: tc_iflag_t, |
| 806 | 806 | oflag: tc_oflag_t, |
| 807 | 807 | cflag: tc_cflag_t, |
| 808 | lflag: tcflag_t, | |
| 808 | lflag: tc_lflag_t, | |
| 809 | 809 | cc: [NCCS]cc_t, |
| 810 | 810 | ispeed: speed_t, |
| 811 | 811 | ospeed: speed_t, |
| ... | ... | @@ -814,7 +814,7 @@ pub const termios = switch (native_os) { |
| 814 | 814 | iflag: tc_iflag_t, |
| 815 | 815 | oflag: tc_oflag_t, |
| 816 | 816 | cflag: tc_cflag_t, |
| 817 | lflag: tcflag_t, | |
| 817 | lflag: tc_lflag_t, | |
| 818 | 818 | line: cc_t, |
| 819 | 819 | ispeed: speed_t, |
| 820 | 820 | ospeed: speed_t, |
| ... | ... | @@ -824,14 +824,14 @@ pub const termios = switch (native_os) { |
| 824 | 824 | iflag: tc_iflag_t, |
| 825 | 825 | oflag: tc_oflag_t, |
| 826 | 826 | cflag: tc_cflag_t, |
| 827 | lflag: tcflag_t, | |
| 827 | lflag: tc_lflag_t, | |
| 828 | 828 | cc: [NCCS]cc_t, |
| 829 | 829 | }, |
| 830 | 830 | .emscripten, .wasi => extern struct { |
| 831 | 831 | iflag: tc_iflag_t, |
| 832 | 832 | oflag: tc_oflag_t, |
| 833 | 833 | cflag: tc_cflag_t, |
| 834 | lflag: tcflag_t, | |
| 834 | lflag: tc_lflag_t, | |
| 835 | 835 | line: std.c.cc_t, |
| 836 | 836 | cc: [NCCS]cc_t, |
| 837 | 837 | ispeed: speed_t, |
| ... | ... | @@ -1183,18 +1183,106 @@ pub const tc_cflag_t = switch (native_os) { |
| 1183 | 1183 | else => @compileError("target libc does not have tc_cflag_t"), |
| 1184 | 1184 | }; |
| 1185 | 1185 | |
| 1186 | pub const tcflag_t = switch (native_os) { | |
| 1187 | .linux => std.os.linux.tcflag_t, | |
| 1188 | .macos, .ios, .tvos, .watchos => u64, | |
| 1189 | .freebsd, .kfreebsd => c_uint, | |
| 1190 | .netbsd => c_uint, | |
| 1191 | .dragonfly => c_uint, | |
| 1192 | .openbsd => c_uint, | |
| 1193 | .haiku => u32, | |
| 1194 | .solaris, .illumos => c_uint, | |
| 1195 | .emscripten => u32, | |
| 1196 | .wasi => c_uint, | |
| 1197 | else => @compileError("target libc does not have tcflag_t"), | |
| 1186 | pub const tc_lflag_t = switch (native_os) { | |
| 1187 | .linux => std.os.linux.tc_lflag_t, | |
| 1188 | .macos, .ios, .tvos, .watchos, .netbsd, .freebsd, .kfreebsd, .dragonfly => packed struct(u32) { | |
| 1189 | ECHOKE: bool = false, | |
| 1190 | ECHOE: bool = false, | |
| 1191 | ECHOK: bool = false, | |
| 1192 | ECHO: bool = false, | |
| 1193 | ECHONL: bool = false, | |
| 1194 | ECHOPRT: bool = false, | |
| 1195 | ECHOCTL: bool = false, | |
| 1196 | ISIG: bool = false, | |
| 1197 | ICANON: bool = false, | |
| 1198 | ALTWERASE: bool = false, | |
| 1199 | IEXTEN: bool = false, | |
| 1200 | EXTPROC: bool = false, | |
| 1201 | _12: u10 = 0, | |
| 1202 | TOSTOP: bool = false, | |
| 1203 | FLUSHO: bool = false, | |
| 1204 | _24: u1 = 0, | |
| 1205 | NOKERNINFO: bool = false, | |
| 1206 | _26: u3 = 0, | |
| 1207 | PENDIN: bool = false, | |
| 1208 | _30: u1 = 0, | |
| 1209 | NOFLSH: bool = false, | |
| 1210 | }, | |
| 1211 | .openbsd => packed struct(u32) { | |
| 1212 | ECHOKE: bool = false, | |
| 1213 | ECHOE: bool = false, | |
| 1214 | ECHOK: bool = false, | |
| 1215 | ECHO: bool = false, | |
| 1216 | ECHONL: bool = false, | |
| 1217 | ECHOPRT: bool = false, | |
| 1218 | ECHOCTL: bool = false, | |
| 1219 | ISIG: bool = false, | |
| 1220 | ICANON: bool = false, | |
| 1221 | ALTWERASE: bool = false, | |
| 1222 | IEXTEN: bool = false, | |
| 1223 | EXTPROC: bool = false, | |
| 1224 | _12: u10 = 0, | |
| 1225 | TOSTOP: bool = false, | |
| 1226 | FLUSHO: bool = false, | |
| 1227 | XCASE: bool = false, | |
| 1228 | NOKERNINFO: bool = false, | |
| 1229 | _26: u3 = 0, | |
| 1230 | PENDIN: bool = false, | |
| 1231 | _30: u1 = 0, | |
| 1232 | NOFLSH: bool = false, | |
| 1233 | }, | |
| 1234 | .haiku => packed struct(u32) { | |
| 1235 | ISIG: bool = false, | |
| 1236 | ICANON: bool = false, | |
| 1237 | XCASE: bool = false, | |
| 1238 | ECHO: bool = false, | |
| 1239 | ECHOE: bool = false, | |
| 1240 | ECHOK: bool = false, | |
| 1241 | ECHONL: bool = false, | |
| 1242 | NOFLSH: bool = false, | |
| 1243 | TOSTOP: bool = false, | |
| 1244 | IEXTEN: bool = false, | |
| 1245 | ECHOCTL: bool = false, | |
| 1246 | ECHOPRT: bool = false, | |
| 1247 | ECHOKE: bool = false, | |
| 1248 | FLUSHO: bool = false, | |
| 1249 | PENDIN: bool = false, | |
| 1250 | _: u17 = 0, | |
| 1251 | }, | |
| 1252 | .solaris, .illumos => packed struct(u32) { | |
| 1253 | ISIG: bool = false, | |
| 1254 | ICANON: bool = false, | |
| 1255 | XCASE: bool = false, | |
| 1256 | ECHO: bool = false, | |
| 1257 | ECHOE: bool = false, | |
| 1258 | ECHOK: bool = false, | |
| 1259 | ECHONL: bool = false, | |
| 1260 | NOFLSH: bool = false, | |
| 1261 | TOSTOP: bool = false, | |
| 1262 | ECHOCTL: bool = false, | |
| 1263 | ECHOPRT: bool = false, | |
| 1264 | ECHOKE: bool = false, | |
| 1265 | DEFECHO: bool = false, | |
| 1266 | FLUSHO: bool = false, | |
| 1267 | PENDIN: bool = false, | |
| 1268 | IEXTEN: bool = false, | |
| 1269 | _: u16 = 0, | |
| 1270 | }, | |
| 1271 | .wasi, .emscripten => packed struct(u32) { | |
| 1272 | ISIG: bool = false, | |
| 1273 | ICANON: bool = false, | |
| 1274 | _2: u1 = 0, | |
| 1275 | ECHO: bool = false, | |
| 1276 | ECHOE: bool = false, | |
| 1277 | ECHOK: bool = false, | |
| 1278 | ECHONL: bool = false, | |
| 1279 | NOFLSH: bool = false, | |
| 1280 | TOSTOP: bool = false, | |
| 1281 | _9: u6 = 0, | |
| 1282 | IEXTEN: bool = false, | |
| 1283 | _: u16 = 0, | |
| 1284 | }, | |
| 1285 | else => @compileError("target libc does not have tc_lflag_t"), | |
| 1198 | 1286 | }; |
| 1199 | 1287 | |
| 1200 | 1288 | pub const speed_t = switch (native_os) { |
lib/std/c/darwin.zig-56| ... | ... | @@ -2692,28 +2692,6 @@ pub const SHUT = struct { |
| 2692 | 2692 | pub const RDWR = 2; |
| 2693 | 2693 | }; |
| 2694 | 2694 | |
| 2695 | pub const ECHOKE: tcflag_t = 0x00000001; // visual erase for line kill | |
| 2696 | pub const ECHOE: tcflag_t = 0x00000002; // visually erase chars | |
| 2697 | pub const ECHOK: tcflag_t = 0x00000004; // echo NL after line kill | |
| 2698 | pub const ECHO: tcflag_t = 0x00000008; // enable echoing | |
| 2699 | pub const ECHONL: tcflag_t = 0x00000010; // echo NL even if ECHO is off | |
| 2700 | pub const ECHOPRT: tcflag_t = 0x00000020; // visual erase mode for hardcopy | |
| 2701 | pub const ECHOCTL: tcflag_t = 0x00000040; // echo control chars as ^(Char) | |
| 2702 | pub const ISIG: tcflag_t = 0x00000080; // enable signals INTR, QUIT, [D]SUSP | |
| 2703 | pub const ICANON: tcflag_t = 0x00000100; // canonicalize input lines | |
| 2704 | pub const ALTWERASE: tcflag_t = 0x00000200; // use alternate WERASE algorithm | |
| 2705 | pub const IEXTEN: tcflag_t = 0x00000400; // enable DISCARD and LNEXT | |
| 2706 | pub const EXTPROC: tcflag_t = 0x00000800; // external processing | |
| 2707 | pub const TOSTOP: tcflag_t = 0x00400000; // stop background jobs from output | |
| 2708 | pub const FLUSHO: tcflag_t = 0x00800000; // output being flushed (state) | |
| 2709 | pub const NOKERNINFO: tcflag_t = 0x02000000; // no kernel output from VSTATUS | |
| 2710 | pub const PENDIN: tcflag_t = 0x20000000; // XXX retype pending input (state) | |
| 2711 | pub const NOFLSH: tcflag_t = 0x80000000; // don't flush after interrupt | |
| 2712 | ||
| 2713 | pub const TCSANOW: tcflag_t = 0; // make change immediate | |
| 2714 | pub const TCSADRAIN: tcflag_t = 1; // drain output, then change | |
| 2715 | pub const TCSAFLUSH: tcflag_t = 2; // drain output, flush input | |
| 2716 | pub const TCSASOFT: tcflag_t = 0x10; // flag - don't alter h.w. state | |
| 2717 | 2695 | pub const TCSA = enum(c_uint) { |
| 2718 | 2696 | NOW, |
| 2719 | 2697 | DRAIN, |
| ... | ... | @@ -2721,40 +2699,6 @@ pub const TCSA = enum(c_uint) { |
| 2721 | 2699 | _, |
| 2722 | 2700 | }; |
| 2723 | 2701 | |
| 2724 | pub const B0: tcflag_t = 0; | |
| 2725 | pub const B50: tcflag_t = 50; | |
| 2726 | pub const B75: tcflag_t = 75; | |
| 2727 | pub const B110: tcflag_t = 110; | |
| 2728 | pub const B134: tcflag_t = 134; | |
| 2729 | pub const B150: tcflag_t = 150; | |
| 2730 | pub const B200: tcflag_t = 200; | |
| 2731 | pub const B300: tcflag_t = 300; | |
| 2732 | pub const B600: tcflag_t = 600; | |
| 2733 | pub const B1200: tcflag_t = 1200; | |
| 2734 | pub const B1800: tcflag_t = 1800; | |
| 2735 | pub const B2400: tcflag_t = 2400; | |
| 2736 | pub const B4800: tcflag_t = 4800; | |
| 2737 | pub const B9600: tcflag_t = 9600; | |
| 2738 | pub const B19200: tcflag_t = 19200; | |
| 2739 | pub const B38400: tcflag_t = 38400; | |
| 2740 | pub const B7200: tcflag_t = 7200; | |
| 2741 | pub const B14400: tcflag_t = 14400; | |
| 2742 | pub const B28800: tcflag_t = 28800; | |
| 2743 | pub const B57600: tcflag_t = 57600; | |
| 2744 | pub const B76800: tcflag_t = 76800; | |
| 2745 | pub const B115200: tcflag_t = 115200; | |
| 2746 | pub const B230400: tcflag_t = 230400; | |
| 2747 | pub const EXTA: tcflag_t = 19200; | |
| 2748 | pub const EXTB: tcflag_t = 38400; | |
| 2749 | ||
| 2750 | pub const TCIFLUSH: tcflag_t = 1; | |
| 2751 | pub const TCOFLUSH: tcflag_t = 2; | |
| 2752 | pub const TCIOFLUSH: tcflag_t = 3; | |
| 2753 | pub const TCOOFF: tcflag_t = 1; | |
| 2754 | pub const TCOON: tcflag_t = 2; | |
| 2755 | pub const TCIOFF: tcflag_t = 3; | |
| 2756 | pub const TCION: tcflag_t = 4; | |
| 2757 | ||
| 2758 | 2702 | pub const winsize = extern struct { |
| 2759 | 2703 | ws_row: u16, |
| 2760 | 2704 | ws_col: u16, |
lib/std/os.zig+1-1| ... | ... | @@ -187,10 +187,10 @@ pub const utsname = system.utsname; |
| 187 | 187 | pub const CSIZE = system.CSIZE; |
| 188 | 188 | pub const NCCS = system.NCCS; |
| 189 | 189 | pub const speed_t = system.speed_t; |
| 190 | pub const tcflag_t = system.tcflag_t; | |
| 191 | 190 | pub const tc_iflag_t = system.tc_iflag_t; |
| 192 | 191 | pub const tc_oflag_t = system.tc_oflag_t; |
| 193 | 192 | pub const tc_cflag_t = system.tc_cflag_t; |
| 193 | pub const tc_lflag_t = system.tc_lflag_t; | |
| 194 | 194 | |
| 195 | 195 | pub const F_OK = system.F_OK; |
| 196 | 196 | pub const R_OK = system.R_OK; |
lib/std/os/linux.zig+49-14| ... | ... | @@ -5147,6 +5147,53 @@ pub const tc_cflag_t = switch (native_arch) { |
| 5147 | 5147 | }, |
| 5148 | 5148 | }; |
| 5149 | 5149 | |
| 5150 | pub const tc_lflag_t = switch (native_arch) { | |
| 5151 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) { | |
| 5152 | _0: u1 = 0, | |
| 5153 | ECHOE: bool = false, | |
| 5154 | ECHOK: bool = false, | |
| 5155 | ECHO: bool = false, | |
| 5156 | ECHONL: bool = false, | |
| 5157 | _5: u2 = 0, | |
| 5158 | ISIG: bool = false, | |
| 5159 | ICANON: bool = false, | |
| 5160 | _9: u1 = 0, | |
| 5161 | IEXTEN: bool = false, | |
| 5162 | _11: u11 = 0, | |
| 5163 | TOSTOP: bool = false, | |
| 5164 | _23: u8 = 0, | |
| 5165 | NOFLSH: bool = false, | |
| 5166 | }, | |
| 5167 | .mips, .mipsel, .mips64, .mips64el => packed struct(u32) { | |
| 5168 | ISIG: bool = false, | |
| 5169 | ICANON: bool = false, | |
| 5170 | _2: u1 = 0, | |
| 5171 | ECHO: bool = false, | |
| 5172 | ECHOE: bool = false, | |
| 5173 | ECHOK: bool = false, | |
| 5174 | ECHONL: bool = false, | |
| 5175 | NOFLSH: bool = false, | |
| 5176 | IEXTEN: bool = false, | |
| 5177 | _9: u6 = 0, | |
| 5178 | TOSTOP: bool = false, | |
| 5179 | _: u16 = 0, | |
| 5180 | }, | |
| 5181 | else => packed struct(u32) { | |
| 5182 | ISIG: bool = false, | |
| 5183 | ICANON: bool = false, | |
| 5184 | _2: u1 = 0, | |
| 5185 | ECHO: bool = false, | |
| 5186 | ECHOE: bool = false, | |
| 5187 | ECHOK: bool = false, | |
| 5188 | ECHONL: bool = false, | |
| 5189 | NOFLSH: bool = false, | |
| 5190 | TOSTOP: bool = false, | |
| 5191 | _9: u6 = 0, | |
| 5192 | IEXTEN: bool = false, | |
| 5193 | _: u16 = 0, | |
| 5194 | }, | |
| 5195 | }; | |
| 5196 | ||
| 5150 | 5197 | pub const cc_t = switch (native_arch) { |
| 5151 | 5198 | .mips, .mipsel, .mips64, .mips64el => enum(u8) { |
| 5152 | 5199 | VINTR = 0, |
| ... | ... | @@ -5207,18 +5254,6 @@ pub const cc_t = switch (native_arch) { |
| 5207 | 5254 | }, |
| 5208 | 5255 | }; |
| 5209 | 5256 | |
| 5210 | pub const tcflag_t = u32; | |
| 5211 | ||
| 5212 | pub const ISIG: tcflag_t = 1; | |
| 5213 | pub const ICANON: tcflag_t = 2; | |
| 5214 | pub const ECHO: tcflag_t = 8; | |
| 5215 | pub const ECHOE: tcflag_t = 16; | |
| 5216 | pub const ECHOK: tcflag_t = 32; | |
| 5217 | pub const ECHONL: tcflag_t = 64; | |
| 5218 | pub const NOFLSH: tcflag_t = 128; | |
| 5219 | pub const TOSTOP: tcflag_t = 256; | |
| 5220 | pub const IEXTEN: tcflag_t = 32768; | |
| 5221 | ||
| 5222 | 5257 | pub const TCSA = enum(c_uint) { |
| 5223 | 5258 | NOW, |
| 5224 | 5259 | DRAIN, |
| ... | ... | @@ -5231,7 +5266,7 @@ pub const termios = switch (native_arch) { |
| 5231 | 5266 | iflag: tc_iflag_t, |
| 5232 | 5267 | oflag: tc_oflag_t, |
| 5233 | 5268 | cflag: tc_cflag_t, |
| 5234 | lflag: tcflag_t, | |
| 5269 | lflag: tc_lflag_t, | |
| 5235 | 5270 | cc: [NCCS]cc_t, |
| 5236 | 5271 | line: cc_t, |
| 5237 | 5272 | ispeed: speed_t, |
| ... | ... | @@ -5241,7 +5276,7 @@ pub const termios = switch (native_arch) { |
| 5241 | 5276 | iflag: tc_iflag_t, |
| 5242 | 5277 | oflag: tc_oflag_t, |
| 5243 | 5278 | cflag: tc_cflag_t, |
| 5244 | lflag: tcflag_t, | |
| 5279 | lflag: tc_lflag_t, | |
| 5245 | 5280 | line: cc_t, |
| 5246 | 5281 | cc: [NCCS]cc_t, |
| 5247 | 5282 | ispeed: speed_t, |