authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-12 15:52:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-12 15:52:13-07:00
log9a643185540a3bba31e449fdf6f25643a2ea3394
treeffbc4462da517a8970fd396faf5bc5a995581ab3
parent9bdf1ebe3644ee965aab152dd46534a036deaaa8

std.c.NCSS: consolidate and correct


8 files changed, 19 insertions(+), 19 deletions(-)

lib/std/c.zig+9
......@@ -781,6 +781,15 @@ pub const cc_t = switch (native_os) {
781781 else => @compileError("target libc does not have cc_t"),
782782};
783783
784pub const NCCS = switch (native_os) {
785 .linux => std.os.linux.NCCS,
786 .macos, .ios, .tvos, .watchos, .freebsd, .kfreebsd, .netbsd, .openbsd, .dragonfly => 20,
787 .haiku => 11,
788 .solaris, .illumos => 19,
789 .emscripten, .wasi => 32,
790 else => @compileError("target libc does not have NCCS"),
791};
792
784793pub const whence_t = if (native_os == .wasi) std.os.wasi.whence_t else c_int;
785794
786795// Unix-like systems
lib/std/c/darwin.zig+1-3
......@@ -2692,8 +2692,6 @@ pub const SHUT = struct {
26922692 pub const RDWR = 2;
26932693};
26942694
2695pub const NCCS = 20; // 2 spares (7, 19)
2696
26972695pub const speed_t = u64;
26982696pub const tcflag_t = u64;
26992697
......@@ -2836,7 +2834,7 @@ pub const termios = extern struct {
28362834 oflag: tcflag_t, // output flags
28372835 cflag: tcflag_t, // control flags
28382836 lflag: tcflag_t, // local flags
2839 cc: [NCCS]std.c.cc_t, // control chars
2837 cc: [std.c.NCCS]std.c.cc_t, // control chars
28402838 ispeed: speed_t align(8), // input speed
28412839 ospeed: speed_t, // output speed
28422840};
lib/std/c/emscripten.zig+1-3
......@@ -182,15 +182,13 @@ pub const dirent = struct {
182182pub const speed_t = u32;
183183pub const tcflag_t = u32;
184184
185pub const NCCS = 32;
186
187185pub const termios = extern struct {
188186 iflag: tcflag_t,
189187 oflag: tcflag_t,
190188 cflag: tcflag_t,
191189 lflag: tcflag_t,
192190 line: std.c.cc_t,
193 cc: [NCCS]std.c.cc_t,
191 cc: [std.c.NCCS]std.c.cc_t,
194192 ispeed: speed_t,
195193 ospeed: speed_t,
196194};
lib/std/c/haiku.zig+1-3
......@@ -953,8 +953,6 @@ pub const directory_which = enum(c_int) {
953953pub const speed_t = u8;
954954pub const tcflag_t = u32;
955955
956pub const NCCS = 11;
957
958956pub const termios = extern struct {
959957 c_iflag: tcflag_t,
960958 c_oflag: tcflag_t,
......@@ -963,7 +961,7 @@ pub const termios = extern struct {
963961 c_line: std.c.cc_t,
964962 c_ispeed: speed_t,
965963 c_ospeed: speed_t,
966 cc_t: [NCCS]std.c.cc_t,
964 cc_t: [std.c.NCCS]std.c.cc_t,
967965};
968966
969967pub const MSG_NOSIGNAL = 0x0800;
lib/std/c/netbsd.zig+1-3
......@@ -853,14 +853,12 @@ pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS | CDTRCTS); // all types of hw f
853853pub const tcflag_t = c_uint;
854854pub const speed_t = c_uint;
855855
856pub const NCCS = 20;
857
858856pub const termios = extern struct {
859857 iflag: tcflag_t, // input flags
860858 oflag: tcflag_t, // output flags
861859 cflag: tcflag_t, // control flags
862860 lflag: tcflag_t, // local flags
863 cc: [NCCS]std.c.cc_t, // control chars
861 cc: [std.c.NCCS]std.c.cc_t, // control chars
864862 ispeed: c_int, // input speed
865863 ospeed: c_int, // output speed
866864};
lib/std/c/openbsd.zig+1-3
......@@ -771,8 +771,6 @@ pub const AUTH = struct {
771771pub const tcflag_t = c_uint;
772772pub const speed_t = c_uint;
773773
774pub const NCCS = 20;
775
776774// Input flags - software input processing
777775pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition
778776pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT
......@@ -823,7 +821,7 @@ pub const termios = extern struct {
823821 oflag: tcflag_t, // output flags
824822 cflag: tcflag_t, // control flags
825823 lflag: tcflag_t, // local flags
826 cc: [NCCS]std.c.cc_t, // control chars
824 cc: [std.c.NCCS]std.c.cc_t, // control chars
827825 ispeed: c_int, // input speed
828826 ospeed: c_int, // output speed
829827};
lib/std/c/solaris.zig+1-3
......@@ -701,14 +701,12 @@ pub const SEEK = struct {
701701pub const tcflag_t = c_uint;
702702pub const speed_t = c_uint;
703703
704pub const NCCS = 19;
705
706704pub const termios = extern struct {
707705 c_iflag: tcflag_t,
708706 c_oflag: tcflag_t,
709707 c_cflag: tcflag_t,
710708 c_lflag: tcflag_t,
711 c_cc: [NCCS]std.c.cc_t,
709 c_cc: [std.c.NCCS]std.c.cc_t,
712710};
713711
714712fn tioc(t: u16, num: u8) u16 {
lib/std/os/linux.zig+4-1
......@@ -5006,7 +5006,10 @@ pub const rusage = extern struct {
50065006
50075007pub const speed_t = u32;
50085008
5009pub const NCCS = 32;
5009pub const NCCS = switch (native_arch) {
5010 .powerpc, .powerpcle, .powerpc64, .powerpc64le => 19,
5011 else => 32,
5012};
50105013
50115014pub const B0 = 0o0000000;
50125015pub const B50 = 0o0000001;