authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-31 17:02:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-01 17:54:07-07:00
log057f0fec33c4e54e87383d1181e946d3cddbc4c0
tree506380fe20cdf941ae6f255f7def1da4de6f7418
parentfeec4b0614c1fd64fa59634af8774a992c7a5646

std.os fixes to get the test suite passing again


17 files changed, 457 insertions(+), 489 deletions(-)

lib/std/c.zig+3-1
...@@ -57,6 +57,8 @@ pub usingnamespace switch (builtin.os.tag) {...@@ -57,6 +57,8 @@ pub usingnamespace switch (builtin.os.tag) {
57 else => struct {},57 else => struct {},
58};58};
5959
60pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int;
61
60pub usingnamespace switch (builtin.os.tag) {62pub usingnamespace switch (builtin.os.tag) {
61 .netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {},63 .netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {},
62 else => struct {64 else => struct {
...@@ -106,7 +108,7 @@ pub extern "c" fn exit(code: c_int) noreturn;...@@ -106,7 +108,7 @@ pub extern "c" fn exit(code: c_int) noreturn;
106pub extern "c" fn _exit(code: c_int) noreturn;108pub extern "c" fn _exit(code: c_int) noreturn;
107pub extern "c" fn isatty(fd: c.fd_t) c_int;109pub extern "c" fn isatty(fd: c.fd_t) c_int;
108pub extern "c" fn close(fd: c.fd_t) c_int;110pub extern "c" fn close(fd: c.fd_t) c_int;
109pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: c_int) c.off_t;111pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: whence_t) c.off_t;
110pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;112pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;
111pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;113pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;
112pub extern "c" fn ftruncate(fd: c_int, length: c.off_t) c_int;114pub extern "c" fn ftruncate(fd: c_int, length: c.off_t) c_int;
lib/std/c/darwin.zig+46-47
...@@ -613,38 +613,26 @@ pub const MAP = struct {...@@ -613,38 +613,26 @@ pub const MAP = struct {
613 pub const FAILED = @intToPtr(*c_void, maxInt(usize));613 pub const FAILED = @intToPtr(*c_void, maxInt(usize));
614};614};
615615
616/// [XSI] no hang in wait/no child to reap616pub const SA = struct {
617pub const WNOHANG = 0x00000001;617 /// take signal on signal stack
618618 pub const ONSTACK = 0x0001;
619/// [XSI] notify on stop, untraced child619 /// restart system on signal return
620pub const WUNTRACED = 0x00000002;620 pub const RESTART = 0x0002;
621621 /// reset to SIG.DFL when taking signal
622/// take signal on signal stack622 pub const RESETHAND = 0x0004;
623pub const SA_ONSTACK = 0x0001;623 /// do not generate SIG.CHLD on child stop
624624 pub const NOCLDSTOP = 0x0008;
625/// restart system on signal return625 /// don't mask the signal we're delivering
626pub const SA_RESTART = 0x0002;626 pub const NODEFER = 0x0010;
627627 /// don't keep zombies around
628/// reset to SIG.DFL when taking signal628 pub const NOCLDWAIT = 0x0020;
629pub const SA_RESETHAND = 0x0004;629 /// signal handler with SIGINFO args
630630 pub const SIGINFO = 0x0040;
631/// do not generate SIG.CHLD on child stop631 /// do not bounce off kernel's sigtramp
632pub const SA_NOCLDSTOP = 0x0008;632 pub const USERTRAMP = 0x0100;
633633 /// signal handler with SIGINFO args with 64bit regs information
634/// don't mask the signal we're delivering634 pub const @"64REGSET" = 0x0200;
635pub const SA_NODEFER = 0x0010;635};
636
637/// don't keep zombies around
638pub const SA_NOCLDWAIT = 0x0020;
639
640/// signal handler with SA_SIGINFO args
641pub const SA_SIGINFO = 0x0040;
642
643/// do not bounce off kernel's sigtramp
644pub const SA_USERTRAMP = 0x0100;
645
646/// signal handler with SA_SIGINFO args with 64bit regs information
647pub const SA_64REGSET = 0x0200;
648636
649pub const F_OK = 0;637pub const F_OK = 0;
650pub const X_OK = 1;638pub const X_OK = 1;
...@@ -694,19 +682,23 @@ pub const O = struct {...@@ -694,19 +682,23 @@ pub const O = struct {
694 pub const SYNC = 128;682 pub const SYNC = 128;
695};683};
696684
697pub const SEEK_SET = 0x0;685pub const SEEK = struct {
698pub const SEEK_CUR = 0x1;686 pub const SET = 0x0;
699pub const SEEK_END = 0x2;687 pub const CUR = 0x1;
688 pub const END = 0x2;
689};
700690
701pub const DT_UNKNOWN = 0;691pub const DT = struct {
702pub const DT_FIFO = 1;692 pub const UNKNOWN = 0;
703pub const DT_CHR = 2;693 pub const FIFO = 1;
704pub const DT_DIR = 4;694 pub const CHR = 2;
705pub const DT_BLK = 6;695 pub const DIR = 4;
706pub const DT_REG = 8;696 pub const BLK = 6;
707pub const DT_LNK = 10;697 pub const REG = 8;
708pub const DT_SOCK = 12;698 pub const LNK = 10;
709pub const DT_WHT = 14;699 pub const SOCK = 12;
700 pub const WHT = 14;
701};
710702
711/// no flag value703/// no flag value
712pub const KEVENT_FLAG_NONE = 0x000;704pub const KEVENT_FLAG_NONE = 0x000;
...@@ -1070,6 +1062,11 @@ pub const SO = struct {...@@ -1070,6 +1062,11 @@ pub const SO = struct {
1070};1062};
10711063
1072pub const W = struct {1064pub const W = struct {
1065 /// [XSI] no hang in wait/no child to reap
1066 pub const NOHANG = 0x00000001;
1067 /// [XSI] notify on stop, untraced child
1068 pub const UNTRACED = 0x00000002;
1069
1073 pub fn EXITSTATUS(x: u32) u8 {1070 pub fn EXITSTATUS(x: u32) u8 {
1074 return @intCast(u8, x >> 8);1071 return @intCast(u8, x >> 8);
1075 }1072 }
...@@ -1759,9 +1756,11 @@ pub const rlimit = extern struct {...@@ -1759,9 +1756,11 @@ pub const rlimit = extern struct {
1759 max: rlim_t,1756 max: rlim_t,
1760};1757};
17611758
1762pub const SHUT_RD = 0;1759pub const SHUT = struct {
1763pub const SHUT_WR = 1;1760 pub const RD = 0;
1764pub const SHUT_RDWR = 2;1761 pub const WR = 1;
1762 pub const RDWR = 2;
1763};
17651764
1766// Term1765// Term
1767pub const VEOF = 0;1766pub const VEOF = 0;
lib/std/c/dragonfly.zig+61-51
...@@ -182,20 +182,43 @@ pub const MAP = struct {...@@ -182,20 +182,43 @@ pub const MAP = struct {
182 pub const SIZEALIGN = 262144;182 pub const SIZEALIGN = 262144;
183};183};
184184
185pub const WNOHANG = 0x0001;185pub const W = struct {
186pub const WUNTRACED = 0x0002;186 pub const NOHANG = 0x0001;
187pub const WCONTINUED = 0x0004;187 pub const UNTRACED = 0x0002;
188pub const WSTOPPED = WUNTRACED;188 pub const CONTINUED = 0x0004;
189pub const WNOWAIT = 0x0008;189 pub const STOPPED = UNTRACED;
190pub const WEXITED = 0x0010;190 pub const NOWAIT = 0x0008;
191pub const WTRAPPED = 0x0020;191 pub const EXITED = 0x0010;
192192 pub const TRAPPED = 0x0020;
193pub const SA_ONSTACK = 0x0001;193
194pub const SA_RESTART = 0x0002;194 pub fn EXITSTATUS(s: u32) u8 {
195pub const SA_RESETHAND = 0x0004;195 return @intCast(u8, (s & 0xff00) >> 8);
196pub const SA_NODEFER = 0x0010;196 }
197pub const SA_NOCLDWAIT = 0x0020;197 pub fn TERMSIG(s: u32) u32 {
198pub const SA_SIGINFO = 0x0040;198 return s & 0x7f;
199 }
200 pub fn STOPSIG(s: u32) u32 {
201 return EXITSTATUS(s);
202 }
203 pub fn IFEXITED(s: u32) bool {
204 return TERMSIG(s) == 0;
205 }
206 pub fn IFSTOPPED(s: u32) bool {
207 return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
208 }
209 pub fn IFSIGNALED(s: u32) bool {
210 return (s & 0xffff) -% 1 < 0xff;
211 }
212};
213
214pub const SA = struct {
215 pub const ONSTACK = 0x0001;
216 pub const RESTART = 0x0002;
217 pub const RESETHAND = 0x0004;
218 pub const NODEFER = 0x0010;
219 pub const NOCLDWAIT = 0x0020;
220 pub const SIGINFO = 0x0040;
221};
199222
200pub const PATH_MAX = 1024;223pub const PATH_MAX = 1024;
201pub const IOV_MAX = KERN_IOV_MAX;224pub const IOV_MAX = KERN_IOV_MAX;
...@@ -348,11 +371,13 @@ pub const O = struct {...@@ -348,11 +371,13 @@ pub const O = struct {
348 pub const DIRECTORY = 134217728;371 pub const DIRECTORY = 134217728;
349};372};
350373
351pub const SEEK_SET = 0;374pub const SEEK = struct {
352pub const SEEK_CUR = 1;375 pub const SET = 0;
353pub const SEEK_END = 2;376 pub const CUR = 1;
354pub const SEEK_DATA = 3;377 pub const END = 2;
355pub const SEEK_HOLE = 4;378 pub const DATA = 3;
379 pub const HOLE = 4;
380};
356381
357pub const F = struct {382pub const F = struct {
358 pub const ULOCK = 0;383 pub const ULOCK = 0;
...@@ -388,25 +413,6 @@ pub const AT = struct {...@@ -388,25 +413,6 @@ pub const AT = struct {
388 pub const SYMLINK_FOLLOW = 8;413 pub const SYMLINK_FOLLOW = 8;
389};414};
390415
391pub fn WEXITSTATUS(s: u32) u8 {
392 return @intCast(u8, (s & 0xff00) >> 8);
393}
394pub fn WTERMSIG(s: u32) u32 {
395 return s & 0x7f;
396}
397pub fn WSTOPSIG(s: u32) u32 {
398 return WEXITSTATUS(s);
399}
400pub fn WIFEXITED(s: u32) bool {
401 return WTERMSIG(s) == 0;
402}
403pub fn WIFSTOPPED(s: u32) bool {
404 return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
405}
406pub fn WIFSIGNALED(s: u32) bool {
407 return (s & 0xffff) -% 1 < 0xff;
408}
409
410pub const dirent = extern struct {416pub const dirent = extern struct {
411 d_fileno: c_ulong,417 d_fileno: c_ulong,
412 d_namlen: u16,418 d_namlen: u16,
...@@ -420,16 +426,18 @@ pub const dirent = extern struct {...@@ -420,16 +426,18 @@ pub const dirent = extern struct {
420 }426 }
421};427};
422428
423pub const DT_UNKNOWN = 0;429pub const DT = struct {
424pub const DT_FIFO = 1;430 pub const UNKNOWN = 0;
425pub const DT_CHR = 2;431 pub const FIFO = 1;
426pub const DT_DIR = 4;432 pub const CHR = 2;
427pub const DT_BLK = 6;433 pub const DIR = 4;
428pub const DT_REG = 8;434 pub const BLK = 6;
429pub const DT_LNK = 10;435 pub const REG = 8;
430pub const DT_SOCK = 12;436 pub const LNK = 10;
431pub const DT_WHT = 14;437 pub const SOCK = 12;
432pub const DT_DBF = 15;438 pub const WHT = 14;
439 pub const DBF = 15;
440};
433441
434pub const CLOCK = struct {442pub const CLOCK = struct {
435 pub const REALTIME = 0;443 pub const REALTIME = 0;
...@@ -1075,9 +1083,11 @@ pub const rlimit = extern struct {...@@ -1075,9 +1083,11 @@ pub const rlimit = extern struct {
1075 max: rlim_t,1083 max: rlim_t,
1076};1084};
10771085
1078pub const SHUT_RD = 0;1086pub const SHUT = struct {
1079pub const SHUT_WR = 1;1087 pub const RD = 0;
1080pub const SHUT_RDWR = 2;1088 pub const WR = 1;
1089 pub const RDWR = 2;
1090};
10811091
1082pub const nfds_t = u32;1092pub const nfds_t = u32;
10831093
lib/std/c/freebsd.zig+21-15
...@@ -569,9 +569,11 @@ pub const LOCK = struct {...@@ -569,9 +569,11 @@ pub const LOCK = struct {
569569
570pub const FD_CLOEXEC = 1;570pub const FD_CLOEXEC = 1;
571571
572pub const SEEK_SET = 0;572pub const SEEK = struct {
573pub const SEEK_CUR = 1;573 pub const SET = 0;
574pub const SEEK_END = 2;574 pub const CUR = 1;
575 pub const END = 2;
576};
575577
576pub const SOCK = struct {578pub const SOCK = struct {
577 pub const STREAM = 1;579 pub const STREAM = 1;
...@@ -721,15 +723,17 @@ pub const AF = struct {...@@ -721,15 +723,17 @@ pub const AF = struct {
721 pub const MAX = 42;723 pub const MAX = 42;
722};724};
723725
724pub const DT_UNKNOWN = 0;726pub const DT = struct {
725pub const DT_FIFO = 1;727 pub const UNKNOWN = 0;
726pub const DT_CHR = 2;728 pub const FIFO = 1;
727pub const DT_DIR = 4;729 pub const CHR = 2;
728pub const DT_BLK = 6;730 pub const DIR = 4;
729pub const DT_REG = 8;731 pub const BLK = 6;
730pub const DT_LNK = 10;732 pub const REG = 8;
731pub const DT_SOCK = 12;733 pub const LNK = 10;
732pub const DT_WHT = 14;734 pub const SOCK = 12;
735 pub const WHT = 14;
736};
733737
734/// add event to kq (implies enable)738/// add event to kq (implies enable)
735pub const EV_ADD = 0x0001;739pub const EV_ADD = 0x0001;
...@@ -1541,9 +1545,11 @@ pub const rlimit = extern struct {...@@ -1541,9 +1545,11 @@ pub const rlimit = extern struct {
1541 max: rlim_t,1545 max: rlim_t,
1542};1546};
15431547
1544pub const SHUT_RD = 0;1548pub const SHUT = struct {
1545pub const SHUT_WR = 1;1549 pub const RD = 0;
1546pub const SHUT_RDWR = 2;1550 pub const WR = 1;
1551 pub const RDWR = 2;
1552};
15471553
1548pub const nfds_t = u32;1554pub const nfds_t = u32;
15491555
lib/std/c/haiku.zig+67-58
...@@ -408,23 +408,52 @@ pub const MAP = struct {...@@ -408,23 +408,52 @@ pub const MAP = struct {
408 pub const PREFAULT_READ = 0x00040000;408 pub const PREFAULT_READ = 0x00040000;
409 pub const @"32BIT" = 0x00080000;409 pub const @"32BIT" = 0x00080000;
410};410};
411pub const WNOHANG = 0x1;411
412pub const WUNTRACED = 0x2;412pub const W = struct {
413pub const WSTOPPED = 0x10;413 pub const NOHANG = 0x1;
414pub const WCONTINUED = 0x4;414 pub const UNTRACED = 0x2;
415pub const WNOWAIT = 0x20;415 pub const STOPPED = 0x10;
416pub const WEXITED = 0x08;416 pub const CONTINUED = 0x4;
417417 pub const NOWAIT = 0x20;
418pub const SA_ONSTACK = 0x20;418 pub const EXITED = 0x08;
419pub const SA_RESTART = 0x10;419
420pub const SA_RESETHAND = 0x04;420 pub fn EXITSTATUS(s: u32) u8 {
421pub const SA_NOCLDSTOP = 0x01;421 return @intCast(u8, s & 0xff);
422pub const SA_NODEFER = 0x08;422 }
423pub const SA_NOCLDWAIT = 0x02;423
424pub const SA_SIGINFO = 0x40;424 pub fn TERMSIG(s: u32) u32 {
425pub const SA_NOMASK = SA_NODEFER;425 return (s >> 8) & 0xff;
426pub const SA_STACK = SA_ONSTACK;426 }
427pub const SA_ONESHOT = SA_RESETHAND;427
428 pub fn STOPSIG(s: u32) u32 {
429 return EXITSTATUS(s);
430 }
431
432 pub fn IFEXITED(s: u32) bool {
433 return TERMSIG(s) == 0;
434 }
435
436 pub fn IFSTOPPED(s: u32) bool {
437 return ((s >> 16) & 0xff) != 0;
438 }
439
440 pub fn IFSIGNALED(s: u32) bool {
441 return ((s >> 8) & 0xff) != 0;
442 }
443};
444
445pub const SA = struct {
446 pub const ONSTACK = 0x20;
447 pub const RESTART = 0x10;
448 pub const RESETHAND = 0x04;
449 pub const NOCLDSTOP = 0x01;
450 pub const NODEFER = 0x08;
451 pub const NOCLDWAIT = 0x02;
452 pub const SIGINFO = 0x40;
453 pub const NOMASK = NODEFER;
454 pub const STACK = ONSTACK;
455 pub const ONESHOT = RESETHAND;
456};
428457
429pub const SIG = struct {458pub const SIG = struct {
430 pub const ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize));459 pub const ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize));
...@@ -558,9 +587,11 @@ pub const LOCK = struct {...@@ -558,9 +587,11 @@ pub const LOCK = struct {
558587
559pub const FD_CLOEXEC = 1;588pub const FD_CLOEXEC = 1;
560589
561pub const SEEK_SET = 0;590pub const SEEK = struct {
562pub const SEEK_CUR = 1;591 pub const SET = 0;
563pub const SEEK_END = 2;592 pub const CUR = 1;
593 pub const END = 2;
594};
564595
565pub const SOCK = struct {596pub const SOCK = struct {
566 pub const STREAM = 1;597 pub const STREAM = 1;
...@@ -710,15 +741,17 @@ pub const AF = struct {...@@ -710,15 +741,17 @@ pub const AF = struct {
710 pub const MAX = 42;741 pub const MAX = 42;
711};742};
712743
713pub const DT_UNKNOWN = 0;744pub const DT = struct {
714pub const DT_FIFO = 1;745 pub const UNKNOWN = 0;
715pub const DT_CHR = 2;746 pub const FIFO = 1;
716pub const DT_DIR = 4;747 pub const CHR = 2;
717pub const DT_BLK = 6;748 pub const DIR = 4;
718pub const DT_REG = 8;749 pub const BLK = 6;
719pub const DT_LNK = 10;750 pub const REG = 8;
720pub const DT_SOCK = 12;751 pub const LNK = 10;
721pub const DT_WHT = 14;752 pub const SOCK = 12;
753 pub const WHT = 14;
754};
722755
723/// add event to kq (implies enable)756/// add event to kq (implies enable)
724pub const EV_ADD = 0x0001;757pub const EV_ADD = 0x0001;
...@@ -806,32 +839,6 @@ pub const T = struct {...@@ -806,32 +839,6 @@ pub const T = struct {
806 pub const IOCGSID = 0x8024;839 pub const IOCGSID = 0x8024;
807};840};
808841
809pub const W = struct {
810 pub fn EXITSTATUS(s: u32) u8 {
811 return @intCast(u8, s & 0xff);
812 }
813
814 pub fn TERMSIG(s: u32) u32 {
815 return (s >> 8) & 0xff;
816 }
817
818 pub fn STOPSIG(s: u32) u32 {
819 return EXITSTATUS(s);
820 }
821
822 pub fn IFEXITED(s: u32) bool {
823 return TERMSIG(s) == 0;
824 }
825
826 pub fn IFSTOPPED(s: u32) bool {
827 return ((s >> 16) & 0xff) != 0;
828 }
829
830 pub fn IFSIGNALED(s: u32) bool {
831 return ((s >> 8) & 0xff) != 0;
832 }
833};
834
835pub const winsize = extern struct {842pub const winsize = extern struct {
836 ws_row: u16,843 ws_row: u16,
837 ws_col: u16,844 ws_col: u16,
...@@ -1364,9 +1371,11 @@ pub const rlimit = extern struct {...@@ -1364,9 +1371,11 @@ pub const rlimit = extern struct {
1364 max: rlim_t,1371 max: rlim_t,
1365};1372};
13661373
1367pub const SHUT_RD = 0;1374pub const SHUT = struct {
1368pub const SHUT_WR = 1;1375 pub const RD = 0;
1369pub const SHUT_RDWR = 2;1376 pub const WR = 1;
1377 pub const RDWR = 2;
1378};
13701379
1371// TODO fill out if needed1380// TODO fill out if needed
1372pub const directory_which = enum(c_int) {1381pub const directory_which = enum(c_int) {
lib/std/c/linux.zig+1
...@@ -96,6 +96,7 @@ pub const ucontext_t = linux.ucontext_t;...@@ -96,6 +96,7 @@ pub const ucontext_t = linux.ucontext_t;
96pub const uid_t = linux.uid_t;96pub const uid_t = linux.uid_t;
97pub const user_desc = linux.user_desc;97pub const user_desc = linux.user_desc;
98pub const utsname = linux.utsname;98pub const utsname = linux.utsname;
99pub const PR = linux.PR;
99100
100pub const _errno = switch (native_abi) {101pub const _errno = switch (native_abi) {
101 .android => struct {102 .android => struct {
lib/std/c/netbsd.zig+66-55
...@@ -569,21 +569,51 @@ pub const MAP = struct {...@@ -569,21 +569,51 @@ pub const MAP = struct {
569 pub const ANONYMOUS = ANON;569 pub const ANONYMOUS = ANON;
570 pub const STACK = 0x2000;570 pub const STACK = 0x2000;
571};571};
572pub const WNOHANG = 0x00000001;572
573pub const WUNTRACED = 0x00000002;573pub const W = struct {
574pub const WSTOPPED = WUNTRACED;574 pub const NOHANG = 0x00000001;
575pub const WCONTINUED = 0x00000010;575 pub const UNTRACED = 0x00000002;
576pub const WNOWAIT = 0x00010000;576 pub const STOPPED = UNTRACED;
577pub const WEXITED = 0x00000020;577 pub const CONTINUED = 0x00000010;
578pub const WTRAPPED = 0x00000040;578 pub const NOWAIT = 0x00010000;
579579 pub const EXITED = 0x00000020;
580pub const SA_ONSTACK = 0x0001;580 pub const TRAPPED = 0x00000040;
581pub const SA_RESTART = 0x0002;581
582pub const SA_RESETHAND = 0x0004;582 pub fn EXITSTATUS(s: u32) u8 {
583pub const SA_NOCLDSTOP = 0x0008;583 return @intCast(u8, (s >> 8) & 0xff);
584pub const SA_NODEFER = 0x0010;584 }
585pub const SA_NOCLDWAIT = 0x0020;585 pub fn TERMSIG(s: u32) u32 {
586pub const SA_SIGINFO = 0x0040;586 return s & 0x7f;
587 }
588 pub fn STOPSIG(s: u32) u32 {
589 return EXITSTATUS(s);
590 }
591 pub fn IFEXITED(s: u32) bool {
592 return TERMSIG(s) == 0;
593 }
594
595 pub fn IFCONTINUED(s: u32) bool {
596 return ((s & 0x7f) == 0xffff);
597 }
598
599 pub fn IFSTOPPED(s: u32) bool {
600 return ((s & 0x7f != 0x7f) and !IFCONTINUED(s));
601 }
602
603 pub fn IFSIGNALED(s: u32) bool {
604 return !IFSTOPPED(s) and !IFCONTINUED(s) and !IFEXITED(s);
605 }
606};
607
608pub const SA = struct {
609 pub const ONSTACK = 0x0001;
610 pub const RESTART = 0x0002;
611 pub const RESETHAND = 0x0004;
612 pub const NOCLDSTOP = 0x0008;
613 pub const NODEFER = 0x0010;
614 pub const NOCLDWAIT = 0x0020;
615 pub const SIGINFO = 0x0040;
616};
587617
588// access function618// access function
589pub const F_OK = 0; // test for existence of file619pub const F_OK = 0; // test for existence of file
...@@ -666,19 +696,23 @@ pub const LOCK = struct {...@@ -666,19 +696,23 @@ pub const LOCK = struct {
666696
667pub const FD_CLOEXEC = 1;697pub const FD_CLOEXEC = 1;
668698
669pub const SEEK_SET = 0;699pub const SEEK = struct {
670pub const SEEK_CUR = 1;700 pub const SET = 0;
671pub const SEEK_END = 2;701 pub const CUR = 1;
702 pub const END = 2;
703};
672704
673pub const DT_UNKNOWN = 0;705pub const DT = struct {
674pub const DT_FIFO = 1;706 pub const UNKNOWN = 0;
675pub const DT_CHR = 2;707 pub const FIFO = 1;
676pub const DT_DIR = 4;708 pub const CHR = 2;
677pub const DT_BLK = 6;709 pub const DIR = 4;
678pub const DT_REG = 8;710 pub const BLK = 6;
679pub const DT_LNK = 10;711 pub const REG = 8;
680pub const DT_SOCK = 12;712 pub const LNK = 10;
681pub const DT_WHT = 14;713 pub const SOCK = 12;
714 pub const WHT = 14;
715};
682716
683/// add event to kq (implies enable)717/// add event to kq (implies enable)
684pub const EV_ADD = 0x0001;718pub const EV_ADD = 0x0001;
...@@ -845,31 +879,6 @@ pub const T = struct {...@@ -845,31 +879,6 @@ pub const T = struct {
845 pub const IOCXMTFRAME = 0x80087444;879 pub const IOCXMTFRAME = 0x80087444;
846};880};
847881
848pub fn WEXITSTATUS(s: u32) u8 {
849 return @intCast(u8, (s >> 8) & 0xff);
850}
851pub fn WTERMSIG(s: u32) u32 {
852 return s & 0x7f;
853}
854pub fn WSTOPSIG(s: u32) u32 {
855 return WEXITSTATUS(s);
856}
857pub fn WIFEXITED(s: u32) bool {
858 return WTERMSIG(s) == 0;
859}
860
861pub fn WIFCONTINUED(s: u32) bool {
862 return ((s & 0x7f) == 0xffff);
863}
864
865pub fn WIFSTOPPED(s: u32) bool {
866 return ((s & 0x7f != 0x7f) and !WIFCONTINUED(s));
867}
868
869pub fn WIFSIGNALED(s: u32) bool {
870 return !WIFSTOPPED(s) and !WIFCONTINUED(s) and !WIFEXITED(s);
871}
872
873pub const winsize = extern struct {882pub const winsize = extern struct {
874 ws_row: u16,883 ws_row: u16,
875 ws_col: u16,884 ws_col: u16,
...@@ -1388,9 +1397,11 @@ pub const rlimit = extern struct {...@@ -1388,9 +1397,11 @@ pub const rlimit = extern struct {
1388 max: rlim_t,1397 max: rlim_t,
1389};1398};
13901399
1391pub const SHUT_RD = 0;1400pub const SHUT = struct {
1392pub const SHUT_WR = 1;1401 pub const RD = 0;
1393pub const SHUT_RDWR = 2;1402 pub const WR = 1;
1403 pub const RDWR = 2;
1404};
13941405
1395pub const nfds_t = u32;1406pub const nfds_t = u32;
13961407
lib/std/c/openbsd.zig+62-51
...@@ -361,17 +361,47 @@ pub const MAP = struct {...@@ -361,17 +361,47 @@ pub const MAP = struct {
361 pub const STACK = 0x4000;361 pub const STACK = 0x4000;
362 pub const CONCEAL = 0x8000;362 pub const CONCEAL = 0x8000;
363};363};
364pub const WNOHANG = 1;364
365pub const WUNTRACED = 2;365pub const W = struct {
366pub const WCONTINUED = 8;366 pub const NOHANG = 1;
367367 pub const UNTRACED = 2;
368pub const SA_ONSTACK = 0x0001;368 pub const CONTINUED = 8;
369pub const SA_RESTART = 0x0002;369
370pub const SA_RESETHAND = 0x0004;370 pub fn EXITSTATUS(s: u32) u8 {
371pub const SA_NOCLDSTOP = 0x0008;371 return @intCast(u8, (s >> 8) & 0xff);
372pub const SA_NODEFER = 0x0010;372 }
373pub const SA_NOCLDWAIT = 0x0020;373 pub fn TERMSIG(s: u32) u32 {
374pub const SA_SIGINFO = 0x0040;374 return (s & 0x7f);
375 }
376 pub fn STOPSIG(s: u32) u32 {
377 return EXITSTATUS(s);
378 }
379 pub fn IFEXITED(s: u32) bool {
380 return TERMSIG(s) == 0;
381 }
382
383 pub fn IFCONTINUED(s: u32) bool {
384 return ((s & 0o177777) == 0o177777);
385 }
386
387 pub fn IFSTOPPED(s: u32) bool {
388 return (s & 0xff == 0o177);
389 }
390
391 pub fn IFSIGNALED(s: u32) bool {
392 return (((s) & 0o177) != 0o177) and (((s) & 0o177) != 0);
393 }
394};
395
396pub const SA = struct {
397 pub const ONSTACK = 0x0001;
398 pub const RESTART = 0x0002;
399 pub const RESETHAND = 0x0004;
400 pub const NOCLDSTOP = 0x0008;
401 pub const NODEFER = 0x0010;
402 pub const NOCLDWAIT = 0x0020;
403 pub const SIGINFO = 0x0040;
404};
375405
376// access function406// access function
377pub const F_OK = 0; // test for existence of file407pub const F_OK = 0; // test for existence of file
...@@ -448,9 +478,11 @@ pub const LOCK = struct {...@@ -448,9 +478,11 @@ pub const LOCK = struct {
448478
449pub const FD_CLOEXEC = 1;479pub const FD_CLOEXEC = 1;
450480
451pub const SEEK_SET = 0;481pub const SEEK = struct {
452pub const SEEK_CUR = 1;482 pub const SET = 0;
453pub const SEEK_END = 2;483 pub const CUR = 1;
484 pub const END = 2;
485};
454486
455pub const SOCK = struct {487pub const SOCK = struct {
456 pub const STREAM = 1;488 pub const STREAM = 1;
...@@ -530,15 +562,17 @@ pub const AF = struct {...@@ -530,15 +562,17 @@ pub const AF = struct {
530 pub const MAX = 36;562 pub const MAX = 36;
531};563};
532564
533pub const DT_UNKNOWN = 0;565pub const DT = struct {
534pub const DT_FIFO = 1;566 pub const UNKNOWN = 0;
535pub const DT_CHR = 2;567 pub const FIFO = 1;
536pub const DT_DIR = 4;568 pub const CHR = 2;
537pub const DT_BLK = 6;569 pub const DIR = 4;
538pub const DT_REG = 8;570 pub const BLK = 6;
539pub const DT_LNK = 10;571 pub const REG = 8;
540pub const DT_SOCK = 12;572 pub const LNK = 10;
541pub const DT_WHT = 14; // XXX573 pub const SOCK = 12;
574 pub const WHT = 14; // XXX
575};
542576
543pub const EV_ADD = 0x0001;577pub const EV_ADD = 0x0001;
544pub const EV_DELETE = 0x0002;578pub const EV_DELETE = 0x0002;
...@@ -668,31 +702,6 @@ pub const T = struct {...@@ -668,31 +702,6 @@ pub const T = struct {
668 pub const IOCXMTFRAME = 0x80087444;702 pub const IOCXMTFRAME = 0x80087444;
669};703};
670704
671pub fn WEXITSTATUS(s: u32) u8 {
672 return @intCast(u8, (s >> 8) & 0xff);
673}
674pub fn WTERMSIG(s: u32) u32 {
675 return (s & 0x7f);
676}
677pub fn WSTOPSIG(s: u32) u32 {
678 return WEXITSTATUS(s);
679}
680pub fn WIFEXITED(s: u32) bool {
681 return WTERMSIG(s) == 0;
682}
683
684pub fn WIFCONTINUED(s: u32) bool {
685 return ((s & 0o177777) == 0o177777);
686}
687
688pub fn WIFSTOPPED(s: u32) bool {
689 return (s & 0xff == 0o177);
690}
691
692pub fn WIFSIGNALED(s: u32) bool {
693 return (((s) & 0o177) != 0o177) and (((s) & 0o177) != 0);
694}
695
696pub const winsize = extern struct {705pub const winsize = extern struct {
697 ws_row: c_ushort,706 ws_row: c_ushort,
698 ws_col: c_ushort,707 ws_col: c_ushort,
...@@ -1178,9 +1187,11 @@ pub const rlimit = extern struct {...@@ -1178,9 +1187,11 @@ pub const rlimit = extern struct {
1178 max: rlim_t,1187 max: rlim_t,
1179};1188};
11801189
1181pub const SHUT_RD = 0;1190pub const SHUT = struct {
1182pub const SHUT_WR = 1;1191 pub const RD = 0;
1183pub const SHUT_RDWR = 2;1192 pub const WR = 1;
1193 pub const RDWR = 2;
1194};
11841195
1185pub const nfds_t = c_uint;1196pub const nfds_t = c_uint;
11861197
lib/std/c/wasi.zig+4-1
...@@ -8,7 +8,7 @@ pub fn _errno() *c_int {...@@ -8,7 +8,7 @@ pub fn _errno() *c_int {
8 return &errno;8 return &errno;
9}9}
1010
11pub const fd_t = c_int;11pub const fd_t = wasi.fd_t;
12pub const pid_t = c_int;12pub const pid_t = c_int;
13pub const uid_t = u32;13pub const uid_t = u32;
14pub const gid_t = u32;14pub const gid_t = u32;
...@@ -22,6 +22,9 @@ pub const STDIN_FILENO = wasi.STDIN_FILENO;...@@ -22,6 +22,9 @@ pub const STDIN_FILENO = wasi.STDIN_FILENO;
22pub const STDOUT_FILENO = wasi.STDOUT_FILENO;22pub const STDOUT_FILENO = wasi.STDOUT_FILENO;
23pub const E = wasi.E;23pub const E = wasi.E;
24pub const CLOCK = wasi.CLOCK;24pub const CLOCK = wasi.CLOCK;
25pub const S = wasi.S;
26pub const IOV_MAX = wasi.IOV_MAX;
27pub const AT = wasi.AT;
2528
26pub const Stat = extern struct {29pub const Stat = extern struct {
27 dev: i32,30 dev: i32,
lib/std/c/windows.zig+5-3
...@@ -88,9 +88,11 @@ pub const SIG = struct {...@@ -88,9 +88,11 @@ pub const SIG = struct {
88 pub const ERR = -1;88 pub const ERR = -1;
89};89};
9090
91pub const SEEK_SET = 0;91pub const SEEK = struct {
92pub const SEEK_CUR = 1;92 pub const SET = 0;
93pub const SEEK_END = 2;93 pub const CUR = 1;
94 pub const END = 2;
95};
9496
95pub const E = enum(u16) {97pub const E = enum(u16) {
96 /// No error occurred.98 /// No error occurred.
lib/std/fs.zig+17-17
...@@ -344,7 +344,7 @@ pub const Dir = struct {...@@ -344,7 +344,7 @@ pub const Dir = struct {
344 self.index = 0;344 self.index = 0;
345 self.end_index = @intCast(usize, rc);345 self.end_index = @intCast(usize, rc);
346 }346 }
347 const darwin_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]);347 const darwin_entry = @ptrCast(*align(1) os.darwin.dirent, &self.buf[self.index]);
348 const next_index = self.index + darwin_entry.reclen();348 const next_index = self.index + darwin_entry.reclen();
349 self.index = next_index;349 self.index = next_index;
350350
...@@ -355,14 +355,14 @@ pub const Dir = struct {...@@ -355,14 +355,14 @@ pub const Dir = struct {
355 }355 }
356356
357 const entry_kind = switch (darwin_entry.d_type) {357 const entry_kind = switch (darwin_entry.d_type) {
358 os.DT_BLK => Entry.Kind.BlockDevice,358 os.DT.BLK => Entry.Kind.BlockDevice,
359 os.DT_CHR => Entry.Kind.CharacterDevice,359 os.DT.CHR => Entry.Kind.CharacterDevice,
360 os.DT_DIR => Entry.Kind.Directory,360 os.DT.DIR => Entry.Kind.Directory,
361 os.DT_FIFO => Entry.Kind.NamedPipe,361 os.DT.FIFO => Entry.Kind.NamedPipe,
362 os.DT_LNK => Entry.Kind.SymLink,362 os.DT.LNK => Entry.Kind.SymLink,
363 os.DT_REG => Entry.Kind.File,363 os.DT.REG => Entry.Kind.File,
364 os.DT_SOCK => Entry.Kind.UnixDomainSocket,364 os.DT.SOCK => Entry.Kind.UnixDomainSocket,
365 os.DT_WHT => Entry.Kind.Whiteout,365 os.DT.WHT => Entry.Kind.Whiteout,
366 else => Entry.Kind.Unknown,366 else => Entry.Kind.Unknown,
367 };367 };
368 return Entry{368 return Entry{
...@@ -409,14 +409,14 @@ pub const Dir = struct {...@@ -409,14 +409,14 @@ pub const Dir = struct {
409 }409 }
410410
411 const entry_kind = switch (bsd_entry.d_type) {411 const entry_kind = switch (bsd_entry.d_type) {
412 os.DT_BLK => Entry.Kind.BlockDevice,412 os.DT.BLK => Entry.Kind.BlockDevice,
413 os.DT_CHR => Entry.Kind.CharacterDevice,413 os.DT.CHR => Entry.Kind.CharacterDevice,
414 os.DT_DIR => Entry.Kind.Directory,414 os.DT.DIR => Entry.Kind.Directory,
415 os.DT_FIFO => Entry.Kind.NamedPipe,415 os.DT.FIFO => Entry.Kind.NamedPipe,
416 os.DT_LNK => Entry.Kind.SymLink,416 os.DT.LNK => Entry.Kind.SymLink,
417 os.DT_REG => Entry.Kind.File,417 os.DT.REG => Entry.Kind.File,
418 os.DT_SOCK => Entry.Kind.UnixDomainSocket,418 os.DT.SOCK => Entry.Kind.UnixDomainSocket,
419 os.DT_WHT => Entry.Kind.Whiteout,419 os.DT.WHT => Entry.Kind.Whiteout,
420 else => Entry.Kind.Unknown,420 else => Entry.Kind.Unknown,
421 };421 };
422 return Entry{422 return Entry{
lib/std/fs/wasi.zig+1-1
...@@ -175,5 +175,5 @@ test "extracting WASI preopens" {...@@ -175,5 +175,5 @@ test "extracting WASI preopens" {
175 try std.testing.expectEqual(@as(usize, 1), preopens.asSlice().len);175 try std.testing.expectEqual(@as(usize, 1), preopens.asSlice().len);
176 const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable;176 const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable;
177 try std.testing.expect(preopen.@"type".eql(PreopenType{ .Dir = "." }));177 try std.testing.expect(preopen.@"type".eql(PreopenType{ .Dir = "." }));
178 try std.testing.expectEqual(@as(usize, 3), preopen.fd);178 try std.testing.expectEqual(@as(i32, 3), preopen.fd);
179}179}
lib/std/os.zig+1
...@@ -68,6 +68,7 @@ pub const ARCH = system.ARCH;...@@ -68,6 +68,7 @@ pub const ARCH = system.ARCH;
68pub const AT = system.AT;68pub const AT = system.AT;
69pub const CLOCK = system.CLOCK;69pub const CLOCK = system.CLOCK;
70pub const CPU_COUNT = system.CPU_COUNT;70pub const CPU_COUNT = system.CPU_COUNT;
71pub const DT = system.DT;
71pub const E = system.E;72pub const E = system.E;
72pub const Elf_Symndx = system.Elf_Symndx;73pub const Elf_Symndx = system.Elf_Symndx;
73pub const F = system.F;74pub const F = system.F;
lib/std/os/linux.zig+93-154
...@@ -105,18 +105,19 @@ pub const MAP = struct {...@@ -105,18 +105,19 @@ pub const MAP = struct {
105 /// Interpret addr exactly105 /// Interpret addr exactly
106 pub const FIXED = 0x10;106 pub const FIXED = 0x10;
107 /// don't use a file107 /// don't use a file
108 pub const ANONYMOUS = 0x20;108 pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
109 // MAP_ 0x0100 - 0x4000 flags are per architecture
109 /// populate (prefault) pagetables110 /// populate (prefault) pagetables
110 pub const POPULATE = 0x8000;111 pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
111 /// do not block on IO112 /// do not block on IO
112 pub const NONBLOCK = 0x10000;113 pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
113 /// give out an address that is best suited for process/thread stacks114 /// give out an address that is best suited for process/thread stacks
114 pub const STACK = 0x20000;115 pub const STACK = if (is_mips) 0x40000 else 0x20000;
115 /// create a huge page mapping116 /// create a huge page mapping
116 pub const HUGETLB = 0x40000;117 pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
117 /// perform synchronous page faults for the mapping118 /// perform synchronous page faults for the mapping
118 pub const SYNC = 0x80000;119 pub const SYNC = 0x80000;
119 /// FIXED which doesn't unmap underlying mapping120 /// MAP_FIXED which doesn't unmap underlying mapping
120 pub const FIXED_NOREPLACE = 0x100000;121 pub const FIXED_NOREPLACE = 0x100000;
121 /// For anonymous mmap, memory could be uninitialized122 /// For anonymous mmap, memory could be uninitialized
122 pub const UNINITIALIZED = 0x4000000;123 pub const UNINITIALIZED = 0x4000000;
...@@ -2111,154 +2112,92 @@ pub const AF = struct {...@@ -2111,154 +2112,92 @@ pub const AF = struct {
2111 pub const MAX = PF.MAX;2112 pub const MAX = PF.MAX;
2112};2113};
21132114
2114pub const SO = if (is_mips) struct {2115pub const SO = struct {
2115 pub const SECURITY_AUTHENTICATION = 22;2116 pub usingnamespace if (is_mips) struct {
2116 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;2117 pub const DEBUG = 1;
2117 pub const SECURITY_ENCRYPTION_NETWORK = 24;2118 pub const REUSEADDR = 0x0004;
21182119 pub const KEEPALIVE = 0x0008;
2119 pub const BINDTODEVICE = 25;2120 pub const DONTROUTE = 0x0010;
21202121 pub const BROADCAST = 0x0020;
2121 pub const ATTACH_FILTER = 26;2122 pub const LINGER = 0x0080;
2122 pub const DETACH_FILTER = 27;2123 pub const OOBINLINE = 0x0100;
2123 pub const GET_FILTER = ATTACH_FILTER;2124 pub const REUSEPORT = 0x0200;
21242125 pub const SNDBUF = 0x1001;
2125 pub const PEERNAME = 28;2126 pub const RCVBUF = 0x1002;
2126 pub const TIMESTAMP_OLD = 29;2127 pub const SNDLOWAT = 0x1003;
2127 pub const PASSSEC = 34;2128 pub const RCVLOWAT = 0x1004;
2128 pub const TIMESTAMPNS_OLD = 35;2129 pub const RCVTIMEO = 0x1006;
2129 pub const MARK = 36;2130 pub const SNDTIMEO = 0x1005;
2130 pub const TIMESTAMPING_OLD = 37;2131 pub const ERROR = 0x1007;
21312132 pub const TYPE = 0x1008;
2132 pub const RXQ_OVFL = 40;2133 pub const ACCEPTCONN = 0x1009;
2133 pub const WIFI_STATUS = 41;2134 pub const PROTOCOL = 0x1028;
2134 pub const PEEK_OFF = 42;2135 pub const DOMAIN = 0x1029;
2135 pub const NOFCS = 43;2136 pub const NO_CHECK = 11;
2136 pub const LOCK_FILTER = 44;2137 pub const PRIORITY = 12;
2137 pub const SELECT_ERR_QUEUE = 45;2138 pub const BSDCOMPAT = 14;
2138 pub const BUSY_POLL = 46;2139 pub const PASSCRED = 17;
2139 pub const MAX_PACING_RATE = 47;2140 pub const PEERCRED = 18;
2140 pub const BPF_EXTENSIONS = 48;2141 pub const PEERSEC = 30;
2141 pub const INCOMING_CPU = 49;2142 pub const SNDBUFFORCE = 31;
2142 pub const ATTACH_BPF = 50;2143 pub const RCVBUFFORCE = 33;
2143 pub const DETACH_BPF = DETACH_FILTER;2144 } else if (is_ppc or is_ppc64) struct {
2144 pub const ATTACH_REUSEPORT_CBPF = 51;2145 pub const DEBUG = 1;
2145 pub const ATTACH_REUSEPORT_EBPF = 52;2146 pub const REUSEADDR = 2;
2146 pub const CNX_ADVICE = 53;2147 pub const TYPE = 3;
2147 pub const MEMINFO = 55;2148 pub const ERROR = 4;
2148 pub const INCOMING_NAPI_ID = 56;2149 pub const DONTROUTE = 5;
2149 pub const COOKIE = 57;2150 pub const BROADCAST = 6;
2150 pub const PEERGROUPS = 59;2151 pub const SNDBUF = 7;
2151 pub const ZEROCOPY = 60;2152 pub const RCVBUF = 8;
2152 pub const TXTIME = 61;2153 pub const KEEPALIVE = 9;
2153 pub const BINDTOIFINDEX = 62;2154 pub const OOBINLINE = 10;
2154 pub const TIMESTAMP_NEW = 63;2155 pub const NO_CHECK = 11;
2155 pub const TIMESTAMPNS_NEW = 64;2156 pub const PRIORITY = 12;
2156 pub const TIMESTAMPING_NEW = 65;2157 pub const LINGER = 13;
2157 pub const RCVTIMEO_NEW = 66;2158 pub const BSDCOMPAT = 14;
2158 pub const SNDTIMEO_NEW = 67;2159 pub const REUSEPORT = 15;
2159 pub const DETACH_REUSEPORT_BPF = 68;2160 pub const RCVLOWAT = 16;
2160} else if (is_ppc or is_ppc64) struct {2161 pub const SNDLOWAT = 17;
2161 pub const DEBUG = 1;2162 pub const RCVTIMEO = 18;
2162 pub const REUSEADDR = 2;2163 pub const SNDTIMEO = 19;
2163 pub const TYPE = 3;2164 pub const PASSCRED = 20;
2164 pub const ERROR = 4;2165 pub const PEERCRED = 21;
2165 pub const DONTROUTE = 5;2166 pub const ACCEPTCONN = 30;
2166 pub const BROADCAST = 6;2167 pub const PEERSEC = 31;
2167 pub const SNDBUF = 7;2168 pub const SNDBUFFORCE = 32;
2168 pub const RCVBUF = 8;2169 pub const RCVBUFFORCE = 33;
2169 pub const KEEPALIVE = 9;2170 pub const PROTOCOL = 38;
2170 pub const OOBINLINE = 10;2171 pub const DOMAIN = 39;
2171 pub const NO_CHECK = 11;2172 } else struct {
2172 pub const PRIORITY = 12;2173 pub const DEBUG = 1;
2173 pub const LINGER = 13;2174 pub const REUSEADDR = 2;
2174 pub const BSDCOMPAT = 14;2175 pub const TYPE = 3;
2175 pub const REUSEPORT = 15;2176 pub const ERROR = 4;
2176 pub const RCVLOWAT = 16;2177 pub const DONTROUTE = 5;
2177 pub const SNDLOWAT = 17;2178 pub const BROADCAST = 6;
2178 pub const RCVTIMEO = 18;2179 pub const SNDBUF = 7;
2179 pub const SNDTIMEO = 19;2180 pub const RCVBUF = 8;
2180 pub const PASSCRED = 20;2181 pub const KEEPALIVE = 9;
2181 pub const PEERCRED = 21;2182 pub const OOBINLINE = 10;
2182 pub const ACCEPTCONN = 30;2183 pub const NO_CHECK = 11;
2183 pub const PEERSEC = 31;2184 pub const PRIORITY = 12;
2184 pub const SNDBUFFORCE = 32;2185 pub const LINGER = 13;
2185 pub const RCVBUFFORCE = 33;2186 pub const BSDCOMPAT = 14;
2186 pub const PROTOCOL = 38;2187 pub const REUSEPORT = 15;
2187 pub const DOMAIN = 39;2188 pub const PASSCRED = 16;
21882189 pub const PEERCRED = 17;
2189 pub const SECURITY_AUTHENTICATION = 22;2190 pub const RCVLOWAT = 18;
2190 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;2191 pub const SNDLOWAT = 19;
2191 pub const SECURITY_ENCRYPTION_NETWORK = 24;2192 pub const RCVTIMEO = 20;
21922193 pub const SNDTIMEO = 21;
2193 pub const BINDTODEVICE = 25;2194 pub const ACCEPTCONN = 30;
21942195 pub const PEERSEC = 31;
2195 pub const ATTACH_FILTER = 26;2196 pub const SNDBUFFORCE = 32;
2196 pub const DETACH_FILTER = 27;2197 pub const RCVBUFFORCE = 33;
2197 pub const GET_FILTER = ATTACH_FILTER;2198 pub const PROTOCOL = 38;
21982199 pub const DOMAIN = 39;
2199 pub const PEERNAME = 28;2200 };
2200 pub const TIMESTAMP_OLD = 29;
2201 pub const PASSSEC = 34;
2202 pub const TIMESTAMPNS_OLD = 35;
2203 pub const MARK = 36;
2204 pub const TIMESTAMPING_OLD = 37;
2205
2206 pub const RXQ_OVFL = 40;
2207 pub const WIFI_STATUS = 41;
2208 pub const PEEK_OFF = 42;
2209 pub const NOFCS = 43;
2210 pub const LOCK_FILTER = 44;
2211 pub const SELECT_ERR_QUEUE = 45;
2212 pub const BUSY_POLL = 46;
2213 pub const MAX_PACING_RATE = 47;
2214 pub const BPF_EXTENSIONS = 48;
2215 pub const INCOMING_CPU = 49;
2216 pub const ATTACH_BPF = 50;
2217 pub const DETACH_BPF = DETACH_FILTER;
2218 pub const ATTACH_REUSEPORT_CBPF = 51;
2219 pub const ATTACH_REUSEPORT_EBPF = 52;
2220 pub const CNX_ADVICE = 53;
2221 pub const MEMINFO = 55;
2222 pub const INCOMING_NAPI_ID = 56;
2223 pub const COOKIE = 57;
2224 pub const PEERGROUPS = 59;
2225 pub const ZEROCOPY = 60;
2226 pub const TXTIME = 61;
2227 pub const BINDTOIFINDEX = 62;
2228 pub const TIMESTAMP_NEW = 63;
2229 pub const TIMESTAMPNS_NEW = 64;
2230 pub const TIMESTAMPING_NEW = 65;
2231 pub const RCVTIMEO_NEW = 66;
2232 pub const SNDTIMEO_NEW = 67;
2233 pub const DETACH_REUSEPORT_BPF = 68;
2234} else struct {
2235 pub const DEBUG = 1;
2236 pub const REUSEADDR = 2;
2237 pub const TYPE = 3;
2238 pub const ERROR = 4;
2239 pub const DONTROUTE = 5;
2240 pub const BROADCAST = 6;
2241 pub const SNDBUF = 7;
2242 pub const RCVBUF = 8;
2243 pub const KEEPALIVE = 9;
2244 pub const OOBINLINE = 10;
2245 pub const NO_CHECK = 11;
2246 pub const PRIORITY = 12;
2247 pub const LINGER = 13;
2248 pub const BSDCOMPAT = 14;
2249 pub const REUSEPORT = 15;
2250 pub const PASSCRED = 16;
2251 pub const PEERCRED = 17;
2252 pub const RCVLOWAT = 18;
2253 pub const SNDLOWAT = 19;
2254 pub const RCVTIMEO = 20;
2255 pub const SNDTIMEO = 21;
2256 pub const ACCEPTCONN = 30;
2257 pub const PEERSEC = 31;
2258 pub const SNDBUFFORCE = 32;
2259 pub const RCVBUFFORCE = 33;
2260 pub const PROTOCOL = 38;
2261 pub const DOMAIN = 39;
22622201
2263 pub const SECURITY_AUTHENTICATION = 22;2202 pub const SECURITY_AUTHENTICATION = 22;
2264 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;2203 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
lib/std/os/linux/mips.zig-30
...@@ -696,36 +696,6 @@ pub const MAP = struct {...@@ -696,36 +696,6 @@ pub const MAP = struct {
696 pub const @"32BIT" = 0x40;696 pub const @"32BIT" = 0x40;
697};697};
698698
699pub const SO = struct {
700 pub const DEBUG = 1;
701 pub const REUSEADDR = 0x0004;
702 pub const KEEPALIVE = 0x0008;
703 pub const DONTROUTE = 0x0010;
704 pub const BROADCAST = 0x0020;
705 pub const LINGER = 0x0080;
706 pub const OOBINLINE = 0x0100;
707 pub const REUSEPORT = 0x0200;
708 pub const SNDBUF = 0x1001;
709 pub const RCVBUF = 0x1002;
710 pub const SNDLOWAT = 0x1003;
711 pub const RCVLOWAT = 0x1004;
712 pub const RCVTIMEO = 0x1006;
713 pub const SNDTIMEO = 0x1005;
714 pub const ERROR = 0x1007;
715 pub const TYPE = 0x1008;
716 pub const ACCEPTCONN = 0x1009;
717 pub const PROTOCOL = 0x1028;
718 pub const DOMAIN = 0x1029;
719 pub const NO_CHECK = 11;
720 pub const PRIORITY = 12;
721 pub const BSDCOMPAT = 14;
722 pub const PASSCRED = 17;
723 pub const PEERCRED = 18;
724 pub const PEERSEC = 30;
725 pub const SNDBUFFORCE = 31;
726 pub const RCVBUFFORCE = 33;
727};
728
729pub const VDSO = struct {699pub const VDSO = struct {
730 pub const CGT_SYM = "__kernel_clock_gettime";700 pub const CGT_SYM = "__kernel_clock_gettime";
731 pub const CGT_VER = "LINUX_2.6.39";701 pub const CGT_VER = "LINUX_2.6.39";
lib/std/os/wasi.zig+5-3
...@@ -292,7 +292,7 @@ pub const EVENTTYPE_FD_WRITE: eventtype_t = 2;...@@ -292,7 +292,7 @@ pub const EVENTTYPE_FD_WRITE: eventtype_t = 2;
292292
293pub const exitcode_t = u32;293pub const exitcode_t = u32;
294294
295pub const fd_t = u32;295pub const fd_t = i32;
296296
297pub const fdflags_t = u16;297pub const fdflags_t = u16;
298pub const FDFLAG = struct {298pub const FDFLAG = struct {
...@@ -461,8 +461,10 @@ pub const RIGHT = struct {...@@ -461,8 +461,10 @@ pub const RIGHT = struct {
461};461};
462462
463pub const sdflags_t = u8;463pub const sdflags_t = u8;
464pub const SHUT_RD: sdflags_t = 0x01;464pub const SHUT = struct {
465pub const SHUT_WR: sdflags_t = 0x02;465 pub const RD: sdflags_t = 0x01;
466 pub const WR: sdflags_t = 0x02;
467};
466468
467pub const siflags_t = u16;469pub const siflags_t = u16;
468470
test/compile_errors.zig+4-2
...@@ -243,9 +243,9 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -243,9 +243,9 @@ pub fn addCases(ctx: *TestContext) !void {
243243
244 ctx.objErrStage1("array in c exported function",244 ctx.objErrStage1("array in c exported function",
245 \\export fn zig_array(x: [10]u8) void {245 \\export fn zig_array(x: [10]u8) void {
246 \\try expect(std.mem.eql(u8, &x, "1234567890"));246 \\ try std.testing.expect(std.mem.eql(u8, &x, "1234567890"));
247 \\}247 \\}
248 \\248 \\const std = @import("std");
249 \\export fn zig_return_array() [10]u8 {249 \\export fn zig_return_array() [10]u8 {
250 \\ return "1234567890".*;250 \\ return "1234567890".*;
251 \\}251 \\}
...@@ -2787,6 +2787,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -2787,6 +2787,7 @@ pub fn addCases(ctx: *TestContext) !void {
2787 \\ _ = msg; _ = error_return_trace;2787 \\ _ = msg; _ = error_return_trace;
2788 \\ while (true) {}2788 \\ while (true) {}
2789 \\}2789 \\}
2790 \\const builtin = @import("std").builtin;
2790 , &[_][]const u8{2791 , &[_][]const u8{
2791 "error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'",2792 "error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'",
2792 "note: only one of the functions is generic",2793 "note: only one of the functions is generic",
...@@ -2832,6 +2833,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -2832,6 +2833,7 @@ pub fn addCases(ctx: *TestContext) !void {
2832 \\ var s: Foo = Foo.E;2833 \\ var s: Foo = Foo.E;
2833 \\ _ = s;2834 \\ _ = s;
2834 \\}2835 \\}
2836 \\const D = 1;
2835 , &[_][]const u8{2837 , &[_][]const u8{
2836 "tmp.zig:1:17: error: enum 'Foo' depends on itself",2838 "tmp.zig:1:17: error: enum 'Foo' depends on itself",
2837 });2839 });