authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-03 17:51:22+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-09 13:10:51-07:00
logae5bf2faabfe949e2cb94a230e79614c7eafd84a
tree73b4b02e6510f162e620f1aa1225c92920912f47
parent71a27ebd847bbd09d246eaf6657359ecfa0f8483

std.os.linux: Retranslate and port some ioctl-related types and values.


1 files changed, 924 insertions(+), 345 deletions(-)

lib/std/os/linux.zig+924-345
......@@ -4027,50 +4027,354 @@ pub const DT = struct {
40274027 pub const WHT = 14;
40284028};
40294029
4030pub const T = struct {
4031 pub const CGETS = if (is_mips) 0x540D else 0x5401;
4032 pub const CSETS = if (is_mips) 0x540e else 0x5402;
4033 pub const CSETSW = if (is_mips) 0x540f else 0x5403;
4034 pub const CSETSF = if (is_mips) 0x5410 else 0x5404;
4035 pub const CGETA = if (is_mips) 0x5401 else 0x5405;
4036 pub const CSETA = if (is_mips) 0x5402 else 0x5406;
4037 pub const CSETAW = if (is_mips) 0x5403 else 0x5407;
4038 pub const CSETAF = if (is_mips) 0x5404 else 0x5408;
4039 pub const CSBRK = if (is_mips) 0x5405 else 0x5409;
4040 pub const CXONC = if (is_mips) 0x5406 else 0x540A;
4041 pub const CFLSH = if (is_mips) 0x5407 else 0x540B;
4042 pub const IOCEXCL = if (is_mips) 0x740d else 0x540C;
4043 pub const IOCNXCL = if (is_mips) 0x740e else 0x540D;
4044 pub const IOCSCTTY = if (is_mips) 0x7472 else 0x540E;
4045 pub const IOCGPGRP = if (is_mips) 0x5472 else 0x540F;
4046 pub const IOCSPGRP = if (is_mips) 0x741d else 0x5410;
4047 pub const IOCOUTQ = if (is_mips) 0x7472 else 0x5411;
4048 pub const IOCSTI = if (is_mips) 0x5472 else 0x5412;
4049 pub const IOCGWINSZ = if (is_mips or is_ppc) 0x40087468 else 0x5413;
4050 pub const IOCSWINSZ = if (is_mips or is_ppc) 0x80087467 else 0x5414;
4051 pub const IOCMGET = if (is_mips) 0x741d else 0x5415;
4052 pub const IOCMBIS = if (is_mips) 0x741b else 0x5416;
4053 pub const IOCMBIC = if (is_mips) 0x741c else 0x5417;
4054 pub const IOCMSET = if (is_mips) 0x741a else 0x5418;
4055 pub const IOCGSOFTCAR = if (is_mips) 0x5481 else 0x5419;
4056 pub const IOCSSOFTCAR = if (is_mips) 0x5482 else 0x541A;
4057 pub const FIONREAD = if (is_mips) 0x467F else 0x541B;
4030pub const T = if (is_mips) struct {
4031 pub const CGETA = 0x5401;
4032 pub const CSETA = 0x5402;
4033 pub const CSETAW = 0x5403;
4034 pub const CSETAF = 0x5404;
4035
4036 pub const CSBRK = 0x5405;
4037 pub const CXONC = 0x5406;
4038 pub const CFLSH = 0x5407;
4039
4040 pub const CGETS = 0x540d;
4041 pub const CSETS = 0x540e;
4042 pub const CSETSW = 0x540f;
4043 pub const CSETSF = 0x5410;
4044
4045 pub const IOCEXCL = 0x740d;
4046 pub const IOCNXCL = 0x740e;
4047 pub const IOCOUTQ = 0x7472;
4048 pub const IOCSTI = 0x5472;
4049 pub const IOCMGET = 0x741d;
4050 pub const IOCMBIS = 0x741b;
4051 pub const IOCMBIC = 0x741c;
4052 pub const IOCMSET = 0x741a;
4053 pub const IOCPKT = 0x5470;
4054 pub const IOCPKT_DATA = 0x00;
4055 pub const IOCPKT_FLUSHREAD = 0x01;
4056 pub const IOCPKT_FLUSHWRITE = 0x02;
4057 pub const IOCPKT_STOP = 0x04;
4058 pub const IOCPKT_START = 0x08;
4059 pub const IOCPKT_NOSTOP = 0x10;
4060 pub const IOCPKT_DOSTOP = 0x20;
4061 pub const IOCPKT_IOCTL = 0x40;
4062 pub const IOCSWINSZ = IOCTL.IOW('t', 103, winsize);
4063 pub const IOCGWINSZ = IOCTL.IOR('t', 104, winsize);
4064 pub const IOCNOTTY = 0x5471;
4065 pub const IOCSETD = 0x7401;
4066 pub const IOCGETD = 0x7400;
4067
4068 pub const FIOCLEX = 0x6601;
4069 pub const FIONCLEX = 0x6602;
4070 pub const FIOASYNC = 0x667d;
4071 pub const FIONBIO = 0x667e;
4072 pub const FIOQSIZE = 0x667f;
4073
4074 pub const IOCGLTC = 0x7474;
4075 pub const IOCSLTC = 0x7475;
4076 pub const IOCSPGRP = IOCTL.IOW('t', 118, c_int);
4077 pub const IOCGPGRP = IOCTL.IOR('t', 119, c_int);
4078 pub const IOCCONS = IOCTL.IOW('t', 120, c_int);
4079
4080 pub const FIONREAD = 0x467f;
40584081 pub const IOCINQ = FIONREAD;
4059 pub const IOCLINUX = if (is_mips) 0x5483 else 0x541C;
4060 pub const IOCCONS = if (is_mips) IOCTL.IOW('t', 120, c_int) else 0x541D;
4061 pub const IOCGSERIAL = if (is_mips) 0x5484 else 0x541E;
4062 pub const IOCSSERIAL = if (is_mips) 0x5485 else 0x541F;
4063 pub const IOCPKT = if (is_mips) 0x5470 else 0x5420;
4064 pub const FIONBIO = if (is_mips) 0x667e else 0x5421;
4065 pub const IOCNOTTY = if (is_mips) 0x5471 else 0x5422;
4066 pub const IOCSETD = if (is_mips) 0x7401 else 0x5423;
4067 pub const IOCGETD = if (is_mips) 0x7400 else 0x5424;
4068 pub const CSBRKP = if (is_mips) 0x5486 else 0x5425;
4082
4083 pub const IOCGETP = 0x7408;
4084 pub const IOCSETP = 0x7409;
4085 pub const IOCSETN = 0x740a;
4086
4087 pub const IOCSBRK = 0x5427;
4088 pub const IOCCBRK = 0x5428;
4089 pub const IOCGSID = 0x7416;
4090 pub const CGETS2 = IOCTL.IOR('T', 0x2a, termios2);
4091 pub const CSETS2 = IOCTL.IOW('T', 0x2b, termios2);
4092 pub const CSETSW2 = IOCTL.IOW('T', 0x2c, termios2);
4093 pub const CSETSF2 = IOCTL.IOW('T', 0x2d, termios2);
4094 pub const IOCGRS485 = IOCTL.IOR('T', 0x2e, serial_rs485);
4095 pub const IOCSRS485 = IOCTL.IOWR('T', 0x2f, serial_rs485);
4096 pub const IOCGPTN = IOCTL.IOR('T', 0x30, c_uint);
4097 pub const IOCSPTLCK = IOCTL.IOW('T', 0x31, c_int);
4098 pub const IOCGDEV = IOCTL.IOR('T', 0x32, c_uint);
4099 pub const IOCSIG = IOCTL.IOW('T', 0x36, c_int);
4100 pub const IOCVHANGUP = 0x5437;
4101 pub const IOCGPKT = IOCTL.IOR('T', 0x38, c_int);
4102 pub const IOCGPTLCK = IOCTL.IOR('T', 0x39, c_int);
4103 pub const IOCGEXCL = IOCTL.IOR('T', 0x40, c_int);
4104 pub const IOCGPTPEER = IOCTL.IO('T', 0x41);
4105 pub const IOCGISO7816 = IOCTL.IOR('T', 0x42, serial_iso7816);
4106 pub const IOCSISO7816 = IOCTL.IOWR('T', 0x43, serial_iso7816);
4107
4108 pub const IOCSCTTY = 0x5480;
4109 pub const IOCGSOFTCAR = 0x5481;
4110 pub const IOCSSOFTCAR = 0x5482;
4111 pub const IOCLINUX = 0x5483;
4112 pub const IOCGSERIAL = 0x5484;
4113 pub const IOCSSERIAL = 0x5485;
4114 pub const CSBRKP = 0x5486;
4115 pub const IOCSERCONFIG = 0x5488;
4116 pub const IOCSERGWILD = 0x5489;
4117 pub const IOCSERSWILD = 0x548a;
4118 pub const IOCGLCKTRMIOS = 0x548b;
4119 pub const IOCSLCKTRMIOS = 0x548c;
4120 pub const IOCSERGSTRUCT = 0x548d;
4121 pub const IOCSERGETLSR = 0x548e;
4122 pub const IOCSERGETMULTI = 0x548f;
4123 pub const IOCSERSETMULTI = 0x5490;
4124 pub const IOCMIWAIT = 0x5491;
4125 pub const IOCGICOUNT = 0x5492;
4126} else if (is_ppc) struct {
4127 pub const FIOCLEX = IOCTL.IO('f', 1);
4128 pub const FIONCLEX = IOCTL.IO('f', 2);
4129 pub const FIOASYNC = IOCTL.IOW('f', 125, c_int);
4130 pub const FIONBIO = IOCTL.IOW('f', 126, c_int);
4131 pub const FIONREAD = IOCTL.IOR('f', 127, c_int);
4132 pub const IOCINQ = FIONREAD;
4133 pub const FIOQSIZE = IOCTL.IOR('f', 128, c_longlong); // loff_t -> __kernel_loff_t -> long long
4134
4135 pub const IOCGETP = IOCTL.IOR('t', 8, sgttyb);
4136 pub const IOCSETP = IOCTL.IOW('t', 9, sgttyb);
4137 pub const IOCSETN = IOCTL.IOW('t', 10, sgttyb);
4138
4139 pub const IOCSETC = IOCTL.IOW('t', 17, tchars);
4140 pub const IOCGETC = IOCTL.IOR('t', 18, tchars);
4141 pub const CGETS = IOCTL.IOR('t', 19, termios);
4142 pub const CSETS = IOCTL.IOW('t', 20, termios);
4143 pub const CSETSW = IOCTL.IOW('t', 21, termios);
4144 pub const CSETSF = IOCTL.IOW('t', 22, termios);
4145
4146 pub const CGETA = IOCTL.IOR('t', 23, termio);
4147 pub const CSETA = IOCTL.IOW('t', 24, termio);
4148 pub const CSETAW = IOCTL.IOW('t', 25, termio);
4149 pub const CSETAF = IOCTL.IOW('t', 28, termio);
4150
4151 pub const CSBRK = IOCTL.IO('t', 29);
4152 pub const CXONC = IOCTL.IO('t', 30);
4153 pub const CFLSH = IOCTL.IO('t', 31);
4154
4155 pub const IOCSWINSZ = IOCTL.IOW('t', 103, winsize);
4156 pub const IOCGWINSZ = IOCTL.IOR('t', 104, winsize);
4157 pub const IOCSTART = IOCTL.IO('t', 110);
4158 pub const IOCSTOP = IOCTL.IO('t', 111);
4159 pub const IOCOUTQ = IOCTL.IOR('t', 115, c_int);
4160
4161 pub const IOCGLTC = IOCTL.IOR('t', 116, ltchars);
4162 pub const IOCSLTC = IOCTL.IOW('t', 117, ltchars);
4163 pub const IOCSPGRP = IOCTL.IOW('t', 118, c_int);
4164 pub const IOCGPGRP = IOCTL.IOR('t', 119, c_int);
4165
4166 pub const IOCEXCL = 0x540c;
4167 pub const IOCNXCL = 0x540d;
4168 pub const IOCSCTTY = 0x540e;
4169
4170 pub const IOCSTI = 0x5412;
4171 pub const IOCMGET = 0x5415;
4172 pub const IOCMBIS = 0x5416;
4173 pub const IOCMBIC = 0x5417;
4174 pub const IOCMSET = 0x5418;
4175 pub const IOCM_LE = 0x001;
4176 pub const IOCM_DTR = 0x002;
4177 pub const IOCM_RTS = 0x004;
4178 pub const IOCM_ST = 0x008;
4179 pub const IOCM_SR = 0x010;
4180 pub const IOCM_CTS = 0x020;
4181 pub const IOCM_CAR = 0x040;
4182 pub const IOCM_RNG = 0x080;
4183 pub const IOCM_DSR = 0x100;
4184 pub const IOCM_CD = IOCM_CAR;
4185 pub const IOCM_RI = IOCM_RNG;
4186 pub const IOCM_OUT1 = 0x2000;
4187 pub const IOCM_OUT2 = 0x4000;
4188 pub const IOCM_LOOP = 0x8000;
4189
4190 pub const IOCGSOFTCAR = 0x5419;
4191 pub const IOCSSOFTCAR = 0x541a;
4192 pub const IOCLINUX = 0x541c;
4193 pub const IOCCONS = 0x541d;
4194 pub const IOCGSERIAL = 0x541e;
4195 pub const IOCSSERIAL = 0x541f;
4196 pub const IOCPKT = 0x5420;
4197 pub const IOCPKT_DATA = 0;
4198 pub const IOCPKT_FLUSHREAD = 1;
4199 pub const IOCPKT_FLUSHWRITE = 2;
4200 pub const IOCPKT_STOP = 4;
4201 pub const IOCPKT_START = 8;
4202 pub const IOCPKT_NOSTOP = 16;
4203 pub const IOCPKT_DOSTOP = 32;
4204 pub const IOCPKT_IOCTL = 64;
4205
4206 pub const IOCNOTTY = 0x5422;
4207 pub const IOCSETD = 0x5423;
4208 pub const IOCGETD = 0x5424;
4209 pub const CSBRKP = 0x5425;
40694210 pub const IOCSBRK = 0x5427;
40704211 pub const IOCCBRK = 0x5428;
4071 pub const IOCGSID = if (is_mips) 0x7416 else 0x5429;
4072 pub const IOCGRS485 = 0x542E;
4073 pub const IOCSRS485 = 0x542F;
4212 pub const IOCGSID = 0x5429;
4213 pub const IOCGRS485 = 0x542e;
4214 pub const IOCSRS485 = 0x542f;
4215 pub const IOCGPTN = IOCTL.IOR('T', 0x30, c_uint);
4216 pub const IOCSPTLCK = IOCTL.IOW('T', 0x31, c_int);
4217 pub const IOCGDEV = IOCTL.IOR('T', 0x32, c_uint);
4218 pub const IOCSIG = IOCTL.IOW('T', 0x36, c_int);
4219 pub const IOCVHANGUP = 0x5437;
4220 pub const IOCGPKT = IOCTL.IOR('T', 0x38, c_int);
4221 pub const IOCGPTLCK = IOCTL.IOR('T', 0x39, c_int);
4222 pub const IOCGEXCL = IOCTL.IOR('T', 0x40, c_int);
4223 pub const IOCGPTPEER = IOCTL.IO('T', 0x41);
4224 pub const IOCGISO7816 = IOCTL.IOR('T', 0x42, serial_iso7816);
4225 pub const IOCSISO7816 = IOCTL.IOWR('T', 0x43, serial_iso7816);
4226
4227 pub const IOCSERCONFIG = 0x5453;
4228 pub const IOCSERGWILD = 0x5454;
4229 pub const IOCSERSWILD = 0x5455;
4230 pub const IOCGLCKTRMIOS = 0x5456;
4231 pub const IOCSLCKTRMIOS = 0x5457;
4232 pub const IOCSERGSTRUCT = 0x5458;
4233 pub const IOCSERGETLSR = 0x5459;
4234 pub const IOCSER_TEMT = 0x01;
4235 pub const IOCSERGETMULTI = 0x545a;
4236 pub const IOCSERSETMULTI = 0x545b;
4237
4238 pub const IOCMIWAIT = 0x545c;
4239 pub const IOCGICOUNT = 0x545d;
4240} else if (is_sparc) struct {
4241 // Entries with double-underscore prefix have not been translated as they are unsupported.
4242
4243 pub const CGETA = IOCTL.IOR('T', 1, termio);
4244 pub const CSETA = IOCTL.IOW('T', 2, termio);
4245 pub const CSETAW = IOCTL.IOW('T', 3, termio);
4246 pub const CSETAF = IOCTL.IOW('T', 4, termio);
4247 pub const CSBRK = IOCTL.IO('T', 5);
4248 pub const CXONC = IOCTL.IO('T', 6);
4249 pub const CFLSH = IOCTL.IO('T', 7);
4250 pub const CGETS = IOCTL.IOR('T', 8, termios);
4251 pub const CSETS = IOCTL.IOW('T', 9, termios);
4252 pub const CSETSW = IOCTL.IOW('T', 10, termios);
4253 pub const CSETSF = IOCTL.IOW('T', 11, termios);
4254 pub const CGETS2 = IOCTL.IOR('T', 12, termios2);
4255 pub const CSETS2 = IOCTL.IOW('T', 13, termios2);
4256 pub const CSETSW2 = IOCTL.IOW('T', 14, termios2);
4257 pub const CSETSF2 = IOCTL.IOW('T', 15, termios2);
4258 pub const IOCGDEV = IOCTL.IOR('T', 0x32, c_uint);
4259 pub const IOCVHANGUP = IOCTL.IO('T', 0x37);
4260 pub const IOCGPKT = IOCTL.IOR('T', 0x38, c_int);
4261 pub const IOCGPTLCK = IOCTL.IOR('T', 0x39, c_int);
4262 pub const IOCGEXCL = IOCTL.IOR('T', 0x40, c_int);
4263 pub const IOCGRS485 = IOCTL.IOR('T', 0x41, serial_rs485);
4264 pub const IOCSRS485 = IOCTL.IOWR('T', 0x42, serial_rs485);
4265 pub const IOCGISO7816 = IOCTL.IOR('T', 0x43, serial_iso7816);
4266 pub const IOCSISO7816 = IOCTL.IOWR('T', 0x44, serial_iso7816);
4267
4268 pub const IOCGETD = IOCTL.IOR('t', 0, c_int);
4269 pub const IOCSETD = IOCTL.IOW('t', 1, c_int);
4270 pub const IOCEXCL = IOCTL.IO('t', 13);
4271 pub const IOCNXCL = IOCTL.IO('t', 14);
4272 pub const IOCCONS = IOCTL.IO('t', 36);
4273 pub const IOCGSOFTCAR = IOCTL.IOR('t', 100, c_int);
4274 pub const IOCSSOFTCAR = IOCTL.IOW('t', 101, c_int);
4275 pub const IOCSWINSZ = IOCTL.IOW('t', 103, winsize);
4276 pub const IOCGWINSZ = IOCTL.IOR('t', 104, winsize);
4277 pub const IOCMGET = IOCTL.IOR('t', 106, c_int);
4278 pub const IOCMBIC = IOCTL.IOW('t', 107, c_int);
4279 pub const IOCMBIS = IOCTL.IOW('t', 108, c_int);
4280 pub const IOCMSET = IOCTL.IOW('t', 109, c_int);
4281 pub const IOCSTART = IOCTL.IO('t', 110);
4282 pub const IOCSTOP = IOCTL.IO('t', 111);
4283 pub const IOCPKT = IOCTL.IOW('t', 112, c_int);
4284 pub const IOCNOTTY = IOCTL.IO('t', 113);
4285 pub const IOCSTI = IOCTL.IOW('t', 114, c_char);
4286 pub const IOCOUTQ = IOCTL.IOR('t', 115, c_int);
4287 pub const IOCCBRK = IOCTL.IO('t', 122);
4288 pub const IOCSBRK = IOCTL.IO('t', 123);
4289 pub const IOCSPGRP = IOCTL.IOW('t', 130, c_int);
4290 pub const IOCGPGRP = IOCTL.IOR('t', 131, c_int);
4291 pub const IOCSCTTY = IOCTL.IO('t', 132);
4292 pub const IOCGSID = IOCTL.IOR('t', 133, c_int);
4293 pub const IOCGPTN = IOCTL.IOR('t', 134, c_uint);
4294 pub const IOCSPTLCK = IOCTL.IOW('t', 135, c_int);
4295 pub const IOCSIG = IOCTL.IOW('t', 136, c_int);
4296 pub const IOCGPTPEER = IOCTL.IO('t', 137);
4297
4298 pub const FIOCLEX = IOCTL.IO('f', 1);
4299 pub const FIONCLEX = IOCTL.IO('f', 2);
4300 pub const FIOASYNC = IOCTL.IOW('f', 125, c_int);
4301 pub const FIONBIO = IOCTL.IOW('f', 126, c_int);
4302 pub const FIONREAD = IOCTL.IOR('f', 127, c_int);
4303 pub const IOCINQ = FIONREAD;
4304 pub const FIOQSIZE = IOCTL.IOR('f', 128, c_longlong); // loff_t -> __kernel_loff_t -> long long
4305
4306 pub const IOCLINUX = 0x541c;
4307 pub const IOCGSERIAL = 0x541e;
4308 pub const IOCSSERIAL = 0x541f;
4309 pub const CSBRKP = 0x5425;
4310 pub const IOCSERCONFIG = 0x5453;
4311 pub const IOCSERGWILD = 0x5454;
4312 pub const IOCSERSWILD = 0x5455;
4313 pub const IOCGLCKTRMIOS = 0x5456;
4314 pub const IOCSLCKTRMIOS = 0x5457;
4315 pub const IOCSERGSTRUCT = 0x5458;
4316 pub const IOCSERGETLSR = 0x5459;
4317 pub const IOCSERGETMULTI = 0x545a;
4318 pub const IOCSERSETMULTI = 0x545b;
4319 pub const IOCMIWAIT = 0x545c;
4320 pub const IOCGICOUNT = 0x545d;
4321
4322 pub const IOCPKT_DATA = 0;
4323 pub const IOCPKT_FLUSHREAD = 1;
4324 pub const IOCPKT_FLUSHWRITE = 2;
4325 pub const IOCPKT_STOP = 4;
4326 pub const IOCPKT_START = 8;
4327 pub const IOCPKT_NOSTOP = 16;
4328 pub const IOCPKT_DOSTOP = 32;
4329 pub const IOCPKT_IOCTL = 64;
4330} else struct {
4331 pub const CGETS = 0x5401;
4332 pub const CSETS = 0x5402;
4333 pub const CSETSW = 0x5403;
4334 pub const CSETSF = 0x5404;
4335 pub const CGETA = 0x5405;
4336 pub const CSETA = 0x5406;
4337 pub const CSETAW = 0x5407;
4338 pub const CSETAF = 0x5408;
4339 pub const CSBRK = 0x5409;
4340 pub const CXONC = 0x540a;
4341 pub const CFLSH = 0x540b;
4342 pub const IOCEXCL = 0x540c;
4343 pub const IOCNXCL = 0x540d;
4344 pub const IOCSCTTY = 0x540e;
4345 pub const IOCGPGRP = 0x540f;
4346 pub const IOCSPGRP = 0x5410;
4347 pub const IOCOUTQ = 0x5411;
4348 pub const IOCSTI = 0x5412;
4349 pub const IOCGWINSZ = 0x5413;
4350 pub const IOCSWINSZ = 0x5414;
4351 pub const IOCMGET = 0x5415;
4352 pub const IOCMBIS = 0x5416;
4353 pub const IOCMBIC = 0x5417;
4354 pub const IOCMSET = 0x5418;
4355 pub const IOCGSOFTCAR = 0x5419;
4356 pub const IOCSSOFTCAR = 0x541a;
4357 pub const FIONREAD = 0x541b;
4358 pub const IOCINQ = FIONREAD;
4359 pub const IOCLINUX = 0x541c;
4360 pub const IOCCONS = 0x541d;
4361 pub const IOCGSERIAL = 0x541e;
4362 pub const IOCSSERIAL = 0x541f;
4363 pub const IOCPKT = 0x5420;
4364 pub const FIONBIO = 0x5421;
4365 pub const IOCNOTTY = 0x5422;
4366 pub const IOCSETD = 0x5423;
4367 pub const IOCGETD = 0x5424;
4368 pub const CSBRKP = 0x5425;
4369 pub const IOCSBRK = 0x5427;
4370 pub const IOCCBRK = 0x5428;
4371 pub const IOCGSID = 0x5429;
4372 pub const CGETS2 = IOCTL.IOR('T', 0x2a, termios2);
4373 pub const CSETS2 = IOCTL.IOW('T', 0x2b, termios2);
4374 pub const CSETSW2 = IOCTL.IOW('T', 0x2c, termios2);
4375 pub const CSETSF2 = IOCTL.IOW('T', 0x2d, termios2);
4376 pub const IOCGRS485 = 0x542e;
4377 pub const IOCSRS485 = 0x542f;
40744378 pub const IOCGPTN = IOCTL.IOR('T', 0x30, c_uint);
40754379 pub const IOCSPTLCK = IOCTL.IOW('T', 0x31, c_int);
40764380 pub const IOCGDEV = IOCTL.IOR('T', 0x32, c_uint);
......@@ -4083,6 +4387,93 @@ pub const T = struct {
40834387 pub const IOCGPKT = IOCTL.IOR('T', 0x38, c_int);
40844388 pub const IOCGPTLCK = IOCTL.IOR('T', 0x39, c_int);
40854389 pub const IOCGEXCL = IOCTL.IOR('T', 0x40, c_int);
4390 pub const IOCGPTPEER = IOCTL.IO('T', 0x41);
4391 pub const IOCGISO7816 = IOCTL.IOR('T', 0x42, serial_iso7816);
4392 pub const IOCSISO7816 = IOCTL.IOWR('T', 0x43, serial_iso7816);
4393
4394 pub const FIONCLEX = 0x5450;
4395 pub const FIOCLEX = 0x5451;
4396 pub const FIOASYNC = 0x5452;
4397 pub const IOCSERCONFIG = 0x5453;
4398 pub const IOCSERGWILD = 0x5454;
4399 pub const IOCSERSWILD = 0x5455;
4400 pub const IOCGLCKTRMIOS = 0x5456;
4401 pub const IOCSLCKTRMIOS = 0x5457;
4402 pub const IOCSERGSTRUCT = 0x5458;
4403 pub const IOCSERGETLSR = 0x5459;
4404 pub const IOCSERGETMULTI = 0x545a;
4405 pub const IOCSERSETMULTI = 0x545b;
4406
4407 pub const IOCMIWAIT = 0x545c;
4408 pub const IOCGICOUNT = 0x545d;
4409
4410 pub const FIOQSIZE = switch (native_arch) {
4411 .arm,
4412 .armeb,
4413 .thumb,
4414 .thumbeb,
4415 .m68k,
4416 .s390x,
4417 => 0x545e,
4418 else => 0x5460,
4419 };
4420
4421 pub const IOCPKT_DATA = 0;
4422 pub const IOCPKT_FLUSHREAD = 1;
4423 pub const IOCPKT_FLUSHWRITE = 2;
4424 pub const IOCPKT_STOP = 4;
4425 pub const IOCPKT_START = 8;
4426 pub const IOCPKT_NOSTOP = 16;
4427 pub const IOCPKT_DOSTOP = 32;
4428 pub const IOCPKT_IOCTL = 64;
4429
4430 pub const IOCSER_TEMT = 0x01;
4431};
4432
4433pub const serial_rs485 = extern struct {
4434 flags: u32,
4435 delay_rts_before_send: u32,
4436 delay_rts_after_send: u32,
4437 extra: extern union {
4438 _pad1: [5]u32,
4439 s: extern struct {
4440 addr_recv: u8,
4441 addr_dest: u8,
4442 _pad2: [2]u8,
4443 _pad3: [4]u32,
4444 },
4445 },
4446};
4447
4448pub const serial_iso7816 = extern struct {
4449 flags: u32,
4450 tg: u32,
4451 sc_fi: u32,
4452 sc_di: u32,
4453 clk: u32,
4454 _reserved: [5]u32,
4455};
4456
4457pub const SER = struct {
4458 pub const RS485 = struct {
4459 pub const ENABLED = 1 << 0;
4460 pub const RTS_ON_SEND = 1 << 1;
4461 pub const RTS_AFTER_SEND = 1 << 2;
4462 pub const RX_DURING_TX = 1 << 4;
4463 pub const TERMINATE_BUS = 1 << 5;
4464 pub const ADDRB = 1 << 6;
4465 pub const ADDR_RECV = 1 << 7;
4466 pub const ADDR_DEST = 1 << 8;
4467 };
4468
4469 pub const ISO7816 = struct {
4470 pub const ENABLED = 1 << 0;
4471 pub const T_PARAM = 0x0f << 4;
4472
4473 pub fn T(t: anytype) @TypeOf(t) {
4474 return (t & 0x0f) << 4;
4475 }
4476 };
40864477};
40874478
40884479pub const EPOLL = struct {
......@@ -5885,319 +6276,507 @@ pub const rusage = extern struct {
58856276 pub const THREAD = 1;
58866277};
58876278
5888pub const NCCS = switch (native_arch) {
5889 .powerpc, .powerpcle, .powerpc64, .powerpc64le => 19,
5890 else => 32,
5891};
5892
5893pub const speed_t = switch (native_arch) {
5894 .powerpc, .powerpcle, .powerpc64, .powerpc64le => enum(u32) {
5895 B0 = 0o0000000,
5896 B50 = 0o0000001,
5897 B75 = 0o0000002,
5898 B110 = 0o0000003,
5899 B134 = 0o0000004,
5900 B150 = 0o0000005,
5901 B200 = 0o0000006,
5902 B300 = 0o0000007,
5903 B600 = 0o0000010,
5904 B1200 = 0o0000011,
5905 B1800 = 0o0000012,
5906 B2400 = 0o0000013,
5907 B4800 = 0o0000014,
5908 B9600 = 0o0000015,
5909 B19200 = 0o0000016,
5910 B38400 = 0o0000017,
5911
5912 B57600 = 0o00020,
5913 B115200 = 0o00021,
5914 B230400 = 0o00022,
5915 B460800 = 0o00023,
5916 B500000 = 0o00024,
5917 B576000 = 0o00025,
5918 B921600 = 0o00026,
5919 B1000000 = 0o00027,
5920 B1152000 = 0o00030,
5921 B1500000 = 0o00031,
5922 B2000000 = 0o00032,
5923 B2500000 = 0o00033,
5924 B3000000 = 0o00034,
5925 B3500000 = 0o00035,
5926 B4000000 = 0o00036,
5927 },
5928 else => enum(u32) {
5929 B0 = 0o0000000,
5930 B50 = 0o0000001,
5931 B75 = 0o0000002,
5932 B110 = 0o0000003,
5933 B134 = 0o0000004,
5934 B150 = 0o0000005,
5935 B200 = 0o0000006,
5936 B300 = 0o0000007,
5937 B600 = 0o0000010,
5938 B1200 = 0o0000011,
5939 B1800 = 0o0000012,
5940 B2400 = 0o0000013,
5941 B4800 = 0o0000014,
5942 B9600 = 0o0000015,
5943 B19200 = 0o0000016,
5944 B38400 = 0o0000017,
5945
5946 B57600 = 0o0010001,
5947 B115200 = 0o0010002,
5948 B230400 = 0o0010003,
5949 B460800 = 0o0010004,
5950 B500000 = 0o0010005,
5951 B576000 = 0o0010006,
5952 B921600 = 0o0010007,
5953 B1000000 = 0o0010010,
5954 B1152000 = 0o0010011,
5955 B1500000 = 0o0010012,
5956 B2000000 = 0o0010013,
5957 B2500000 = 0o0010014,
5958 B3000000 = 0o0010015,
5959 B3500000 = 0o0010016,
5960 B4000000 = 0o0010017,
5961 },
5962};
5963
5964pub const tc_iflag_t = switch (native_arch) {
5965 .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
5966 IGNBRK: bool = false,
5967 BRKINT: bool = false,
5968 IGNPAR: bool = false,
5969 PARMRK: bool = false,
5970 INPCK: bool = false,
5971 ISTRIP: bool = false,
5972 INLCR: bool = false,
5973 IGNCR: bool = false,
5974 ICRNL: bool = false,
5975 IXON: bool = false,
5976 IXOFF: bool = false,
5977 IXANY: bool = false,
5978 IUCLC: bool = false,
5979 IMAXBEL: bool = false,
5980 IUTF8: bool = false,
5981 _: u17 = 0,
5982 },
5983 else => packed struct(u32) {
5984 IGNBRK: bool = false,
5985 BRKINT: bool = false,
5986 IGNPAR: bool = false,
5987 PARMRK: bool = false,
5988 INPCK: bool = false,
5989 ISTRIP: bool = false,
5990 INLCR: bool = false,
5991 IGNCR: bool = false,
5992 ICRNL: bool = false,
5993 IUCLC: bool = false,
5994 IXON: bool = false,
5995 IXANY: bool = false,
5996 IXOFF: bool = false,
5997 IMAXBEL: bool = false,
5998 IUTF8: bool = false,
5999 _: u17 = 0,
6000 },
6001};
6002
6003pub const tc_oflag_t = switch (native_arch) {
6004 .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
6005 OPOST: bool = false,
6006 ONLCR: bool = false,
6007 OLCUC: bool = false,
6008 OCRNL: bool = false,
6009 ONOCR: bool = false,
6010 ONLRET: bool = false,
6011 OFILL: bool = false,
6012 OFDEL: bool = false,
6013 NLDLY: u2 = 0,
6014 TABDLY: u2 = 0,
6015 CRDLY: u2 = 0,
6016 FFDLY: u1 = 0,
6017 BSDLY: u1 = 0,
6018 VTDLY: u1 = 0,
6019 _: u15 = 0,
6020 },
6021 else => packed struct(u32) {
6022 OPOST: bool = false,
6023 OLCUC: bool = false,
6024 ONLCR: bool = false,
6025 OCRNL: bool = false,
6026 ONOCR: bool = false,
6027 ONLRET: bool = false,
6028 OFILL: bool = false,
6029 OFDEL: bool = false,
6030 NLDLY: u1 = 0,
6031 CRDLY: u2 = 0,
6032 TABDLY: u2 = 0,
6033 BSDLY: u1 = 0,
6034 VTDLY: u1 = 0,
6035 FFDLY: u1 = 0,
6036 _: u16 = 0,
6037 },
6038};
6039
6040pub const CSIZE = enum(u2) { CS5, CS6, CS7, CS8 };
6041
6042pub const tc_cflag_t = switch (native_arch) {
6043 .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
6044 _0: u8 = 0,
6045 CSIZE: CSIZE = .CS5,
6046 CSTOPB: bool = false,
6047 CREAD: bool = false,
6048 PARENB: bool = false,
6049 PARODD: bool = false,
6050 HUPCL: bool = false,
6051 CLOCAL: bool = false,
6052 _: u16 = 0,
6053 },
6054 else => packed struct(u32) {
6055 _0: u4 = 0,
6056 CSIZE: CSIZE = .CS5,
6057 CSTOPB: bool = false,
6058 CREAD: bool = false,
6059 PARENB: bool = false,
6060 PARODD: bool = false,
6061 HUPCL: bool = false,
6062 CLOCAL: bool = false,
6063 _: u20 = 0,
6064 },
6065};
6066
6067pub const tc_lflag_t = switch (native_arch) {
6068 .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
6069 _0: u1 = 0,
6070 ECHOE: bool = false,
6071 ECHOK: bool = false,
6072 ECHO: bool = false,
6073 ECHONL: bool = false,
6074 _5: u2 = 0,
6075 ISIG: bool = false,
6076 ICANON: bool = false,
6077 _9: u1 = 0,
6078 IEXTEN: bool = false,
6079 _11: u11 = 0,
6080 TOSTOP: bool = false,
6081 _23: u8 = 0,
6082 NOFLSH: bool = false,
6083 },
6084 .mips, .mipsel, .mips64, .mips64el => packed struct(u32) {
6085 ISIG: bool = false,
6086 ICANON: bool = false,
6087 _2: u1 = 0,
6088 ECHO: bool = false,
6089 ECHOE: bool = false,
6090 ECHOK: bool = false,
6091 ECHONL: bool = false,
6092 NOFLSH: bool = false,
6093 IEXTEN: bool = false,
6094 _9: u6 = 0,
6095 TOSTOP: bool = false,
6096 _: u16 = 0,
6097 },
6098 else => packed struct(u32) {
6099 ISIG: bool = false,
6100 ICANON: bool = false,
6101 _2: u1 = 0,
6102 ECHO: bool = false,
6103 ECHOE: bool = false,
6104 ECHOK: bool = false,
6105 ECHONL: bool = false,
6106 NOFLSH: bool = false,
6107 TOSTOP: bool = false,
6108 _9: u6 = 0,
6109 IEXTEN: bool = false,
6110 _: u16 = 0,
6111 },
6279pub const NCC = if (is_ppc) 10 else 8;
6280pub const NCCS = if (is_mips) 32 else if (is_ppc) 19 else if (is_sparc) 17 else 32;
6281
6282pub const speed_t = if (is_ppc) enum(c_uint) {
6283 B0 = 0x0000000,
6284 B50 = 0x0000001,
6285 B75 = 0x0000002,
6286 B110 = 0x0000003,
6287 B134 = 0x0000004,
6288 B150 = 0x0000005,
6289 B200 = 0x0000006,
6290 B300 = 0x0000007,
6291 B600 = 0x0000008,
6292 B1200 = 0x0000009,
6293 B1800 = 0x000000a,
6294 B2400 = 0x000000b,
6295 B4800 = 0x000000c,
6296 B9600 = 0x000000d,
6297 B19200 = 0x000000e,
6298 B38400 = 0x000000f,
6299
6300 B57600 = 0x00000010,
6301 B115200 = 0x00000011,
6302 B230400 = 0x00000012,
6303 B460800 = 0x00000013,
6304 B500000 = 0x00000014,
6305 B576000 = 0x00000015,
6306 B921600 = 0x00000016,
6307 B1000000 = 0x00000017,
6308 B1152000 = 0x00000018,
6309 B1500000 = 0x00000019,
6310 B2000000 = 0x0000001a,
6311 B2500000 = 0x0000001b,
6312 B3000000 = 0x0000001c,
6313 B3500000 = 0x0000001d,
6314 B4000000 = 0x0000001e,
6315
6316 pub const EXTA = speed_t.B19200;
6317 pub const EXTB = speed_t.B38400;
6318} else if (is_sparc) enum(c_uint) {
6319 B0 = 0x0000000,
6320 B50 = 0x0000001,
6321 B75 = 0x0000002,
6322 B110 = 0x0000003,
6323 B134 = 0x0000004,
6324 B150 = 0x0000005,
6325 B200 = 0x0000006,
6326 B300 = 0x0000007,
6327 B600 = 0x0000008,
6328 B1200 = 0x0000009,
6329 B1800 = 0x000000a,
6330 B2400 = 0x000000b,
6331 B4800 = 0x000000c,
6332 B9600 = 0x000000d,
6333 B19200 = 0x000000e,
6334 B38400 = 0x000000f,
6335
6336 B57600 = 0x00001001,
6337 B115200 = 0x00001002,
6338 B230400 = 0x00001003,
6339 B460800 = 0x00001004,
6340 B76800 = 0x00001005,
6341 B153600 = 0x00001006,
6342 B307200 = 0x00001007,
6343 B614400 = 0x00001008,
6344 B921600 = 0x00001009,
6345 B500000 = 0x0000100a,
6346 B576000 = 0x0000100b,
6347 B1000000 = 0x0000100c,
6348 B1152000 = 0x0000100d,
6349 B1500000 = 0x0000100e,
6350 B2000000 = 0x0000100f,
6351
6352 pub const EXTA = speed_t.B19200;
6353 pub const EXTB = speed_t.B38400;
6354} else enum(c_uint) {
6355 B0 = 0x0000000,
6356 B50 = 0x0000001,
6357 B75 = 0x0000002,
6358 B110 = 0x0000003,
6359 B134 = 0x0000004,
6360 B150 = 0x0000005,
6361 B200 = 0x0000006,
6362 B300 = 0x0000007,
6363 B600 = 0x0000008,
6364 B1200 = 0x0000009,
6365 B1800 = 0x000000a,
6366 B2400 = 0x000000b,
6367 B4800 = 0x000000c,
6368 B9600 = 0x000000d,
6369 B19200 = 0x000000e,
6370 B38400 = 0x000000f,
6371
6372 B57600 = 0x00001001,
6373 B115200 = 0x00001002,
6374 B230400 = 0x00001003,
6375 B460800 = 0x00001004,
6376 B500000 = 0x00001005,
6377 B576000 = 0x00001006,
6378 B921600 = 0x00001007,
6379 B1000000 = 0x00001008,
6380 B1152000 = 0x00001009,
6381 B1500000 = 0x0000100a,
6382 B2000000 = 0x0000100b,
6383 B2500000 = 0x0000100c,
6384 B3000000 = 0x0000100d,
6385 B3500000 = 0x0000100e,
6386 B4000000 = 0x0000100f,
6387
6388 pub const EXTA = speed_t.B19200;
6389 pub const EXTB = speed_t.B38400;
6390};
6391
6392pub const tcflag_t = if (native_arch == .sparc) c_ulong else c_uint;
6393
6394pub const tc_iflag_t = if (is_ppc) packed struct(tcflag_t) {
6395 IGNBRK: bool = false,
6396 BRKINT: bool = false,
6397 IGNPAR: bool = false,
6398 PARMRK: bool = false,
6399 INPCK: bool = false,
6400 ISTRIP: bool = false,
6401 INLCR: bool = false,
6402 IGNCR: bool = false,
6403 ICRNL: bool = false,
6404 IXON: bool = false,
6405 IXOFF: bool = false,
6406 IXANY: bool = false,
6407 IUCLC: bool = false,
6408 IMAXBEL: bool = false,
6409 IUTF8: bool = false,
6410 _15: u17 = 0,
6411} else packed struct(tcflag_t) {
6412 IGNBRK: bool = false,
6413 BRKINT: bool = false,
6414 IGNPAR: bool = false,
6415 PARMRK: bool = false,
6416 INPCK: bool = false,
6417 ISTRIP: bool = false,
6418 INLCR: bool = false,
6419 IGNCR: bool = false,
6420 ICRNL: bool = false,
6421 IUCLC: bool = false,
6422 IXON: bool = false,
6423 IXANY: bool = false,
6424 IXOFF: bool = false,
6425 IMAXBEL: bool = false,
6426 IUTF8: bool = false,
6427 _15: u17 = 0,
6428};
6429
6430pub const NLDLY = if (is_ppc) enum(u2) {
6431 NL0 = 0,
6432 NL1 = 1,
6433 NL2 = 2,
6434 NL3 = 3,
6435} else enum(u1) {
6436 NL0 = 0,
6437 NL1 = 1,
6438};
6439
6440pub const CRDLY = enum(u2) {
6441 CR0 = 0,
6442 CR1 = 1,
6443 CR2 = 2,
6444 CR3 = 3,
6445};
6446
6447pub const TABDLY = enum(u2) {
6448 TAB0 = 0,
6449 TAB1 = 1,
6450 TAB2 = 2,
6451 TAB3 = 3,
6452
6453 pub const XTABS = TABDLY.TAB3;
6454};
6455
6456pub const BSDLY = enum(u1) {
6457 BS0 = 0,
6458 BS1 = 1,
6459};
6460
6461pub const VTDLY = enum(u1) {
6462 VT0 = 0,
6463 VT1 = 1,
6464};
6465
6466pub const FFDLY = enum(u1) {
6467 FF0 = 0,
6468 FF1 = 1,
6469};
6470
6471pub const tc_oflag_t = if (is_ppc) packed struct(tcflag_t) {
6472 OPOST: bool = false,
6473 ONLCR: bool = false,
6474 OLCUC: bool = false,
6475 OCRNL: bool = false,
6476 ONOCR: bool = false,
6477 ONLRET: bool = false,
6478 OFILL: bool = false,
6479 OFDEL: bool = false,
6480 NLDLY: NLDLY = 0,
6481 TABDLY: TABDLY = 0,
6482 CRDLY: CRDLY = 0,
6483 FFDLY: FFDLY = 0,
6484 BSDLY: BSDLY = 0,
6485 VTDLY: VTDLY = 0,
6486 _17: u15 = 0,
6487} else if (is_sparc) packed struct(tcflag_t) {
6488 OPOST: bool = false,
6489 OLCUC: bool = false,
6490 ONLCR: bool = false,
6491 OCRNL: bool = false,
6492 ONOCR: bool = false,
6493 ONLRET: bool = false,
6494 OFILL: bool = false,
6495 OFDEL: bool = false,
6496 NLDLY: NLDLY = .NL0,
6497 CRDLY: CRDLY = .CR0,
6498 TABDLY: TABDLY = .TAB0,
6499 BSDLY: BSDLY = .BS0,
6500 VTDLY: VTDLY = .VT0,
6501 FFDLY: FFDLY = .FF0,
6502 PAGEOUT: bool = false,
6503 WRAP: bool = false,
6504 _18: u14 = 0,
6505} else packed struct(tcflag_t) {
6506 OPOST: bool = false,
6507 OLCUC: bool = false,
6508 ONLCR: bool = false,
6509 OCRNL: bool = false,
6510 ONOCR: bool = false,
6511 ONLRET: bool = false,
6512 OFILL: bool = false,
6513 OFDEL: bool = false,
6514 NLDLY: NLDLY = .NL0,
6515 CRDLY: CRDLY = .CR0,
6516 TABDLY: TABDLY = .TAB0,
6517 BSDLY: BSDLY = .BS0,
6518 VTDLY: VTDLY = .VT0,
6519 FFDLY: FFDLY = .FF0,
6520 _16: u16 = 0,
6521};
6522
6523pub const CSIZE = enum(u2) {
6524 CS5 = 0,
6525 CS6 = 1,
6526 CS7 = 2,
6527 CS8 = 3,
6528};
6529
6530pub const tc_cflag_t = if (is_ppc) packed struct(tcflag_t) {
6531 _0: u8 = 0,
6532 CSIZE: CSIZE = .CS5,
6533 CSTOPB: bool = false,
6534 CREAD: bool = false,
6535 PARENB: bool = false,
6536 PARODD: bool = false,
6537 HUPCL: bool = false,
6538 CLOCAL: bool = false,
6539 _16: u13 = 0,
6540 ADDRB: bool = false,
6541 CMSPAR: bool = false,
6542 CRTSCTS: bool = false,
6543} else packed struct(tcflag_t) {
6544 _0: u4 = 0,
6545 CSIZE: CSIZE = .CS5,
6546 CSTOPB: bool = false,
6547 CREAD: bool = false,
6548 PARENB: bool = false,
6549 PARODD: bool = false,
6550 HUPCL: bool = false,
6551 CLOCAL: bool = false,
6552 _12: u17 = 0,
6553 ADDRB: bool = false,
6554 CMSPAR: bool = false,
6555 CRTSCTS: bool = false,
6556};
6557
6558pub const tc_lflag_t = if (is_mips) packed struct(tcflag_t) {
6559 ISIG: bool = false,
6560 ICANON: bool = false,
6561 XCASE: bool = false,
6562 ECHO: bool = false,
6563 ECHOE: bool = false,
6564 ECHOK: bool = false,
6565 ECHONL: bool = false,
6566 NOFLSH: bool = false,
6567 IEXTEN: bool = false,
6568 ECHOCTL: bool = false,
6569 ECHOPRT: bool = false,
6570 ECHOKE: bool = false,
6571 _12: u1 = 0,
6572 FLUSHO: bool = false,
6573 PENDIN: bool = false,
6574 TOSTOP: bool = false,
6575 EXTPROC: bool = false,
6576 _17: u16 = 0,
6577} else if (is_ppc) packed struct(tcflag_t) {
6578 ECHOKE: bool = false,
6579 ECHOE: bool = false,
6580 ECHOK: bool = false,
6581 ECHO: bool = false,
6582 ECHONL: bool = false,
6583 ECHOPRT: bool = false,
6584 ECHOCTL: bool = false,
6585 ISIG: bool = false,
6586 ICANON: bool = false,
6587 _9: u1 = 0,
6588 IEXTEN: bool = false,
6589 _11: u3 = 0,
6590 XCASE: bool = false,
6591 _15: u7 = 0,
6592 TOSTOP: bool = false,
6593 FLUSHO: bool = false,
6594 _24: u4 = 0,
6595 EXTPROC: bool = false,
6596 PENDIN: bool = false,
6597 _30: u1 = 0,
6598 NOFLSH: bool = false,
6599} else if (is_sparc) packed struct(tcflag_t) {
6600 ISIG: bool = false,
6601 ICANON: bool = false,
6602 XCASE: bool = false,
6603 ECHO: bool = false,
6604 ECHOE: bool = false,
6605 ECHOK: bool = false,
6606 ECHONL: bool = false,
6607 NOFLSH: bool = false,
6608 TOSTOP: bool = false,
6609 ECHOCTL: bool = false,
6610 ECHOPRT: bool = false,
6611 ECHOKE: bool = false,
6612 DEFECHO: bool = false,
6613 FLUSHO: bool = false,
6614 PENDIN: bool = false,
6615 IEXTEN: bool = false,
6616 EXTPROC: bool = false,
6617 _17: u15 = 0,
6618} else packed struct(tcflag_t) {
6619 ISIG: bool = false,
6620 ICANON: bool = false,
6621 XCASE: bool = false,
6622 ECHO: bool = false,
6623 ECHOE: bool = false,
6624 ECHOK: bool = false,
6625 ECHONL: bool = false,
6626 NOFLSH: bool = false,
6627 TOSTOP: bool = false,
6628 ECHOCTL: bool = false,
6629 ECHOPRT: bool = false,
6630 ECHOKE: bool = false,
6631 FLUSHO: bool = false,
6632 _13: u1 = 0,
6633 PENDIN: bool = false,
6634 IEXTEN: bool = false,
6635 EXTPROC: bool = false,
6636 _17: u15 = 0,
61126637};
61136638
61146639pub const cc_t = u8;
61156640
61166641/// Indices into the `cc` array in the `termios` struct.
6117pub const V = switch (native_arch) {
6118 .mips, .mipsel, .mips64, .mips64el => enum {
6119 INTR,
6120 QUIT,
6121 ERASE,
6122 KILL,
6123 MIN,
6124 TIME,
6125 EOL2,
6126 SWTC,
6127 START,
6128 STOP,
6129 SUSP,
6130 reserved,
6131 REPRINT,
6132 DISCARD,
6133 WERASE,
6134 LNEXT,
6135 EOF,
6136 EOL,
6137 },
6138 .powerpc, .powerpcle, .powerpc64, .powerpc64le => enum {
6139 INTR,
6140 QUIT,
6141 ERASE,
6142 KILL,
6143 EOF,
6144 MIN,
6145 EOL,
6146 TIME,
6147 EOL2,
6148 SWTC,
6149 WERASE,
6150 REPRINT,
6151 SUSP,
6152 START,
6153 STOP,
6154 LNEXT,
6155 DISCARD,
6156 },
6157 else => enum {
6158 INTR,
6159 QUIT,
6160 ERASE,
6161 KILL,
6162 EOF,
6163 TIME,
6164 MIN,
6165 SWTC,
6166 START,
6167 STOP,
6168 SUSP,
6169 EOL,
6170 REPRINT,
6171 DISCARD,
6172 WERASE,
6173 LNEXT,
6174 EOL2,
6175 },
6642pub const V = if (is_mips) enum(u32) {
6643 INTR = 0,
6644 QUIT = 1,
6645 ERASE = 2,
6646 KILL = 3,
6647 MIN = 4,
6648 TIME = 5,
6649 EOL2 = 6,
6650 SWTC = 7,
6651 START = 8,
6652 STOP = 9,
6653 SUSP = 10,
6654 REPRINT = 12,
6655 DISCARD = 13,
6656 WERASE = 14,
6657 LNEXT = 15,
6658 EOF = 16,
6659 EOL = 17,
6660} else if (is_ppc) enum(u32) {
6661 INTR = 0,
6662 QUIT = 1,
6663 ERASE = 2,
6664 KILL = 3,
6665 EOF = 4,
6666 MIN = 5,
6667 EOL = 6,
6668 TIME = 7,
6669 EOL2 = 8,
6670 SWTC = 9,
6671 WERASE = 10,
6672 REPRINT = 11,
6673 SUSP = 12,
6674 START = 13,
6675 STOP = 14,
6676 LNEXT = 15,
6677 DISCARD = 16,
6678} else enum(u32) {
6679 INTR = 0,
6680 QUIT = 1,
6681 ERASE = 2,
6682 KILL = 3,
6683 EOF = 4,
6684 TIME = 5,
6685 MIN = 6,
6686 SWTC = 7,
6687 START = 8,
6688 STOP = 9,
6689 SUSP = 10,
6690 EOL = 11,
6691 REPRINT = 12,
6692 DISCARD = 13,
6693 WERASE = 14,
6694 LNEXT = 15,
6695 EOL2 = 16,
61766696};
61776697
61786698pub const TCSA = std.posix.TCSA;
61796699
6180pub const termios = switch (native_arch) {
6181 .powerpc, .powerpcle, .powerpc64, .powerpc64le => extern struct {
6182 iflag: tc_iflag_t,
6183 oflag: tc_oflag_t,
6184 cflag: tc_cflag_t,
6185 lflag: tc_lflag_t,
6186 cc: [NCCS]cc_t,
6187 line: cc_t,
6188 ispeed: speed_t,
6189 ospeed: speed_t,
6190 },
6191 else => extern struct {
6192 iflag: tc_iflag_t,
6193 oflag: tc_oflag_t,
6194 cflag: tc_cflag_t,
6195 lflag: tc_lflag_t,
6196 line: cc_t,
6197 cc: [NCCS]cc_t,
6198 ispeed: speed_t,
6199 ospeed: speed_t,
6200 },
6700pub const sgttyb = if (is_mips or is_ppc or is_sparc) extern struct {
6701 ispeed: c_char,
6702 ospeed: c_char,
6703 erase: c_char,
6704 kill: c_char,
6705 flags: if (is_mips) c_int else c_short,
6706} else void;
6707
6708pub const tchars = if (is_mips or is_ppc or is_sparc) extern struct {
6709 intrc: c_char,
6710 quitc: c_char,
6711 startc: c_char,
6712 stopc: c_char,
6713 eofc: c_char,
6714 brkc: c_char,
6715} else void;
6716
6717pub const ltchars = if (is_mips or is_ppc or is_sparc) extern struct {
6718 suspc: c_char,
6719 dsuspc: c_char,
6720 rprntc: c_char,
6721 flushc: c_char,
6722 werasc: c_char,
6723 lnextc: c_char,
6724} else void;
6725
6726pub const termio = extern struct {
6727 iflag: c_ushort,
6728 oflag: c_ushort,
6729 cflag: c_ushort,
6730 lflag: c_ushort,
6731 line: if (is_mips) c_char else u8,
6732 cc: [if (is_mips) NCCS else NCC]u8,
6733};
6734
6735pub const termios = if (is_mips or is_sparc) extern struct {
6736 iflag: tc_iflag_t,
6737 oflag: tc_oflag_t,
6738 cflag: tc_cflag_t,
6739 lflag: tc_lflag_t,
6740 line: cc_t,
6741 cc: [NCCS]cc_t,
6742} else if (is_ppc) extern struct {
6743 iflag: tc_iflag_t,
6744 oflag: tc_oflag_t,
6745 cflag: tc_cflag_t,
6746 lflag: tc_lflag_t,
6747 cc: [NCCS]cc_t,
6748 line: cc_t,
6749 ispeed: speed_t,
6750 ospeed: speed_t,
6751} else extern struct {
6752 iflag: tc_iflag_t,
6753 oflag: tc_oflag_t,
6754 cflag: tc_cflag_t,
6755 lflag: tc_lflag_t,
6756 line: cc_t,
6757 cc: [NCCS]cc_t,
6758 ispeed: speed_t,
6759 ospeed: speed_t,
6760};
6761
6762pub const termios2 = if (is_mips) extern struct {
6763 iflag: tc_iflag_t,
6764 oflag: tc_oflag_t,
6765 cflag: tc_cflag_t,
6766 lflag: tc_lflag_t,
6767 cc: [NCCS]cc_t,
6768 line: cc_t,
6769 ispeed: speed_t,
6770 ospeed: speed_t,
6771} else extern struct {
6772 iflag: tc_iflag_t,
6773 oflag: tc_oflag_t,
6774 cflag: tc_cflag_t,
6775 lflag: tc_lflag_t,
6776 line: cc_t,
6777 cc: [NCCS + if (is_sparc) 2 else 0]cc_t,
6778 ispeed: speed_t,
6779 ospeed: speed_t,
62016780};
62026781
62036782pub const SIOCGIFINDEX = 0x8933;