mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge pull request #18910 from ziglang/std-termios
std.os.termios: consolidate, correct, and complete API definitions
This commit is contained in:
commit
d7563a7753
11 changed files with 1095 additions and 621 deletions
788
lib/std/c.zig
788
lib/std/c.zig
|
|
@ -679,6 +679,794 @@ pub const MAP = switch (native_os) {
|
|||
/// Used by libc to communicate failure. Not actually part of the underlying syscall.
|
||||
pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize));
|
||||
|
||||
pub const cc_t = switch (native_os) {
|
||||
.linux => std.os.linux.cc_t,
|
||||
.macos, .ios, .tvos, .watchos, .netbsd, .openbsd => enum(u8) {
|
||||
VEOF = 0,
|
||||
VEOL = 1,
|
||||
VEOL2 = 2,
|
||||
VERASE = 3,
|
||||
VWERASE = 4,
|
||||
VKILL = 5,
|
||||
VREPRINT = 6,
|
||||
VINTR = 8,
|
||||
VQUIT = 9,
|
||||
VSUSP = 10,
|
||||
VDSUSP = 11,
|
||||
VSTART = 12,
|
||||
VSTOP = 13,
|
||||
VLNEXT = 14,
|
||||
VDISCARD = 15,
|
||||
VMIN = 16,
|
||||
VTIME = 17,
|
||||
VSTATUS = 18,
|
||||
},
|
||||
.freebsd, .kfreebsd => enum(u8) {
|
||||
VEOF = 0,
|
||||
VEOL = 1,
|
||||
VEOL2 = 2,
|
||||
VERASE = 3,
|
||||
VWERASE = 4,
|
||||
VKILL = 5,
|
||||
VREPRINT = 6,
|
||||
VERASE2 = 7,
|
||||
VINTR = 8,
|
||||
VQUIT = 9,
|
||||
VSUSP = 10,
|
||||
VDSUSP = 11,
|
||||
VSTART = 12,
|
||||
VSTOP = 13,
|
||||
VLNEXT = 14,
|
||||
VDISCARD = 15,
|
||||
VMIN = 16,
|
||||
VTIME = 17,
|
||||
VSTATUS = 18,
|
||||
},
|
||||
.haiku => enum(u8) {
|
||||
VINTR = 0,
|
||||
VQUIT = 1,
|
||||
VERASE = 2,
|
||||
VKILL = 3,
|
||||
VEOF = 4,
|
||||
VEOL = 5,
|
||||
VMIN = 4,
|
||||
VTIME = 5,
|
||||
VEOL2 = 6,
|
||||
VSWTCH = 7,
|
||||
VSTART = 8,
|
||||
VSTOP = 9,
|
||||
VSUSP = 10,
|
||||
},
|
||||
.solaris, .illumos => enum(u8) {
|
||||
VINTR = 0,
|
||||
VQUIT = 1,
|
||||
VERASE = 2,
|
||||
VKILL = 3,
|
||||
VEOF = 4,
|
||||
VEOL = 5,
|
||||
VEOL2 = 6,
|
||||
VMIN = 4,
|
||||
VTIME = 5,
|
||||
VSWTCH = 7,
|
||||
VSTART = 8,
|
||||
VSTOP = 9,
|
||||
VSUSP = 10,
|
||||
VDSUSP = 11,
|
||||
VREPRINT = 12,
|
||||
VDISCARD = 13,
|
||||
VWERASE = 14,
|
||||
VLNEXT = 15,
|
||||
VSTATUS = 16,
|
||||
VERASE2 = 17,
|
||||
},
|
||||
.emscripten, .wasi => enum(u8) {
|
||||
VINTR = 0,
|
||||
VQUIT = 1,
|
||||
VERASE = 2,
|
||||
VKILL = 3,
|
||||
VEOF = 4,
|
||||
VTIME = 5,
|
||||
VMIN = 6,
|
||||
VSWTC = 7,
|
||||
VSTART = 8,
|
||||
VSTOP = 9,
|
||||
VSUSP = 10,
|
||||
VEOL = 11,
|
||||
VREPRINT = 12,
|
||||
VDISCARD = 13,
|
||||
VWERASE = 14,
|
||||
VLNEXT = 15,
|
||||
VEOL2 = 16,
|
||||
},
|
||||
else => @compileError("target libc does not have cc_t"),
|
||||
};
|
||||
|
||||
pub const NCCS = switch (native_os) {
|
||||
.linux => std.os.linux.NCCS,
|
||||
.macos, .ios, .tvos, .watchos, .freebsd, .kfreebsd, .netbsd, .openbsd, .dragonfly => 20,
|
||||
.haiku => 11,
|
||||
.solaris, .illumos => 19,
|
||||
.emscripten, .wasi => 32,
|
||||
else => @compileError("target libc does not have NCCS"),
|
||||
};
|
||||
|
||||
pub const termios = switch (native_os) {
|
||||
.linux => std.os.linux.termios,
|
||||
.macos, .ios, .tvos, .watchos => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
cc: [NCCS]cc_t,
|
||||
ispeed: speed_t align(8),
|
||||
ospeed: speed_t,
|
||||
},
|
||||
.freebsd, .kfreebsd, .netbsd, .dragonfly, .openbsd => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
cc: [NCCS]cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
},
|
||||
.haiku => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
line: cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
cc: [NCCS]cc_t,
|
||||
},
|
||||
.solaris, .illumos => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
cc: [NCCS]cc_t,
|
||||
},
|
||||
.emscripten, .wasi => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
line: std.c.cc_t,
|
||||
cc: [NCCS]cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
},
|
||||
else => @compileError("target libc does not have termios"),
|
||||
};
|
||||
|
||||
pub const tc_iflag_t = switch (native_os) {
|
||||
.linux => std.os.linux.tc_iflag_t,
|
||||
.macos, .ios, .tvos, .watchos => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IXON: bool = false,
|
||||
IXOFF: bool = false,
|
||||
IXANY: bool = false,
|
||||
_12: u1 = 0,
|
||||
IMAXBEL: bool = false,
|
||||
IUTF8: bool = false,
|
||||
_: u17 = 0,
|
||||
},
|
||||
.netbsd, .freebsd, .kfreebsd, .dragonfly => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IXON: bool = false,
|
||||
IXOFF: bool = false,
|
||||
IXANY: bool = false,
|
||||
_12: u1 = 0,
|
||||
IMAXBEL: bool = false,
|
||||
_: u18 = 0,
|
||||
},
|
||||
.openbsd => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IXON: bool = false,
|
||||
IXOFF: bool = false,
|
||||
IXANY: bool = false,
|
||||
IUCLC: bool = false,
|
||||
IMAXBEL: bool = false,
|
||||
_: u18 = 0,
|
||||
},
|
||||
.haiku => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IUCLC: bool = false,
|
||||
IXON: bool = false,
|
||||
IXANY: bool = false,
|
||||
IXOFF: bool = false,
|
||||
_: u19 = 0,
|
||||
},
|
||||
.solaris, .illumos => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IUCLC: bool = false,
|
||||
IXON: bool = false,
|
||||
IXANY: bool = false,
|
||||
_12: u1 = 0,
|
||||
IMAXBEL: bool = false,
|
||||
_14: u1 = 0,
|
||||
DOSMODE: bool = false,
|
||||
_: u16 = 0,
|
||||
},
|
||||
.emscripten, .wasi => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IUCLC: bool = false,
|
||||
IXON: bool = false,
|
||||
IXANY: bool = false,
|
||||
IXOFF: bool = false,
|
||||
IMAXBEL: bool = false,
|
||||
IUTF8: bool = false,
|
||||
_: u17 = 0,
|
||||
},
|
||||
else => @compileError("target libc does not have tc_iflag_t"),
|
||||
};
|
||||
|
||||
pub const tc_oflag_t = switch (native_os) {
|
||||
.linux => std.os.linux.tc_oflag_t,
|
||||
.macos, .ios, .tvos, .watchos => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OXTABS: bool = false,
|
||||
ONOEOT: bool = false,
|
||||
OCRNL: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
OFILL: bool = false,
|
||||
NLDLY: u2 = 0,
|
||||
TABDLY: u2 = 0,
|
||||
CRDLY: u2 = 0,
|
||||
FFDLY: u1 = 0,
|
||||
BSDLY: u1 = 0,
|
||||
VTDLY: u1 = 0,
|
||||
OFDEL: bool = false,
|
||||
_: u14 = 0,
|
||||
},
|
||||
.netbsd => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OXTABS: bool = false,
|
||||
ONOEOT: bool = false,
|
||||
OCRNL: bool = false,
|
||||
_5: u1 = 0,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
_: u24 = 0,
|
||||
},
|
||||
.openbsd => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OXTABS: bool = false,
|
||||
ONOEOT: bool = false,
|
||||
OCRNL: bool = false,
|
||||
OLCUC: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
_: u24 = 0,
|
||||
},
|
||||
.freebsd, .kfreebsd, .dragonfly => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
ONLCR: bool = false,
|
||||
_2: u1 = 0,
|
||||
ONOEOT: bool = false,
|
||||
OCRNL: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
_: u25 = 0,
|
||||
},
|
||||
.solaris, .illumos => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
OLCUC: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OCRNL: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
OFILL: bool = false,
|
||||
OFDEL: bool = false,
|
||||
NLDLY: u1 = 0,
|
||||
CRDLY: u2 = 0,
|
||||
TABDLY: u2 = 0,
|
||||
BSDLY: u1 = 0,
|
||||
VTDLY: u1 = 0,
|
||||
FFDLY: u1 = 0,
|
||||
PAGEOUT: bool = false,
|
||||
WRAP: bool = false,
|
||||
_: u14 = 0,
|
||||
},
|
||||
.haiku, .wasi, .emscripten => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
OLCUC: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OCRNL: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
OFILL: bool = false,
|
||||
OFDEL: bool = false,
|
||||
NLDLY: u1 = 0,
|
||||
CRDLY: u2 = 0,
|
||||
TABDLY: u2 = 0,
|
||||
BSDLY: u1 = 0,
|
||||
VTDLY: u1 = 0,
|
||||
FFDLY: u1 = 0,
|
||||
_: u16 = 0,
|
||||
},
|
||||
else => @compileError("target libc does not have tc_oflag_t"),
|
||||
};
|
||||
|
||||
pub const CSIZE = switch (native_os) {
|
||||
.linux => std.os.linux.CSIZE,
|
||||
.haiku => enum(u1) { CS7, CS8 },
|
||||
else => enum(u2) { CS5, CS6, CS7, CS8 },
|
||||
};
|
||||
|
||||
pub const tc_cflag_t = switch (native_os) {
|
||||
.linux => std.os.linux.tc_cflag_t,
|
||||
.macos, .ios, .tvos, .watchos => packed struct(u32) {
|
||||
CIGNORE: bool = false,
|
||||
_1: u5 = 0,
|
||||
CSTOPB: bool = false,
|
||||
_7: u1 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
_10: u1 = 0,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
CCTS_OFLOW: bool = false,
|
||||
CRTS_IFLOW: bool = false,
|
||||
CDTR_IFLOW: bool = false,
|
||||
CDSR_OFLOW: bool = false,
|
||||
CCAR_OFLOW: bool = false,
|
||||
_: u11 = 0,
|
||||
},
|
||||
.freebsd, .kfreebsd => packed struct(u32) {
|
||||
CIGNORE: bool = false,
|
||||
_1: u7 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
CCTS_OFLOW: bool = false,
|
||||
CRTS_IFLOW: bool = false,
|
||||
CDTR_IFLOW: bool = false,
|
||||
CDSR_OFLOW: bool = false,
|
||||
CCAR_OFLOW: bool = false,
|
||||
CNO_RTSDTR: bool = false,
|
||||
_: u10 = 0,
|
||||
},
|
||||
.netbsd => packed struct(u32) {
|
||||
CIGNORE: bool = false,
|
||||
_1: u7 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
CRTSCTS: bool = false,
|
||||
CDTRCTS: bool = false,
|
||||
_18: u2 = 0,
|
||||
MDMBUF: bool = false,
|
||||
_: u11 = 0,
|
||||
},
|
||||
.dragonfly => packed struct(u32) {
|
||||
CIGNORE: bool = false,
|
||||
_1: u7 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
CCTS_OFLOW: bool = false,
|
||||
CRTS_IFLOW: bool = false,
|
||||
CDTR_IFLOW: bool = false,
|
||||
CDSR_OFLOW: bool = false,
|
||||
CCAR_OFLOW: bool = false,
|
||||
_: u11 = 0,
|
||||
},
|
||||
.openbsd => packed struct(u32) {
|
||||
CIGNORE: bool = false,
|
||||
_1: u7 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
CRTSCTS: bool = false,
|
||||
_17: u3 = 0,
|
||||
MDMBUF: bool = false,
|
||||
_: u11 = 0,
|
||||
},
|
||||
.haiku => packed struct(u32) {
|
||||
_0: u5 = 0,
|
||||
CSIZE: CSIZE = .CS7,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
XLOBLK: bool = false,
|
||||
CTSFLOW: bool = false,
|
||||
RTSFLOW: bool = false,
|
||||
_: u17 = 0,
|
||||
},
|
||||
.solaris, .illumos => packed struct(u32) {
|
||||
_0: u4 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
RCV1EN: bool = false,
|
||||
XMT1EN: bool = false,
|
||||
LOBLK: bool = false,
|
||||
XCLUDE: bool = false,
|
||||
_16: u4 = 0,
|
||||
PAREXT: bool = false,
|
||||
CBAUDEXT: bool = false,
|
||||
CIBAUDEXT: bool = false,
|
||||
_23: u7 = 0,
|
||||
CRTSXOFF: bool = false,
|
||||
CRTSCTS: bool = false,
|
||||
},
|
||||
.wasi, .emscripten => packed struct(u32) {
|
||||
_0: u4 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
_: u20 = 0,
|
||||
},
|
||||
else => @compileError("target libc does not have tc_cflag_t"),
|
||||
};
|
||||
|
||||
pub const tc_lflag_t = switch (native_os) {
|
||||
.linux => std.os.linux.tc_lflag_t,
|
||||
.macos, .ios, .tvos, .watchos, .netbsd, .freebsd, .kfreebsd, .dragonfly => packed struct(u32) {
|
||||
ECHOKE: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHO: bool = false,
|
||||
ECHONL: bool = false,
|
||||
ECHOPRT: bool = false,
|
||||
ECHOCTL: bool = false,
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
ALTWERASE: bool = false,
|
||||
IEXTEN: bool = false,
|
||||
EXTPROC: bool = false,
|
||||
_12: u10 = 0,
|
||||
TOSTOP: bool = false,
|
||||
FLUSHO: bool = false,
|
||||
_24: u1 = 0,
|
||||
NOKERNINFO: bool = false,
|
||||
_26: u3 = 0,
|
||||
PENDIN: bool = false,
|
||||
_30: u1 = 0,
|
||||
NOFLSH: bool = false,
|
||||
},
|
||||
.openbsd => packed struct(u32) {
|
||||
ECHOKE: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHO: bool = false,
|
||||
ECHONL: bool = false,
|
||||
ECHOPRT: bool = false,
|
||||
ECHOCTL: bool = false,
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
ALTWERASE: bool = false,
|
||||
IEXTEN: bool = false,
|
||||
EXTPROC: bool = false,
|
||||
_12: u10 = 0,
|
||||
TOSTOP: bool = false,
|
||||
FLUSHO: bool = false,
|
||||
XCASE: bool = false,
|
||||
NOKERNINFO: bool = false,
|
||||
_26: u3 = 0,
|
||||
PENDIN: bool = false,
|
||||
_30: u1 = 0,
|
||||
NOFLSH: bool = false,
|
||||
},
|
||||
.haiku => packed struct(u32) {
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
XCASE: bool = false,
|
||||
ECHO: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHONL: bool = false,
|
||||
NOFLSH: bool = false,
|
||||
TOSTOP: bool = false,
|
||||
IEXTEN: bool = false,
|
||||
ECHOCTL: bool = false,
|
||||
ECHOPRT: bool = false,
|
||||
ECHOKE: bool = false,
|
||||
FLUSHO: bool = false,
|
||||
PENDIN: bool = false,
|
||||
_: u17 = 0,
|
||||
},
|
||||
.solaris, .illumos => packed struct(u32) {
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
XCASE: bool = false,
|
||||
ECHO: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHONL: bool = false,
|
||||
NOFLSH: bool = false,
|
||||
TOSTOP: bool = false,
|
||||
ECHOCTL: bool = false,
|
||||
ECHOPRT: bool = false,
|
||||
ECHOKE: bool = false,
|
||||
DEFECHO: bool = false,
|
||||
FLUSHO: bool = false,
|
||||
PENDIN: bool = false,
|
||||
IEXTEN: bool = false,
|
||||
_: u16 = 0,
|
||||
},
|
||||
.wasi, .emscripten => packed struct(u32) {
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
_2: u1 = 0,
|
||||
ECHO: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHONL: bool = false,
|
||||
NOFLSH: bool = false,
|
||||
TOSTOP: bool = false,
|
||||
_9: u6 = 0,
|
||||
IEXTEN: bool = false,
|
||||
_: u16 = 0,
|
||||
},
|
||||
else => @compileError("target libc does not have tc_lflag_t"),
|
||||
};
|
||||
|
||||
pub const speed_t = switch (native_os) {
|
||||
.linux => std.os.linux.speed_t,
|
||||
.macos, .ios, .tvos, .watchos, .openbsd => enum(u64) {
|
||||
B0 = 0,
|
||||
B50 = 50,
|
||||
B75 = 75,
|
||||
B110 = 110,
|
||||
B134 = 134,
|
||||
B150 = 150,
|
||||
B200 = 200,
|
||||
B300 = 300,
|
||||
B600 = 600,
|
||||
B1200 = 1200,
|
||||
B1800 = 1800,
|
||||
B2400 = 2400,
|
||||
B4800 = 4800,
|
||||
B9600 = 9600,
|
||||
B19200 = 19200,
|
||||
B38400 = 38400,
|
||||
B7200 = 7200,
|
||||
B14400 = 14400,
|
||||
B28800 = 28800,
|
||||
B57600 = 57600,
|
||||
B76800 = 76800,
|
||||
B115200 = 115200,
|
||||
B230400 = 230400,
|
||||
},
|
||||
.freebsd, .kfreebsd, .netbsd => enum(c_uint) {
|
||||
B0 = 0,
|
||||
B50 = 50,
|
||||
B75 = 75,
|
||||
B110 = 110,
|
||||
B134 = 134,
|
||||
B150 = 150,
|
||||
B200 = 200,
|
||||
B300 = 300,
|
||||
B600 = 600,
|
||||
B1200 = 1200,
|
||||
B1800 = 1800,
|
||||
B2400 = 2400,
|
||||
B4800 = 4800,
|
||||
B9600 = 9600,
|
||||
B19200 = 19200,
|
||||
B38400 = 38400,
|
||||
B7200 = 7200,
|
||||
B14400 = 14400,
|
||||
B28800 = 28800,
|
||||
B57600 = 57600,
|
||||
B76800 = 76800,
|
||||
B115200 = 115200,
|
||||
B230400 = 230400,
|
||||
B460800 = 460800,
|
||||
B500000 = 500000,
|
||||
B921600 = 921600,
|
||||
B1000000 = 1000000,
|
||||
B1500000 = 1500000,
|
||||
B2000000 = 2000000,
|
||||
B2500000 = 2500000,
|
||||
B3000000 = 3000000,
|
||||
B3500000 = 3500000,
|
||||
B4000000 = 4000000,
|
||||
},
|
||||
.dragonfly => enum(c_uint) {
|
||||
B0 = 0,
|
||||
B50 = 50,
|
||||
B75 = 75,
|
||||
B110 = 110,
|
||||
B134 = 134,
|
||||
B150 = 150,
|
||||
B200 = 200,
|
||||
B300 = 300,
|
||||
B600 = 600,
|
||||
B1200 = 1200,
|
||||
B1800 = 1800,
|
||||
B2400 = 2400,
|
||||
B4800 = 4800,
|
||||
B9600 = 9600,
|
||||
B19200 = 19200,
|
||||
B38400 = 38400,
|
||||
B7200 = 7200,
|
||||
B14400 = 14400,
|
||||
B28800 = 28800,
|
||||
B57600 = 57600,
|
||||
B76800 = 76800,
|
||||
B115200 = 115200,
|
||||
B230400 = 230400,
|
||||
B460800 = 460800,
|
||||
B921600 = 921600,
|
||||
},
|
||||
.haiku => enum(u8) {
|
||||
B0 = 0x00,
|
||||
B50 = 0x01,
|
||||
B75 = 0x02,
|
||||
B110 = 0x03,
|
||||
B134 = 0x04,
|
||||
B150 = 0x05,
|
||||
B200 = 0x06,
|
||||
B300 = 0x07,
|
||||
B600 = 0x08,
|
||||
B1200 = 0x09,
|
||||
B1800 = 0x0A,
|
||||
B2400 = 0x0B,
|
||||
B4800 = 0x0C,
|
||||
B9600 = 0x0D,
|
||||
B19200 = 0x0E,
|
||||
B38400 = 0x0F,
|
||||
B57600 = 0x10,
|
||||
B115200 = 0x11,
|
||||
B230400 = 0x12,
|
||||
B31250 = 0x13,
|
||||
},
|
||||
.solaris, .illumos => enum(c_uint) {
|
||||
B0 = 0,
|
||||
B50 = 1,
|
||||
B75 = 2,
|
||||
B110 = 3,
|
||||
B134 = 4,
|
||||
B150 = 5,
|
||||
B200 = 6,
|
||||
B300 = 7,
|
||||
B600 = 8,
|
||||
B1200 = 9,
|
||||
B1800 = 10,
|
||||
B2400 = 11,
|
||||
B4800 = 12,
|
||||
B9600 = 13,
|
||||
B19200 = 14,
|
||||
B38400 = 15,
|
||||
B57600 = 16,
|
||||
B76800 = 17,
|
||||
B115200 = 18,
|
||||
B153600 = 19,
|
||||
B230400 = 20,
|
||||
B307200 = 21,
|
||||
B460800 = 22,
|
||||
B921600 = 23,
|
||||
B1000000 = 24,
|
||||
B1152000 = 25,
|
||||
B1500000 = 26,
|
||||
B2000000 = 27,
|
||||
B2500000 = 28,
|
||||
B3000000 = 29,
|
||||
B3500000 = 30,
|
||||
B4000000 = 31,
|
||||
},
|
||||
.emscripten, .wasi => enum(u32) {
|
||||
B0 = 0o0000000,
|
||||
B50 = 0o0000001,
|
||||
B75 = 0o0000002,
|
||||
B110 = 0o0000003,
|
||||
B134 = 0o0000004,
|
||||
B150 = 0o0000005,
|
||||
B200 = 0o0000006,
|
||||
B300 = 0o0000007,
|
||||
B600 = 0o0000010,
|
||||
B1200 = 0o0000011,
|
||||
B1800 = 0o0000012,
|
||||
B2400 = 0o0000013,
|
||||
B4800 = 0o0000014,
|
||||
B9600 = 0o0000015,
|
||||
B19200 = 0o0000016,
|
||||
B38400 = 0o0000017,
|
||||
|
||||
B57600 = 0o0010001,
|
||||
B115200 = 0o0010002,
|
||||
B230400 = 0o0010003,
|
||||
B460800 = 0o0010004,
|
||||
B500000 = 0o0010005,
|
||||
B576000 = 0o0010006,
|
||||
B921600 = 0o0010007,
|
||||
B1000000 = 0o0010010,
|
||||
B1152000 = 0o0010011,
|
||||
B1500000 = 0o0010012,
|
||||
B2000000 = 0o0010013,
|
||||
B2500000 = 0o0010014,
|
||||
B3000000 = 0o0010015,
|
||||
B3500000 = 0o0010016,
|
||||
B4000000 = 0o0010017,
|
||||
},
|
||||
else => @compileError("target libc does not have speed_t"),
|
||||
};
|
||||
|
||||
pub const whence_t = if (native_os == .wasi) std.os.wasi.whence_t else c_int;
|
||||
|
||||
// Unix-like systems
|
||||
|
|
|
|||
|
|
@ -2692,127 +2692,6 @@ pub const SHUT = struct {
|
|||
pub const RDWR = 2;
|
||||
};
|
||||
|
||||
// Term
|
||||
pub const V = struct {
|
||||
pub const EOF = 0;
|
||||
pub const EOL = 1;
|
||||
pub const EOL2 = 2;
|
||||
pub const ERASE = 3;
|
||||
pub const WERASE = 4;
|
||||
pub const KILL = 5;
|
||||
pub const REPRINT = 6;
|
||||
pub const INTR = 8;
|
||||
pub const QUIT = 9;
|
||||
pub const SUSP = 10;
|
||||
pub const DSUSP = 11;
|
||||
pub const START = 12;
|
||||
pub const STOP = 13;
|
||||
pub const LNEXT = 14;
|
||||
pub const DISCARD = 15;
|
||||
pub const MIN = 16;
|
||||
pub const TIME = 17;
|
||||
pub const STATUS = 18;
|
||||
};
|
||||
|
||||
pub const NCCS = 20; // 2 spares (7, 19)
|
||||
|
||||
pub const cc_t = u8;
|
||||
pub const speed_t = u64;
|
||||
pub const tcflag_t = u64;
|
||||
|
||||
pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition
|
||||
pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINTR
|
||||
pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors
|
||||
pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors
|
||||
pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors
|
||||
pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars
|
||||
pub const INLCR: tcflag_t = 0x00000040; // map NL into CR
|
||||
pub const IGNCR: tcflag_t = 0x00000080; // ignore CR
|
||||
pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD)
|
||||
pub const IXON: tcflag_t = 0x00000200; // enable output flow control
|
||||
pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control
|
||||
pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop
|
||||
pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full
|
||||
pub const IUTF8: tcflag_t = 0x00004000; // maintain state for UTF-8 VERASE
|
||||
|
||||
pub const OPOST: tcflag_t = 0x00000001; //enable following output processing
|
||||
pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD)
|
||||
pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces
|
||||
pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output)
|
||||
|
||||
pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL on output
|
||||
pub const ONOCR: tcflag_t = 0x00000020; // no CR output at column 0
|
||||
pub const ONLRET: tcflag_t = 0x00000040; // NL performs CR function
|
||||
pub const OFILL: tcflag_t = 0x00000080; // use fill characters for delay
|
||||
pub const NLDLY: tcflag_t = 0x00000300; // \n delay
|
||||
pub const TABDLY: tcflag_t = 0x00000c04; // horizontal tab delay
|
||||
pub const CRDLY: tcflag_t = 0x00003000; // \r delay
|
||||
pub const FFDLY: tcflag_t = 0x00004000; // form feed delay
|
||||
pub const BSDLY: tcflag_t = 0x00008000; // \b delay
|
||||
pub const VTDLY: tcflag_t = 0x00010000; // vertical tab delay
|
||||
pub const OFDEL: tcflag_t = 0x00020000; // fill is DEL, else NUL
|
||||
|
||||
pub const NL0: tcflag_t = 0x00000000;
|
||||
pub const NL1: tcflag_t = 0x00000100;
|
||||
pub const NL2: tcflag_t = 0x00000200;
|
||||
pub const NL3: tcflag_t = 0x00000300;
|
||||
pub const TAB0: tcflag_t = 0x00000000;
|
||||
pub const TAB1: tcflag_t = 0x00000400;
|
||||
pub const TAB2: tcflag_t = 0x00000800;
|
||||
pub const TAB3: tcflag_t = 0x00000004;
|
||||
pub const CR0: tcflag_t = 0x00000000;
|
||||
pub const CR1: tcflag_t = 0x00001000;
|
||||
pub const CR2: tcflag_t = 0x00002000;
|
||||
pub const CR3: tcflag_t = 0x00003000;
|
||||
pub const FF0: tcflag_t = 0x00000000;
|
||||
pub const FF1: tcflag_t = 0x00004000;
|
||||
pub const BS0: tcflag_t = 0x00000000;
|
||||
pub const BS1: tcflag_t = 0x00008000;
|
||||
pub const VT0: tcflag_t = 0x00000000;
|
||||
pub const VT1: tcflag_t = 0x00010000;
|
||||
|
||||
pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags
|
||||
pub const CSIZE: tcflag_t = 0x00000300; // character size mask
|
||||
pub const CS5: tcflag_t = 0x00000000; // 5 bits (pseudo)
|
||||
pub const CS6: tcflag_t = 0x00000100; // 6 bits
|
||||
pub const CS7: tcflag_t = 0x00000200; // 7 bits
|
||||
pub const CS8: tcflag_t = 0x00000300; // 8 bits
|
||||
pub const CSTOPB: tcflag_t = 0x0000040; // send 2 stop bits
|
||||
pub const CREAD: tcflag_t = 0x00000800; // enable receiver
|
||||
pub const PARENB: tcflag_t = 0x00001000; // parity enable
|
||||
pub const PARODD: tcflag_t = 0x00002000; // odd parity, else even
|
||||
pub const HUPCL: tcflag_t = 0x00004000; // hang up on last close
|
||||
pub const CLOCAL: tcflag_t = 0x00008000; // ignore modem status lines
|
||||
pub const CCTS_OFLOW: tcflag_t = 0x00010000; // CTS flow control of output
|
||||
pub const CRTSCTS: tcflag_t = (CCTS_OFLOW | CRTS_IFLOW);
|
||||
pub const CRTS_IFLOW: tcflag_t = 0x00020000; // RTS flow control of input
|
||||
pub const CDTR_IFLOW: tcflag_t = 0x00040000; // DTR flow control of input
|
||||
pub const CDSR_OFLOW: tcflag_t = 0x00080000; // DSR flow control of output
|
||||
pub const CCAR_OFLOW: tcflag_t = 0x00100000; // DCD flow control of output
|
||||
pub const MDMBUF: tcflag_t = 0x00100000; // old name for CCAR_OFLOW
|
||||
|
||||
pub const ECHOKE: tcflag_t = 0x00000001; // visual erase for line kill
|
||||
pub const ECHOE: tcflag_t = 0x00000002; // visually erase chars
|
||||
pub const ECHOK: tcflag_t = 0x00000004; // echo NL after line kill
|
||||
pub const ECHO: tcflag_t = 0x00000008; // enable echoing
|
||||
pub const ECHONL: tcflag_t = 0x00000010; // echo NL even if ECHO is off
|
||||
pub const ECHOPRT: tcflag_t = 0x00000020; // visual erase mode for hardcopy
|
||||
pub const ECHOCTL: tcflag_t = 0x00000040; // echo control chars as ^(Char)
|
||||
pub const ISIG: tcflag_t = 0x00000080; // enable signals INTR, QUIT, [D]SUSP
|
||||
pub const ICANON: tcflag_t = 0x00000100; // canonicalize input lines
|
||||
pub const ALTWERASE: tcflag_t = 0x00000200; // use alternate WERASE algorithm
|
||||
pub const IEXTEN: tcflag_t = 0x00000400; // enable DISCARD and LNEXT
|
||||
pub const EXTPROC: tcflag_t = 0x00000800; // external processing
|
||||
pub const TOSTOP: tcflag_t = 0x00400000; // stop background jobs from output
|
||||
pub const FLUSHO: tcflag_t = 0x00800000; // output being flushed (state)
|
||||
pub const NOKERNINFO: tcflag_t = 0x02000000; // no kernel output from VSTATUS
|
||||
pub const PENDIN: tcflag_t = 0x20000000; // XXX retype pending input (state)
|
||||
pub const NOFLSH: tcflag_t = 0x80000000; // don't flush after interrupt
|
||||
|
||||
pub const TCSANOW: tcflag_t = 0; // make change immediate
|
||||
pub const TCSADRAIN: tcflag_t = 1; // drain output, then change
|
||||
pub const TCSAFLUSH: tcflag_t = 2; // drain output, flush input
|
||||
pub const TCSASOFT: tcflag_t = 0x10; // flag - don't alter h.w. state
|
||||
pub const TCSA = enum(c_uint) {
|
||||
NOW,
|
||||
DRAIN,
|
||||
|
|
@ -2820,50 +2699,6 @@ pub const TCSA = enum(c_uint) {
|
|||
_,
|
||||
};
|
||||
|
||||
pub const B0: tcflag_t = 0;
|
||||
pub const B50: tcflag_t = 50;
|
||||
pub const B75: tcflag_t = 75;
|
||||
pub const B110: tcflag_t = 110;
|
||||
pub const B134: tcflag_t = 134;
|
||||
pub const B150: tcflag_t = 150;
|
||||
pub const B200: tcflag_t = 200;
|
||||
pub const B300: tcflag_t = 300;
|
||||
pub const B600: tcflag_t = 600;
|
||||
pub const B1200: tcflag_t = 1200;
|
||||
pub const B1800: tcflag_t = 1800;
|
||||
pub const B2400: tcflag_t = 2400;
|
||||
pub const B4800: tcflag_t = 4800;
|
||||
pub const B9600: tcflag_t = 9600;
|
||||
pub const B19200: tcflag_t = 19200;
|
||||
pub const B38400: tcflag_t = 38400;
|
||||
pub const B7200: tcflag_t = 7200;
|
||||
pub const B14400: tcflag_t = 14400;
|
||||
pub const B28800: tcflag_t = 28800;
|
||||
pub const B57600: tcflag_t = 57600;
|
||||
pub const B76800: tcflag_t = 76800;
|
||||
pub const B115200: tcflag_t = 115200;
|
||||
pub const B230400: tcflag_t = 230400;
|
||||
pub const EXTA: tcflag_t = 19200;
|
||||
pub const EXTB: tcflag_t = 38400;
|
||||
|
||||
pub const TCIFLUSH: tcflag_t = 1;
|
||||
pub const TCOFLUSH: tcflag_t = 2;
|
||||
pub const TCIOFLUSH: tcflag_t = 3;
|
||||
pub const TCOOFF: tcflag_t = 1;
|
||||
pub const TCOON: tcflag_t = 2;
|
||||
pub const TCIOFF: tcflag_t = 3;
|
||||
pub const TCION: tcflag_t = 4;
|
||||
|
||||
pub const termios = extern struct {
|
||||
iflag: tcflag_t, // input flags
|
||||
oflag: tcflag_t, // output flags
|
||||
cflag: tcflag_t, // control flags
|
||||
lflag: tcflag_t, // local flags
|
||||
cc: [NCCS]cc_t, // control chars
|
||||
ispeed: speed_t align(8), // input speed
|
||||
ospeed: speed_t, // output speed
|
||||
};
|
||||
|
||||
pub const winsize = extern struct {
|
||||
ws_row: u16,
|
||||
ws_col: u16,
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ pub const sigset_t = emscripten.sigset_t;
|
|||
pub const sockaddr = emscripten.sockaddr;
|
||||
pub const socklen_t = emscripten.socklen_t;
|
||||
pub const stack_t = emscripten.stack_t;
|
||||
pub const tcflag_t = emscripten.tcflag_t;
|
||||
pub const termios = emscripten.termios;
|
||||
pub const time_t = emscripten.time_t;
|
||||
pub const timespec = emscripten.timespec;
|
||||
pub const timeval = emscripten.timeval;
|
||||
|
|
|
|||
|
|
@ -950,21 +950,4 @@ pub const directory_which = enum(c_int) {
|
|||
_,
|
||||
};
|
||||
|
||||
pub const cc_t = u8;
|
||||
pub const speed_t = u8;
|
||||
pub const tcflag_t = u32;
|
||||
|
||||
pub const NCCS = 11;
|
||||
|
||||
pub const termios = extern struct {
|
||||
c_iflag: tcflag_t,
|
||||
c_oflag: tcflag_t,
|
||||
c_cflag: tcflag_t,
|
||||
c_lflag: tcflag_t,
|
||||
c_line: cc_t,
|
||||
c_ispeed: speed_t,
|
||||
c_ospeed: speed_t,
|
||||
cc_t: [NCCS]cc_t,
|
||||
};
|
||||
|
||||
pub const MSG_NOSIGNAL = 0x0800;
|
||||
|
|
|
|||
|
|
@ -85,8 +85,6 @@ pub const sigset_t = linux.sigset_t;
|
|||
pub const sockaddr = linux.sockaddr;
|
||||
pub const socklen_t = linux.socklen_t;
|
||||
pub const stack_t = linux.stack_t;
|
||||
pub const tcflag_t = linux.tcflag_t;
|
||||
pub const termios = linux.termios;
|
||||
pub const time_t = linux.time_t;
|
||||
pub const timespec = linux.timespec;
|
||||
pub const timeval = linux.timeval;
|
||||
|
|
|
|||
|
|
@ -806,90 +806,6 @@ pub const T = struct {
|
|||
pub const IOCXMTFRAME = 0x80087444;
|
||||
};
|
||||
|
||||
// Term
|
||||
const V = struct {
|
||||
pub const EOF = 0; // ICANON
|
||||
pub const EOL = 1; // ICANON
|
||||
pub const EOL2 = 2; // ICANON
|
||||
pub const ERASE = 3; // ICANON
|
||||
pub const WERASE = 4; // ICANON
|
||||
pub const KILL = 5; // ICANON
|
||||
pub const REPRINT = 6; // ICANON
|
||||
// 7 spare 1
|
||||
pub const INTR = 8; // ISIG
|
||||
pub const QUIT = 9; // ISIG
|
||||
pub const SUSP = 10; // ISIG
|
||||
pub const DSUSP = 11; // ISIG
|
||||
pub const START = 12; // IXON, IXOFF
|
||||
pub const STOP = 13; // IXON, IXOFF
|
||||
pub const LNEXT = 14; // IEXTEN
|
||||
pub const DISCARD = 15; // IEXTEN
|
||||
pub const MIN = 16; // !ICANON
|
||||
pub const TIME = 17; // !ICANON
|
||||
pub const STATUS = 18; // ICANON
|
||||
// 19 spare 2
|
||||
};
|
||||
|
||||
// Input flags - software input processing
|
||||
pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition
|
||||
pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT
|
||||
pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors
|
||||
pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors
|
||||
pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors
|
||||
pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars
|
||||
pub const INLCR: tcflag_t = 0x00000040; // map NL into CR
|
||||
pub const IGNCR: tcflag_t = 0x00000080; // ignore CR
|
||||
pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD)
|
||||
pub const IXON: tcflag_t = 0x00000200; // enable output flow control
|
||||
pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control
|
||||
pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop
|
||||
pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full
|
||||
|
||||
// Output flags - software output processing
|
||||
pub const OPOST: tcflag_t = 0x00000001; // enable following output processing
|
||||
pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD)
|
||||
pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces
|
||||
pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output
|
||||
pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL
|
||||
pub const ONOCR: tcflag_t = 0x00000040; // discard CR's when on column 0
|
||||
pub const ONLRET: tcflag_t = 0x00000080; // move to column 0 on CR
|
||||
|
||||
// Control flags - hardware control of terminal
|
||||
pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags
|
||||
pub const CSIZE: tcflag_t = 0x00000300; // character size mask
|
||||
pub const CS5: tcflag_t = 0x00000000; // 5 bits (pseudo)
|
||||
pub const CS6: tcflag_t = 0x00000100; // 6 bits
|
||||
pub const CS7: tcflag_t = 0x00000200; // 7 bits
|
||||
pub const CS8: tcflag_t = 0x00000300; // 8 bits
|
||||
pub const CSTOPB: tcflag_t = 0x00000400; // send 2 stop bits
|
||||
pub const CREAD: tcflag_t = 0x00000800; // enable receiver
|
||||
pub const PARENB: tcflag_t = 0x00001000; // parity enable
|
||||
pub const PARODD: tcflag_t = 0x00002000; // odd parity, else even
|
||||
pub const HUPCL: tcflag_t = 0x00004000; // hang up on last close
|
||||
pub const CLOCAL: tcflag_t = 0x00008000; // ignore modem status lines
|
||||
pub const CRTSCTS: tcflag_t = 0x00010000; // RTS/CTS full-duplex flow control
|
||||
pub const CRTS_IFLOW: tcflag_t = CRTSCTS; // XXX compat
|
||||
pub const CCTS_OFLOW: tcflag_t = CRTSCTS; // XXX compat
|
||||
pub const CDTRCTS: tcflag_t = 0x00020000; // DTR/CTS full-duplex flow control
|
||||
pub const MDMBUF: tcflag_t = 0x00100000; // DTR/DCD hardware flow control
|
||||
pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS | CDTRCTS); // all types of hw flow control
|
||||
|
||||
pub const tcflag_t = c_uint;
|
||||
pub const speed_t = c_uint;
|
||||
pub const cc_t = u8;
|
||||
|
||||
pub const NCCS = 20;
|
||||
|
||||
pub const termios = extern struct {
|
||||
iflag: tcflag_t, // input flags
|
||||
oflag: tcflag_t, // output flags
|
||||
cflag: tcflag_t, // control flags
|
||||
lflag: tcflag_t, // local flags
|
||||
cc: [NCCS]cc_t, // control chars
|
||||
ispeed: c_int, // input speed
|
||||
ospeed: c_int, // output speed
|
||||
};
|
||||
|
||||
// Commands passed to tcsetattr() for setting the termios structure.
|
||||
pub const TCSA = struct {
|
||||
pub const NOW = 0; // make change immediate
|
||||
|
|
@ -898,43 +814,6 @@ pub const TCSA = struct {
|
|||
pub const SOFT = 0x10; // flag - don't alter h.w. state
|
||||
};
|
||||
|
||||
// Standard speeds
|
||||
pub const B0: c_uint = 0;
|
||||
pub const B50: c_uint = 50;
|
||||
pub const B75: c_uint = 75;
|
||||
pub const B110: c_uint = 110;
|
||||
pub const B134: c_uint = 134;
|
||||
pub const B150: c_uint = 150;
|
||||
pub const B200: c_uint = 200;
|
||||
pub const B300: c_uint = 300;
|
||||
pub const B600: c_uint = 600;
|
||||
pub const B1200: c_uint = 1200;
|
||||
pub const B1800: c_uint = 1800;
|
||||
pub const B2400: c_uint = 2400;
|
||||
pub const B4800: c_uint = 4800;
|
||||
pub const B9600: c_uint = 9600;
|
||||
pub const B19200: c_uint = 19200;
|
||||
pub const B38400: c_uint = 38400;
|
||||
pub const B7200: c_uint = 7200;
|
||||
pub const B14400: c_uint = 14400;
|
||||
pub const B28800: c_uint = 28800;
|
||||
pub const B57600: c_uint = 57600;
|
||||
pub const B76800: c_uint = 76800;
|
||||
pub const B115200: c_uint = 115200;
|
||||
pub const B230400: c_uint = 230400;
|
||||
pub const B460800: c_uint = 460800;
|
||||
pub const B500000: c_uint = 500000;
|
||||
pub const B921600: c_uint = 921600;
|
||||
pub const B1000000: c_uint = 1000000;
|
||||
pub const B1500000: c_uint = 1500000;
|
||||
pub const B2000000: c_uint = 2000000;
|
||||
pub const B2500000: c_uint = 2500000;
|
||||
pub const B3000000: c_uint = 3000000;
|
||||
pub const B3500000: c_uint = 3500000;
|
||||
pub const B4000000: c_uint = 4000000;
|
||||
pub const EXTA: c_uint = 19200;
|
||||
pub const EXTB: c_uint = 38400;
|
||||
|
||||
pub const TCIFLUSH = 1;
|
||||
pub const TCOFLUSH = 2;
|
||||
pub const TCIOFLUSH = 3;
|
||||
|
|
|
|||
|
|
@ -768,91 +768,6 @@ pub const AUTH = struct {
|
|||
pub const ALLOW: c_int = (OKAY | ROOTOKAY | SECURE);
|
||||
};
|
||||
|
||||
// Term
|
||||
pub const V = struct {
|
||||
pub const EOF = 0; // ICANON
|
||||
pub const EOL = 1; // ICANON
|
||||
pub const EOL2 = 2; // ICANON
|
||||
pub const ERASE = 3; // ICANON
|
||||
pub const WERASE = 4; // ICANON
|
||||
pub const KILL = 5; // ICANON
|
||||
pub const REPRINT = 6; // ICANON
|
||||
// 7 spare 1
|
||||
pub const INTR = 8; // ISIG
|
||||
pub const QUIT = 9; // ISIG
|
||||
pub const SUSP = 10; // ISIG
|
||||
pub const DSUSP = 11; // ISIG
|
||||
pub const START = 12; // IXON, IXOFF
|
||||
pub const STOP = 13; // IXON, IXOFF
|
||||
pub const LNEXT = 14; // IEXTEN
|
||||
pub const DISCARD = 15; // IEXTEN
|
||||
pub const MIN = 16; // !ICANON
|
||||
pub const TIME = 17; // !ICANON
|
||||
pub const STATUS = 18; // ICANON
|
||||
// 19 spare 2
|
||||
};
|
||||
|
||||
pub const tcflag_t = c_uint;
|
||||
pub const speed_t = c_uint;
|
||||
pub const cc_t = u8;
|
||||
|
||||
pub const NCCS = 20;
|
||||
|
||||
// Input flags - software input processing
|
||||
pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition
|
||||
pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT
|
||||
pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors
|
||||
pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors
|
||||
pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors
|
||||
pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars
|
||||
pub const INLCR: tcflag_t = 0x00000040; // map NL into CR
|
||||
pub const IGNCR: tcflag_t = 0x00000080; // ignore CR
|
||||
pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD)
|
||||
pub const IXON: tcflag_t = 0x00000200; // enable output flow control
|
||||
pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control
|
||||
pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop
|
||||
pub const IUCLC: tcflag_t = 0x00001000; // translate upper to lower case
|
||||
pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full
|
||||
|
||||
// Output flags - software output processing
|
||||
pub const OPOST: tcflag_t = 0x00000001; // enable following output processing
|
||||
pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD)
|
||||
pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces
|
||||
pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output
|
||||
pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL
|
||||
pub const OLCUC: tcflag_t = 0x00000020; // translate lower case to upper case
|
||||
pub const ONOCR: tcflag_t = 0x00000040; // No CR output at column 0
|
||||
pub const ONLRET: tcflag_t = 0x00000080; // NL performs the CR function
|
||||
|
||||
// Control flags - hardware control of terminal
|
||||
pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags
|
||||
pub const CSIZE: tcflag_t = 0x00000300; // character size mask
|
||||
pub const CS5: tcflag_t = 0x00000000; // 5 bits (pseudo)
|
||||
pub const CS6: tcflag_t = 0x00000100; // 6 bits
|
||||
pub const CS7: tcflag_t = 0x00000200; // 7 bits
|
||||
pub const CS8: tcflag_t = 0x00000300; // 8 bits
|
||||
pub const CSTOPB: tcflag_t = 0x00000400; // send 2 stop bits
|
||||
pub const CREAD: tcflag_t = 0x00000800; // enable receiver
|
||||
pub const PARENB: tcflag_t = 0x00001000; // parity enable
|
||||
pub const PARODD: tcflag_t = 0x00002000; // odd parity, else even
|
||||
pub const HUPCL: tcflag_t = 0x00004000; // hang up on last close
|
||||
pub const CLOCAL: tcflag_t = 0x00008000; // ignore modem status lines
|
||||
pub const CRTSCTS: tcflag_t = 0x00010000; // RTS/CTS full-duplex flow control
|
||||
pub const CRTS_IFLOW: tcflag_t = CRTSCTS; // XXX compat
|
||||
pub const CCTS_OFLOW: tcflag_t = CRTSCTS; // XXX compat
|
||||
pub const MDMBUF: tcflag_t = 0x00100000; // DTR/DCD hardware flow control
|
||||
pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS); // all types of hw flow control
|
||||
|
||||
pub const termios = extern struct {
|
||||
iflag: tcflag_t, // input flags
|
||||
oflag: tcflag_t, // output flags
|
||||
cflag: tcflag_t, // control flags
|
||||
lflag: tcflag_t, // local flags
|
||||
cc: [NCCS]cc_t, // control chars
|
||||
ispeed: c_int, // input speed
|
||||
ospeed: c_int, // output speed
|
||||
};
|
||||
|
||||
// Commands passed to tcsetattr() for setting the termios structure.
|
||||
pub const TCSA = struct {
|
||||
pub const NOW = 0; // make change immediate
|
||||
|
|
@ -861,33 +776,6 @@ pub const TCSA = struct {
|
|||
pub const SOFT = 0x10; // flag - don't alter h.w. state
|
||||
};
|
||||
|
||||
// Standard speeds
|
||||
pub const B0 = 0;
|
||||
pub const B50 = 50;
|
||||
pub const B75 = 75;
|
||||
pub const B110 = 110;
|
||||
pub const B134 = 134;
|
||||
pub const B150 = 150;
|
||||
pub const B200 = 200;
|
||||
pub const B300 = 300;
|
||||
pub const B600 = 600;
|
||||
pub const B1200 = 1200;
|
||||
pub const B1800 = 1800;
|
||||
pub const B2400 = 2400;
|
||||
pub const B4800 = 4800;
|
||||
pub const B9600 = 9600;
|
||||
pub const B19200 = 19200;
|
||||
pub const B38400 = 38400;
|
||||
pub const B7200 = 7200;
|
||||
pub const B14400 = 14400;
|
||||
pub const B28800 = 28800;
|
||||
pub const B57600 = 57600;
|
||||
pub const B76800 = 76800;
|
||||
pub const B115200 = 115200;
|
||||
pub const B230400 = 230400;
|
||||
pub const EXTA = 19200;
|
||||
pub const EXTB = 38400;
|
||||
|
||||
pub const TCIFLUSH = 1;
|
||||
pub const TCOFLUSH = 2;
|
||||
pub const TCIOFLUSH = 3;
|
||||
|
|
|
|||
|
|
@ -698,20 +698,6 @@ pub const SEEK = struct {
|
|||
pub const HOLE = 4;
|
||||
};
|
||||
|
||||
pub const tcflag_t = c_uint;
|
||||
pub const cc_t = u8;
|
||||
pub const speed_t = c_uint;
|
||||
|
||||
pub const NCCS = 19;
|
||||
|
||||
pub const termios = extern struct {
|
||||
c_iflag: tcflag_t,
|
||||
c_oflag: tcflag_t,
|
||||
c_cflag: tcflag_t,
|
||||
c_lflag: tcflag_t,
|
||||
c_cc: [NCCS]cc_t,
|
||||
};
|
||||
|
||||
fn tioc(t: u16, num: u8) u16 {
|
||||
return (t << 8) | num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ pub const W = system.W;
|
|||
pub const addrinfo = system.addrinfo;
|
||||
pub const blkcnt_t = system.blkcnt_t;
|
||||
pub const blksize_t = system.blksize_t;
|
||||
pub const cc_t = system.cc_t;
|
||||
pub const clock_t = system.clock_t;
|
||||
pub const cpu_set_t = system.cpu_set_t;
|
||||
pub const dev_t = system.dev_t;
|
||||
|
|
@ -172,8 +173,6 @@ pub const sigset_t = system.sigset_t;
|
|||
pub const sockaddr = system.sockaddr;
|
||||
pub const socklen_t = system.socklen_t;
|
||||
pub const stack_t = system.stack_t;
|
||||
pub const tcflag_t = system.tcflag_t;
|
||||
pub const termios = system.termios;
|
||||
pub const time_t = system.time_t;
|
||||
pub const timespec = system.timespec;
|
||||
pub const timestamp_t = system.timestamp_t;
|
||||
|
|
@ -184,6 +183,15 @@ pub const uid_t = system.uid_t;
|
|||
pub const user_desc = system.user_desc;
|
||||
pub const utsname = system.utsname;
|
||||
|
||||
pub const termios = system.termios;
|
||||
pub const CSIZE = system.CSIZE;
|
||||
pub const NCCS = system.NCCS;
|
||||
pub const speed_t = system.speed_t;
|
||||
pub const tc_iflag_t = system.tc_iflag_t;
|
||||
pub const tc_oflag_t = system.tc_oflag_t;
|
||||
pub const tc_cflag_t = system.tc_cflag_t;
|
||||
pub const tc_lflag_t = system.tc_lflag_t;
|
||||
|
||||
pub const F_OK = system.F_OK;
|
||||
pub const R_OK = system.R_OK;
|
||||
pub const W_OK = system.W_OK;
|
||||
|
|
|
|||
|
|
@ -1098,23 +1098,6 @@ pub const stack_t = extern struct {
|
|||
size: usize,
|
||||
};
|
||||
|
||||
pub const cc_t = u8;
|
||||
pub const speed_t = u32;
|
||||
pub const tcflag_t = u32;
|
||||
|
||||
pub const NCCS = 32;
|
||||
|
||||
pub const termios = extern struct {
|
||||
iflag: tcflag_t,
|
||||
oflag: tcflag_t,
|
||||
cflag: tcflag_t,
|
||||
lflag: tcflag_t,
|
||||
line: cc_t,
|
||||
cc: [NCCS]cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
};
|
||||
|
||||
pub const timespec = extern struct {
|
||||
tv_sec: time_t,
|
||||
tv_nsec: isize,
|
||||
|
|
|
|||
|
|
@ -5004,175 +5004,291 @@ pub const rusage = extern struct {
|
|||
pub const THREAD = 1;
|
||||
};
|
||||
|
||||
pub const cc_t = u8;
|
||||
pub const speed_t = u32;
|
||||
pub const tcflag_t = u32;
|
||||
pub const NCCS = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => 19,
|
||||
else => 32,
|
||||
};
|
||||
|
||||
pub const NCCS = 32;
|
||||
pub const speed_t = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => enum(u32) {
|
||||
B0 = 0o0000000,
|
||||
B50 = 0o0000001,
|
||||
B75 = 0o0000002,
|
||||
B110 = 0o0000003,
|
||||
B134 = 0o0000004,
|
||||
B150 = 0o0000005,
|
||||
B200 = 0o0000006,
|
||||
B300 = 0o0000007,
|
||||
B600 = 0o0000010,
|
||||
B1200 = 0o0000011,
|
||||
B1800 = 0o0000012,
|
||||
B2400 = 0o0000013,
|
||||
B4800 = 0o0000014,
|
||||
B9600 = 0o0000015,
|
||||
B19200 = 0o0000016,
|
||||
B38400 = 0o0000017,
|
||||
|
||||
pub const B0 = 0o0000000;
|
||||
pub const B50 = 0o0000001;
|
||||
pub const B75 = 0o0000002;
|
||||
pub const B110 = 0o0000003;
|
||||
pub const B134 = 0o0000004;
|
||||
pub const B150 = 0o0000005;
|
||||
pub const B200 = 0o0000006;
|
||||
pub const B300 = 0o0000007;
|
||||
pub const B600 = 0o0000010;
|
||||
pub const B1200 = 0o0000011;
|
||||
pub const B1800 = 0o0000012;
|
||||
pub const B2400 = 0o0000013;
|
||||
pub const B4800 = 0o0000014;
|
||||
pub const B9600 = 0o0000015;
|
||||
pub const B19200 = 0o0000016;
|
||||
pub const B38400 = 0o0000017;
|
||||
pub const BOTHER = 0o0010000;
|
||||
pub const B57600 = 0o0010001;
|
||||
pub const B115200 = 0o0010002;
|
||||
pub const B230400 = 0o0010003;
|
||||
pub const B460800 = 0o0010004;
|
||||
pub const B500000 = 0o0010005;
|
||||
pub const B576000 = 0o0010006;
|
||||
pub const B921600 = 0o0010007;
|
||||
pub const B1000000 = 0o0010010;
|
||||
pub const B1152000 = 0o0010011;
|
||||
pub const B1500000 = 0o0010012;
|
||||
pub const B2000000 = 0o0010013;
|
||||
pub const B2500000 = 0o0010014;
|
||||
pub const B3000000 = 0o0010015;
|
||||
pub const B3500000 = 0o0010016;
|
||||
pub const B4000000 = 0o0010017;
|
||||
B57600 = 0o00020,
|
||||
B115200 = 0o00021,
|
||||
B230400 = 0o00022,
|
||||
B460800 = 0o00023,
|
||||
B500000 = 0o00024,
|
||||
B576000 = 0o00025,
|
||||
B921600 = 0o00026,
|
||||
B1000000 = 0o00027,
|
||||
B1152000 = 0o00030,
|
||||
B1500000 = 0o00031,
|
||||
B2000000 = 0o00032,
|
||||
B2500000 = 0o00033,
|
||||
B3000000 = 0o00034,
|
||||
B3500000 = 0o00035,
|
||||
B4000000 = 0o00036,
|
||||
},
|
||||
else => enum(u32) {
|
||||
B0 = 0o0000000,
|
||||
B50 = 0o0000001,
|
||||
B75 = 0o0000002,
|
||||
B110 = 0o0000003,
|
||||
B134 = 0o0000004,
|
||||
B150 = 0o0000005,
|
||||
B200 = 0o0000006,
|
||||
B300 = 0o0000007,
|
||||
B600 = 0o0000010,
|
||||
B1200 = 0o0000011,
|
||||
B1800 = 0o0000012,
|
||||
B2400 = 0o0000013,
|
||||
B4800 = 0o0000014,
|
||||
B9600 = 0o0000015,
|
||||
B19200 = 0o0000016,
|
||||
B38400 = 0o0000017,
|
||||
|
||||
pub const V = switch (native_arch) {
|
||||
.powerpc, .powerpc64, .powerpc64le => struct {
|
||||
pub const INTR = 0;
|
||||
pub const QUIT = 1;
|
||||
pub const ERASE = 2;
|
||||
pub const KILL = 3;
|
||||
pub const EOF = 4;
|
||||
pub const MIN = 5;
|
||||
pub const EOL = 6;
|
||||
pub const TIME = 7;
|
||||
pub const EOL2 = 8;
|
||||
pub const SWTC = 9;
|
||||
pub const WERASE = 10;
|
||||
pub const REPRINT = 11;
|
||||
pub const SUSP = 12;
|
||||
pub const START = 13;
|
||||
pub const STOP = 14;
|
||||
pub const LNEXT = 15;
|
||||
pub const DISCARD = 16;
|
||||
},
|
||||
.sparc, .sparc64 => struct {
|
||||
pub const INTR = 0;
|
||||
pub const QUIT = 1;
|
||||
pub const ERASE = 2;
|
||||
pub const KILL = 3;
|
||||
pub const EOF = 4;
|
||||
pub const EOL = 5;
|
||||
pub const EOL2 = 6;
|
||||
pub const SWTC = 7;
|
||||
pub const START = 8;
|
||||
pub const STOP = 9;
|
||||
pub const SUSP = 10;
|
||||
pub const DSUSP = 11;
|
||||
pub const REPRINT = 12;
|
||||
pub const DISCARD = 13;
|
||||
pub const WERASE = 14;
|
||||
pub const LNEXT = 15;
|
||||
pub const MIN = EOF;
|
||||
pub const TIME = EOL;
|
||||
},
|
||||
.mips, .mipsel, .mips64, .mips64el => struct {
|
||||
pub const INTR = 0;
|
||||
pub const QUIT = 1;
|
||||
pub const ERASE = 2;
|
||||
pub const KILL = 3;
|
||||
pub const MIN = 4;
|
||||
pub const TIME = 5;
|
||||
pub const EOL2 = 6;
|
||||
pub const SWTC = 7;
|
||||
pub const SWTCH = 7;
|
||||
pub const START = 8;
|
||||
pub const STOP = 9;
|
||||
pub const SUSP = 10;
|
||||
pub const REPRINT = 12;
|
||||
pub const DISCARD = 13;
|
||||
pub const WERASE = 14;
|
||||
pub const LNEXT = 15;
|
||||
pub const EOF = 16;
|
||||
pub const EOL = 17;
|
||||
},
|
||||
else => struct {
|
||||
pub const INTR = 0;
|
||||
pub const QUIT = 1;
|
||||
pub const ERASE = 2;
|
||||
pub const KILL = 3;
|
||||
pub const EOF = 4;
|
||||
pub const TIME = 5;
|
||||
pub const MIN = 6;
|
||||
pub const SWTC = 7;
|
||||
pub const START = 8;
|
||||
pub const STOP = 9;
|
||||
pub const SUSP = 10;
|
||||
pub const EOL = 11;
|
||||
pub const REPRINT = 12;
|
||||
pub const DISCARD = 13;
|
||||
pub const WERASE = 14;
|
||||
pub const LNEXT = 15;
|
||||
pub const EOL2 = 16;
|
||||
B57600 = 0o0010001,
|
||||
B115200 = 0o0010002,
|
||||
B230400 = 0o0010003,
|
||||
B460800 = 0o0010004,
|
||||
B500000 = 0o0010005,
|
||||
B576000 = 0o0010006,
|
||||
B921600 = 0o0010007,
|
||||
B1000000 = 0o0010010,
|
||||
B1152000 = 0o0010011,
|
||||
B1500000 = 0o0010012,
|
||||
B2000000 = 0o0010013,
|
||||
B2500000 = 0o0010014,
|
||||
B3000000 = 0o0010015,
|
||||
B3500000 = 0o0010016,
|
||||
B4000000 = 0o0010017,
|
||||
},
|
||||
};
|
||||
|
||||
pub const IGNBRK: tcflag_t = 1;
|
||||
pub const BRKINT: tcflag_t = 2;
|
||||
pub const IGNPAR: tcflag_t = 4;
|
||||
pub const PARMRK: tcflag_t = 8;
|
||||
pub const INPCK: tcflag_t = 16;
|
||||
pub const ISTRIP: tcflag_t = 32;
|
||||
pub const INLCR: tcflag_t = 64;
|
||||
pub const IGNCR: tcflag_t = 128;
|
||||
pub const ICRNL: tcflag_t = 256;
|
||||
pub const IUCLC: tcflag_t = 512;
|
||||
pub const IXON: tcflag_t = 1024;
|
||||
pub const IXANY: tcflag_t = 2048;
|
||||
pub const IXOFF: tcflag_t = 4096;
|
||||
pub const IMAXBEL: tcflag_t = 8192;
|
||||
pub const IUTF8: tcflag_t = 16384;
|
||||
pub const tc_iflag_t = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IXON: bool = false,
|
||||
IXOFF: bool = false,
|
||||
IXANY: bool = false,
|
||||
IUCLC: bool = false,
|
||||
IMAXBEL: bool = false,
|
||||
IUTF8: bool = false,
|
||||
_: u17 = 0,
|
||||
},
|
||||
else => packed struct(u32) {
|
||||
IGNBRK: bool = false,
|
||||
BRKINT: bool = false,
|
||||
IGNPAR: bool = false,
|
||||
PARMRK: bool = false,
|
||||
INPCK: bool = false,
|
||||
ISTRIP: bool = false,
|
||||
INLCR: bool = false,
|
||||
IGNCR: bool = false,
|
||||
ICRNL: bool = false,
|
||||
IUCLC: bool = false,
|
||||
IXON: bool = false,
|
||||
IXANY: bool = false,
|
||||
IXOFF: bool = false,
|
||||
IMAXBEL: bool = false,
|
||||
IUTF8: bool = false,
|
||||
_: u17 = 0,
|
||||
},
|
||||
};
|
||||
|
||||
pub const OPOST: tcflag_t = 1;
|
||||
pub const OLCUC: tcflag_t = 2;
|
||||
pub const ONLCR: tcflag_t = 4;
|
||||
pub const OCRNL: tcflag_t = 8;
|
||||
pub const ONOCR: tcflag_t = 16;
|
||||
pub const ONLRET: tcflag_t = 32;
|
||||
pub const OFILL: tcflag_t = 64;
|
||||
pub const OFDEL: tcflag_t = 128;
|
||||
pub const VTDLY: tcflag_t = 16384;
|
||||
pub const VT0: tcflag_t = 0;
|
||||
pub const VT1: tcflag_t = 16384;
|
||||
pub const tc_oflag_t = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OLCUC: bool = false,
|
||||
OCRNL: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
OFILL: bool = false,
|
||||
OFDEL: bool = false,
|
||||
NLDLY: u2 = 0,
|
||||
TABDLY: u2 = 0,
|
||||
CRDLY: u2 = 0,
|
||||
FFDLY: u1 = 0,
|
||||
BSDLY: u1 = 0,
|
||||
VTDLY: u1 = 0,
|
||||
_: u15 = 0,
|
||||
},
|
||||
else => packed struct(u32) {
|
||||
OPOST: bool = false,
|
||||
OLCUC: bool = false,
|
||||
ONLCR: bool = false,
|
||||
OCRNL: bool = false,
|
||||
ONOCR: bool = false,
|
||||
ONLRET: bool = false,
|
||||
OFILL: bool = false,
|
||||
OFDEL: bool = false,
|
||||
NLDLY: u1 = 0,
|
||||
CRDLY: u2 = 0,
|
||||
TABDLY: u2 = 0,
|
||||
BSDLY: u1 = 0,
|
||||
VTDLY: u1 = 0,
|
||||
FFDLY: u1 = 0,
|
||||
_: u16 = 0,
|
||||
},
|
||||
};
|
||||
|
||||
pub const CSIZE: tcflag_t = 48;
|
||||
pub const CS5: tcflag_t = 0;
|
||||
pub const CS6: tcflag_t = 16;
|
||||
pub const CS7: tcflag_t = 32;
|
||||
pub const CS8: tcflag_t = 48;
|
||||
pub const CSTOPB: tcflag_t = 64;
|
||||
pub const CREAD: tcflag_t = 128;
|
||||
pub const PARENB: tcflag_t = 256;
|
||||
pub const PARODD: tcflag_t = 512;
|
||||
pub const HUPCL: tcflag_t = 1024;
|
||||
pub const CLOCAL: tcflag_t = 2048;
|
||||
pub const CSIZE = enum(u2) { CS5, CS6, CS7, CS8 };
|
||||
|
||||
pub const ISIG: tcflag_t = 1;
|
||||
pub const ICANON: tcflag_t = 2;
|
||||
pub const ECHO: tcflag_t = 8;
|
||||
pub const ECHOE: tcflag_t = 16;
|
||||
pub const ECHOK: tcflag_t = 32;
|
||||
pub const ECHONL: tcflag_t = 64;
|
||||
pub const NOFLSH: tcflag_t = 128;
|
||||
pub const TOSTOP: tcflag_t = 256;
|
||||
pub const IEXTEN: tcflag_t = 32768;
|
||||
pub const tc_cflag_t = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
|
||||
_0: u8 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
_: u16 = 0,
|
||||
},
|
||||
else => packed struct(u32) {
|
||||
_0: u4 = 0,
|
||||
CSIZE: CSIZE = .CS5,
|
||||
CSTOPB: bool = false,
|
||||
CREAD: bool = false,
|
||||
PARENB: bool = false,
|
||||
PARODD: bool = false,
|
||||
HUPCL: bool = false,
|
||||
CLOCAL: bool = false,
|
||||
_: u20 = 0,
|
||||
},
|
||||
};
|
||||
|
||||
pub const tc_lflag_t = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
|
||||
_0: u1 = 0,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHO: bool = false,
|
||||
ECHONL: bool = false,
|
||||
_5: u2 = 0,
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
_9: u1 = 0,
|
||||
IEXTEN: bool = false,
|
||||
_11: u11 = 0,
|
||||
TOSTOP: bool = false,
|
||||
_23: u8 = 0,
|
||||
NOFLSH: bool = false,
|
||||
},
|
||||
.mips, .mipsel, .mips64, .mips64el => packed struct(u32) {
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
_2: u1 = 0,
|
||||
ECHO: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHONL: bool = false,
|
||||
NOFLSH: bool = false,
|
||||
IEXTEN: bool = false,
|
||||
_9: u6 = 0,
|
||||
TOSTOP: bool = false,
|
||||
_: u16 = 0,
|
||||
},
|
||||
else => packed struct(u32) {
|
||||
ISIG: bool = false,
|
||||
ICANON: bool = false,
|
||||
_2: u1 = 0,
|
||||
ECHO: bool = false,
|
||||
ECHOE: bool = false,
|
||||
ECHOK: bool = false,
|
||||
ECHONL: bool = false,
|
||||
NOFLSH: bool = false,
|
||||
TOSTOP: bool = false,
|
||||
_9: u6 = 0,
|
||||
IEXTEN: bool = false,
|
||||
_: u16 = 0,
|
||||
},
|
||||
};
|
||||
|
||||
pub const cc_t = switch (native_arch) {
|
||||
.mips, .mipsel, .mips64, .mips64el => enum(u8) {
|
||||
VINTR = 0,
|
||||
VQUIT = 1,
|
||||
VERASE = 2,
|
||||
VKILL = 3,
|
||||
VMIN = 4,
|
||||
VTIME = 5,
|
||||
VEOL2 = 6,
|
||||
VSWTC = 7,
|
||||
VSTART = 8,
|
||||
VSTOP = 9,
|
||||
VSUSP = 10,
|
||||
VREPRINT = 12,
|
||||
VDISCARD = 13,
|
||||
VWERASE = 14,
|
||||
VLNEXT = 15,
|
||||
VEOF = 16,
|
||||
VEOL = 17,
|
||||
},
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => enum(u8) {
|
||||
VINTR = 0,
|
||||
VQUIT = 1,
|
||||
VERASE = 2,
|
||||
VKILL = 3,
|
||||
VEOF = 4,
|
||||
VMIN = 5,
|
||||
VEOL = 6,
|
||||
VTIME = 7,
|
||||
VEOL2 = 8,
|
||||
VSWTC = 9,
|
||||
VWERASE = 10,
|
||||
VREPRINT = 11,
|
||||
VSUSP = 12,
|
||||
VSTART = 13,
|
||||
VSTOP = 14,
|
||||
VLNEXT = 15,
|
||||
VDISCARD = 16,
|
||||
},
|
||||
else => enum(u8) {
|
||||
VINTR = 0,
|
||||
VQUIT = 1,
|
||||
VERASE = 2,
|
||||
VKILL = 3,
|
||||
VEOF = 4,
|
||||
VTIME = 5,
|
||||
VMIN = 6,
|
||||
VSWTC = 7,
|
||||
VSTART = 8,
|
||||
VSTOP = 9,
|
||||
VSUSP = 10,
|
||||
VEOL = 11,
|
||||
VREPRINT = 12,
|
||||
VDISCARD = 13,
|
||||
VWERASE = 14,
|
||||
VLNEXT = 15,
|
||||
VEOL2 = 16,
|
||||
},
|
||||
};
|
||||
|
||||
pub const TCSA = enum(c_uint) {
|
||||
NOW,
|
||||
|
|
@ -5181,15 +5297,27 @@ pub const TCSA = enum(c_uint) {
|
|||
_,
|
||||
};
|
||||
|
||||
pub const termios = extern struct {
|
||||
iflag: tcflag_t,
|
||||
oflag: tcflag_t,
|
||||
cflag: tcflag_t,
|
||||
lflag: tcflag_t,
|
||||
line: cc_t,
|
||||
cc: [NCCS]cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
pub const termios = switch (native_arch) {
|
||||
.powerpc, .powerpcle, .powerpc64, .powerpc64le => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
cc: [NCCS]cc_t,
|
||||
line: cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
},
|
||||
else => extern struct {
|
||||
iflag: tc_iflag_t,
|
||||
oflag: tc_oflag_t,
|
||||
cflag: tc_cflag_t,
|
||||
lflag: tc_lflag_t,
|
||||
line: cc_t,
|
||||
cc: [NCCS]cc_t,
|
||||
ispeed: speed_t,
|
||||
ospeed: speed_t,
|
||||
},
|
||||
};
|
||||
|
||||
pub const SIOCGIFINDEX = 0x8933;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue