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) {
5757 else => struct {},
5858};
5959
60pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int;
61
6062pub usingnamespace switch (builtin.os.tag) {
6163 .netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {},
6264 else => struct {
......@@ -106,7 +108,7 @@ pub extern "c" fn exit(code: c_int) noreturn;
106108pub extern "c" fn _exit(code: c_int) noreturn;
107109pub extern "c" fn isatty(fd: c.fd_t) c_int;
108110pub 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;
110112pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;
111113pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;
112114pub 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 {
613613 pub const FAILED = @intToPtr(*c_void, maxInt(usize));
614614};
615615
616/// [XSI] no hang in wait/no child to reap
617pub const WNOHANG = 0x00000001;
618
619/// [XSI] notify on stop, untraced child
620pub const WUNTRACED = 0x00000002;
621
622/// take signal on signal stack
623pub const SA_ONSTACK = 0x0001;
624
625/// restart system on signal return
626pub const SA_RESTART = 0x0002;
627
628/// reset to SIG.DFL when taking signal
629pub const SA_RESETHAND = 0x0004;
630
631/// do not generate SIG.CHLD on child stop
632pub const SA_NOCLDSTOP = 0x0008;
633
634/// don't mask the signal we're delivering
635pub const SA_NODEFER = 0x0010;
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;
616pub const SA = struct {
617 /// take signal on signal stack
618 pub const ONSTACK = 0x0001;
619 /// restart system on signal return
620 pub const RESTART = 0x0002;
621 /// reset to SIG.DFL when taking signal
622 pub const RESETHAND = 0x0004;
623 /// do not generate SIG.CHLD on child stop
624 pub const NOCLDSTOP = 0x0008;
625 /// don't mask the signal we're delivering
626 pub const NODEFER = 0x0010;
627 /// don't keep zombies around
628 pub const NOCLDWAIT = 0x0020;
629 /// signal handler with SIGINFO args
630 pub const SIGINFO = 0x0040;
631 /// do not bounce off kernel's sigtramp
632 pub const USERTRAMP = 0x0100;
633 /// signal handler with SIGINFO args with 64bit regs information
634 pub const @"64REGSET" = 0x0200;
635};
648636
649637pub const F_OK = 0;
650638pub const X_OK = 1;
......@@ -694,19 +682,23 @@ pub const O = struct {
694682 pub const SYNC = 128;
695683};
696684
697pub const SEEK_SET = 0x0;
698pub const SEEK_CUR = 0x1;
699pub const SEEK_END = 0x2;
685pub const SEEK = struct {
686 pub const SET = 0x0;
687 pub const CUR = 0x1;
688 pub const END = 0x2;
689};
700690
701pub const DT_UNKNOWN = 0;
702pub const DT_FIFO = 1;
703pub const DT_CHR = 2;
704pub const DT_DIR = 4;
705pub const DT_BLK = 6;
706pub const DT_REG = 8;
707pub const DT_LNK = 10;
708pub const DT_SOCK = 12;
709pub const DT_WHT = 14;
691pub const DT = struct {
692 pub const UNKNOWN = 0;
693 pub const FIFO = 1;
694 pub const CHR = 2;
695 pub const DIR = 4;
696 pub const BLK = 6;
697 pub const REG = 8;
698 pub const LNK = 10;
699 pub const SOCK = 12;
700 pub const WHT = 14;
701};
710702
711703/// no flag value
712704pub const KEVENT_FLAG_NONE = 0x000;
......@@ -1070,6 +1062,11 @@ pub const SO = struct {
10701062};
10711063
10721064pub 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
10731070 pub fn EXITSTATUS(x: u32) u8 {
10741071 return @intCast(u8, x >> 8);
10751072 }
......@@ -1759,9 +1756,11 @@ pub const rlimit = extern struct {
17591756 max: rlim_t,
17601757};
17611758
1762pub const SHUT_RD = 0;
1763pub const SHUT_WR = 1;
1764pub const SHUT_RDWR = 2;
1759pub const SHUT = struct {
1760 pub const RD = 0;
1761 pub const WR = 1;
1762 pub const RDWR = 2;
1763};
17651764
17661765// Term
17671766pub const VEOF = 0;
lib/std/c/dragonfly.zig+61-51
......@@ -182,20 +182,43 @@ pub const MAP = struct {
182182 pub const SIZEALIGN = 262144;
183183};
184184
185pub const WNOHANG = 0x0001;
186pub const WUNTRACED = 0x0002;
187pub const WCONTINUED = 0x0004;
188pub const WSTOPPED = WUNTRACED;
189pub const WNOWAIT = 0x0008;
190pub const WEXITED = 0x0010;
191pub const WTRAPPED = 0x0020;
192
193pub const SA_ONSTACK = 0x0001;
194pub const SA_RESTART = 0x0002;
195pub const SA_RESETHAND = 0x0004;
196pub const SA_NODEFER = 0x0010;
197pub const SA_NOCLDWAIT = 0x0020;
198pub const SA_SIGINFO = 0x0040;
185pub const W = struct {
186 pub const NOHANG = 0x0001;
187 pub const UNTRACED = 0x0002;
188 pub const CONTINUED = 0x0004;
189 pub const STOPPED = UNTRACED;
190 pub const NOWAIT = 0x0008;
191 pub const EXITED = 0x0010;
192 pub const TRAPPED = 0x0020;
193
194 pub fn EXITSTATUS(s: u32) u8 {
195 return @intCast(u8, (s & 0xff00) >> 8);
196 }
197 pub fn TERMSIG(s: u32) u32 {
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
200223pub const PATH_MAX = 1024;
201224pub const IOV_MAX = KERN_IOV_MAX;
......@@ -348,11 +371,13 @@ pub const O = struct {
348371 pub const DIRECTORY = 134217728;
349372};
350373
351pub const SEEK_SET = 0;
352pub const SEEK_CUR = 1;
353pub const SEEK_END = 2;
354pub const SEEK_DATA = 3;
355pub const SEEK_HOLE = 4;
374pub const SEEK = struct {
375 pub const SET = 0;
376 pub const CUR = 1;
377 pub const END = 2;
378 pub const DATA = 3;
379 pub const HOLE = 4;
380};
356381
357382pub const F = struct {
358383 pub const ULOCK = 0;
......@@ -388,25 +413,6 @@ pub const AT = struct {
388413 pub const SYMLINK_FOLLOW = 8;
389414};
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
410416pub const dirent = extern struct {
411417 d_fileno: c_ulong,
412418 d_namlen: u16,
......@@ -420,16 +426,18 @@ pub const dirent = extern struct {
420426 }
421427};
422428
423pub const DT_UNKNOWN = 0;
424pub const DT_FIFO = 1;
425pub const DT_CHR = 2;
426pub const DT_DIR = 4;
427pub const DT_BLK = 6;
428pub const DT_REG = 8;
429pub const DT_LNK = 10;
430pub const DT_SOCK = 12;
431pub const DT_WHT = 14;
432pub const DT_DBF = 15;
429pub const DT = struct {
430 pub const UNKNOWN = 0;
431 pub const FIFO = 1;
432 pub const CHR = 2;
433 pub const DIR = 4;
434 pub const BLK = 6;
435 pub const REG = 8;
436 pub const LNK = 10;
437 pub const SOCK = 12;
438 pub const WHT = 14;
439 pub const DBF = 15;
440};
433441
434442pub const CLOCK = struct {
435443 pub const REALTIME = 0;
......@@ -1075,9 +1083,11 @@ pub const rlimit = extern struct {
10751083 max: rlim_t,
10761084};
10771085
1078pub const SHUT_RD = 0;
1079pub const SHUT_WR = 1;
1080pub const SHUT_RDWR = 2;
1086pub const SHUT = struct {
1087 pub const RD = 0;
1088 pub const WR = 1;
1089 pub const RDWR = 2;
1090};
10811091
10821092pub const nfds_t = u32;
10831093
lib/std/c/freebsd.zig+21-15
......@@ -569,9 +569,11 @@ pub const LOCK = struct {
569569
570570pub const FD_CLOEXEC = 1;
571571
572pub const SEEK_SET = 0;
573pub const SEEK_CUR = 1;
574pub const SEEK_END = 2;
572pub const SEEK = struct {
573 pub const SET = 0;
574 pub const CUR = 1;
575 pub const END = 2;
576};
575577
576578pub const SOCK = struct {
577579 pub const STREAM = 1;
......@@ -721,15 +723,17 @@ pub const AF = struct {
721723 pub const MAX = 42;
722724};
723725
724pub const DT_UNKNOWN = 0;
725pub const DT_FIFO = 1;
726pub const DT_CHR = 2;
727pub const DT_DIR = 4;
728pub const DT_BLK = 6;
729pub const DT_REG = 8;
730pub const DT_LNK = 10;
731pub const DT_SOCK = 12;
732pub const DT_WHT = 14;
726pub const DT = struct {
727 pub const UNKNOWN = 0;
728 pub const FIFO = 1;
729 pub const CHR = 2;
730 pub const DIR = 4;
731 pub const BLK = 6;
732 pub const REG = 8;
733 pub const LNK = 10;
734 pub const SOCK = 12;
735 pub const WHT = 14;
736};
733737
734738/// add event to kq (implies enable)
735739pub const EV_ADD = 0x0001;
......@@ -1541,9 +1545,11 @@ pub const rlimit = extern struct {
15411545 max: rlim_t,
15421546};
15431547
1544pub const SHUT_RD = 0;
1545pub const SHUT_WR = 1;
1546pub const SHUT_RDWR = 2;
1548pub const SHUT = struct {
1549 pub const RD = 0;
1550 pub const WR = 1;
1551 pub const RDWR = 2;
1552};
15471553
15481554pub const nfds_t = u32;
15491555
lib/std/c/haiku.zig+67-58
......@@ -408,23 +408,52 @@ pub const MAP = struct {
408408 pub const PREFAULT_READ = 0x00040000;
409409 pub const @"32BIT" = 0x00080000;
410410};
411pub const WNOHANG = 0x1;
412pub const WUNTRACED = 0x2;
413pub const WSTOPPED = 0x10;
414pub const WCONTINUED = 0x4;
415pub const WNOWAIT = 0x20;
416pub const WEXITED = 0x08;
417
418pub const SA_ONSTACK = 0x20;
419pub const SA_RESTART = 0x10;
420pub const SA_RESETHAND = 0x04;
421pub const SA_NOCLDSTOP = 0x01;
422pub const SA_NODEFER = 0x08;
423pub const SA_NOCLDWAIT = 0x02;
424pub const SA_SIGINFO = 0x40;
425pub const SA_NOMASK = SA_NODEFER;
426pub const SA_STACK = SA_ONSTACK;
427pub const SA_ONESHOT = SA_RESETHAND;
411
412pub const W = struct {
413 pub const NOHANG = 0x1;
414 pub const UNTRACED = 0x2;
415 pub const STOPPED = 0x10;
416 pub const CONTINUED = 0x4;
417 pub const NOWAIT = 0x20;
418 pub const EXITED = 0x08;
419
420 pub fn EXITSTATUS(s: u32) u8 {
421 return @intCast(u8, s & 0xff);
422 }
423
424 pub fn TERMSIG(s: u32) u32 {
425 return (s >> 8) & 0xff;
426 }
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
429458pub const SIG = struct {
430459 pub const ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize));
......@@ -558,9 +587,11 @@ pub const LOCK = struct {
558587
559588pub const FD_CLOEXEC = 1;
560589
561pub const SEEK_SET = 0;
562pub const SEEK_CUR = 1;
563pub const SEEK_END = 2;
590pub const SEEK = struct {
591 pub const SET = 0;
592 pub const CUR = 1;
593 pub const END = 2;
594};
564595
565596pub const SOCK = struct {
566597 pub const STREAM = 1;
......@@ -710,15 +741,17 @@ pub const AF = struct {
710741 pub const MAX = 42;
711742};
712743
713pub const DT_UNKNOWN = 0;
714pub const DT_FIFO = 1;
715pub const DT_CHR = 2;
716pub const DT_DIR = 4;
717pub const DT_BLK = 6;
718pub const DT_REG = 8;
719pub const DT_LNK = 10;
720pub const DT_SOCK = 12;
721pub const DT_WHT = 14;
744pub const DT = struct {
745 pub const UNKNOWN = 0;
746 pub const FIFO = 1;
747 pub const CHR = 2;
748 pub const DIR = 4;
749 pub const BLK = 6;
750 pub const REG = 8;
751 pub const LNK = 10;
752 pub const SOCK = 12;
753 pub const WHT = 14;
754};
722755
723756/// add event to kq (implies enable)
724757pub const EV_ADD = 0x0001;
......@@ -806,32 +839,6 @@ pub const T = struct {
806839 pub const IOCGSID = 0x8024;
807840};
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
835842pub const winsize = extern struct {
836843 ws_row: u16,
837844 ws_col: u16,
......@@ -1364,9 +1371,11 @@ pub const rlimit = extern struct {
13641371 max: rlim_t,
13651372};
13661373
1367pub const SHUT_RD = 0;
1368pub const SHUT_WR = 1;
1369pub const SHUT_RDWR = 2;
1374pub const SHUT = struct {
1375 pub const RD = 0;
1376 pub const WR = 1;
1377 pub const RDWR = 2;
1378};
13701379
13711380// TODO fill out if needed
13721381pub const directory_which = enum(c_int) {
lib/std/c/linux.zig+1
......@@ -96,6 +96,7 @@ pub const ucontext_t = linux.ucontext_t;
9696pub const uid_t = linux.uid_t;
9797pub const user_desc = linux.user_desc;
9898pub const utsname = linux.utsname;
99pub const PR = linux.PR;
99100
100101pub const _errno = switch (native_abi) {
101102 .android => struct {
lib/std/c/netbsd.zig+66-55
......@@ -569,21 +569,51 @@ pub const MAP = struct {
569569 pub const ANONYMOUS = ANON;
570570 pub const STACK = 0x2000;
571571};
572pub const WNOHANG = 0x00000001;
573pub const WUNTRACED = 0x00000002;
574pub const WSTOPPED = WUNTRACED;
575pub const WCONTINUED = 0x00000010;
576pub const WNOWAIT = 0x00010000;
577pub const WEXITED = 0x00000020;
578pub const WTRAPPED = 0x00000040;
579
580pub const SA_ONSTACK = 0x0001;
581pub const SA_RESTART = 0x0002;
582pub const SA_RESETHAND = 0x0004;
583pub const SA_NOCLDSTOP = 0x0008;
584pub const SA_NODEFER = 0x0010;
585pub const SA_NOCLDWAIT = 0x0020;
586pub const SA_SIGINFO = 0x0040;
572
573pub const W = struct {
574 pub const NOHANG = 0x00000001;
575 pub const UNTRACED = 0x00000002;
576 pub const STOPPED = UNTRACED;
577 pub const CONTINUED = 0x00000010;
578 pub const NOWAIT = 0x00010000;
579 pub const EXITED = 0x00000020;
580 pub const TRAPPED = 0x00000040;
581
582 pub fn EXITSTATUS(s: u32) u8 {
583 return @intCast(u8, (s >> 8) & 0xff);
584 }
585 pub fn TERMSIG(s: u32) u32 {
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
588618// access function
589619pub const F_OK = 0; // test for existence of file
......@@ -666,19 +696,23 @@ pub const LOCK = struct {
666696
667697pub const FD_CLOEXEC = 1;
668698
669pub const SEEK_SET = 0;
670pub const SEEK_CUR = 1;
671pub const SEEK_END = 2;
699pub const SEEK = struct {
700 pub const SET = 0;
701 pub const CUR = 1;
702 pub const END = 2;
703};
672704
673pub const DT_UNKNOWN = 0;
674pub const DT_FIFO = 1;
675pub const DT_CHR = 2;
676pub const DT_DIR = 4;
677pub const DT_BLK = 6;
678pub const DT_REG = 8;
679pub const DT_LNK = 10;
680pub const DT_SOCK = 12;
681pub const DT_WHT = 14;
705pub const DT = struct {
706 pub const UNKNOWN = 0;
707 pub const FIFO = 1;
708 pub const CHR = 2;
709 pub const DIR = 4;
710 pub const BLK = 6;
711 pub const REG = 8;
712 pub const LNK = 10;
713 pub const SOCK = 12;
714 pub const WHT = 14;
715};
682716
683717/// add event to kq (implies enable)
684718pub const EV_ADD = 0x0001;
......@@ -845,31 +879,6 @@ pub const T = struct {
845879 pub const IOCXMTFRAME = 0x80087444;
846880};
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
873882pub const winsize = extern struct {
874883 ws_row: u16,
875884 ws_col: u16,
......@@ -1388,9 +1397,11 @@ pub const rlimit = extern struct {
13881397 max: rlim_t,
13891398};
13901399
1391pub const SHUT_RD = 0;
1392pub const SHUT_WR = 1;
1393pub const SHUT_RDWR = 2;
1400pub const SHUT = struct {
1401 pub const RD = 0;
1402 pub const WR = 1;
1403 pub const RDWR = 2;
1404};
13941405
13951406pub const nfds_t = u32;
13961407
lib/std/c/openbsd.zig+62-51
......@@ -361,17 +361,47 @@ pub const MAP = struct {
361361 pub const STACK = 0x4000;
362362 pub const CONCEAL = 0x8000;
363363};
364pub const WNOHANG = 1;
365pub const WUNTRACED = 2;
366pub const WCONTINUED = 8;
367
368pub const SA_ONSTACK = 0x0001;
369pub const SA_RESTART = 0x0002;
370pub const SA_RESETHAND = 0x0004;
371pub const SA_NOCLDSTOP = 0x0008;
372pub const SA_NODEFER = 0x0010;
373pub const SA_NOCLDWAIT = 0x0020;
374pub const SA_SIGINFO = 0x0040;
364
365pub const W = struct {
366 pub const NOHANG = 1;
367 pub const UNTRACED = 2;
368 pub const CONTINUED = 8;
369
370 pub fn EXITSTATUS(s: u32) u8 {
371 return @intCast(u8, (s >> 8) & 0xff);
372 }
373 pub fn TERMSIG(s: u32) u32 {
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
376406// access function
377407pub const F_OK = 0; // test for existence of file
......@@ -448,9 +478,11 @@ pub const LOCK = struct {
448478
449479pub const FD_CLOEXEC = 1;
450480
451pub const SEEK_SET = 0;
452pub const SEEK_CUR = 1;
453pub const SEEK_END = 2;
481pub const SEEK = struct {
482 pub const SET = 0;
483 pub const CUR = 1;
484 pub const END = 2;
485};
454486
455487pub const SOCK = struct {
456488 pub const STREAM = 1;
......@@ -530,15 +562,17 @@ pub const AF = struct {
530562 pub const MAX = 36;
531563};
532564
533pub const DT_UNKNOWN = 0;
534pub const DT_FIFO = 1;
535pub const DT_CHR = 2;
536pub const DT_DIR = 4;
537pub const DT_BLK = 6;
538pub const DT_REG = 8;
539pub const DT_LNK = 10;
540pub const DT_SOCK = 12;
541pub const DT_WHT = 14; // XXX
565pub const DT = struct {
566 pub const UNKNOWN = 0;
567 pub const FIFO = 1;
568 pub const CHR = 2;
569 pub const DIR = 4;
570 pub const BLK = 6;
571 pub const REG = 8;
572 pub const LNK = 10;
573 pub const SOCK = 12;
574 pub const WHT = 14; // XXX
575};
542576
543577pub const EV_ADD = 0x0001;
544578pub const EV_DELETE = 0x0002;
......@@ -668,31 +702,6 @@ pub const T = struct {
668702 pub const IOCXMTFRAME = 0x80087444;
669703};
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
696705pub const winsize = extern struct {
697706 ws_row: c_ushort,
698707 ws_col: c_ushort,
......@@ -1178,9 +1187,11 @@ pub const rlimit = extern struct {
11781187 max: rlim_t,
11791188};
11801189
1181pub const SHUT_RD = 0;
1182pub const SHUT_WR = 1;
1183pub const SHUT_RDWR = 2;
1190pub const SHUT = struct {
1191 pub const RD = 0;
1192 pub const WR = 1;
1193 pub const RDWR = 2;
1194};
11841195
11851196pub const nfds_t = c_uint;
11861197
lib/std/c/wasi.zig+4-1
......@@ -8,7 +8,7 @@ pub fn _errno() *c_int {
88 return &errno;
99}
1010
11pub const fd_t = c_int;
11pub const fd_t = wasi.fd_t;
1212pub const pid_t = c_int;
1313pub const uid_t = u32;
1414pub const gid_t = u32;
......@@ -22,6 +22,9 @@ pub const STDIN_FILENO = wasi.STDIN_FILENO;
2222pub const STDOUT_FILENO = wasi.STDOUT_FILENO;
2323pub const E = wasi.E;
2424pub const CLOCK = wasi.CLOCK;
25pub const S = wasi.S;
26pub const IOV_MAX = wasi.IOV_MAX;
27pub const AT = wasi.AT;
2528
2629pub const Stat = extern struct {
2730 dev: i32,
lib/std/c/windows.zig+5-3
......@@ -88,9 +88,11 @@ pub const SIG = struct {
8888 pub const ERR = -1;
8989};
9090
91pub const SEEK_SET = 0;
92pub const SEEK_CUR = 1;
93pub const SEEK_END = 2;
91pub const SEEK = struct {
92 pub const SET = 0;
93 pub const CUR = 1;
94 pub const END = 2;
95};
9496
9597pub const E = enum(u16) {
9698 /// No error occurred.
lib/std/fs.zig+17-17
......@@ -344,7 +344,7 @@ pub const Dir = struct {
344344 self.index = 0;
345345 self.end_index = @intCast(usize, rc);
346346 }
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]);
348348 const next_index = self.index + darwin_entry.reclen();
349349 self.index = next_index;
350350
......@@ -355,14 +355,14 @@ pub const Dir = struct {
355355 }
356356
357357 const entry_kind = switch (darwin_entry.d_type) {
358 os.DT_BLK => Entry.Kind.BlockDevice,
359 os.DT_CHR => Entry.Kind.CharacterDevice,
360 os.DT_DIR => Entry.Kind.Directory,
361 os.DT_FIFO => Entry.Kind.NamedPipe,
362 os.DT_LNK => Entry.Kind.SymLink,
363 os.DT_REG => Entry.Kind.File,
364 os.DT_SOCK => Entry.Kind.UnixDomainSocket,
365 os.DT_WHT => Entry.Kind.Whiteout,
358 os.DT.BLK => Entry.Kind.BlockDevice,
359 os.DT.CHR => Entry.Kind.CharacterDevice,
360 os.DT.DIR => Entry.Kind.Directory,
361 os.DT.FIFO => Entry.Kind.NamedPipe,
362 os.DT.LNK => Entry.Kind.SymLink,
363 os.DT.REG => Entry.Kind.File,
364 os.DT.SOCK => Entry.Kind.UnixDomainSocket,
365 os.DT.WHT => Entry.Kind.Whiteout,
366366 else => Entry.Kind.Unknown,
367367 };
368368 return Entry{
......@@ -409,14 +409,14 @@ pub const Dir = struct {
409409 }
410410
411411 const entry_kind = switch (bsd_entry.d_type) {
412 os.DT_BLK => Entry.Kind.BlockDevice,
413 os.DT_CHR => Entry.Kind.CharacterDevice,
414 os.DT_DIR => Entry.Kind.Directory,
415 os.DT_FIFO => Entry.Kind.NamedPipe,
416 os.DT_LNK => Entry.Kind.SymLink,
417 os.DT_REG => Entry.Kind.File,
418 os.DT_SOCK => Entry.Kind.UnixDomainSocket,
419 os.DT_WHT => Entry.Kind.Whiteout,
412 os.DT.BLK => Entry.Kind.BlockDevice,
413 os.DT.CHR => Entry.Kind.CharacterDevice,
414 os.DT.DIR => Entry.Kind.Directory,
415 os.DT.FIFO => Entry.Kind.NamedPipe,
416 os.DT.LNK => Entry.Kind.SymLink,
417 os.DT.REG => Entry.Kind.File,
418 os.DT.SOCK => Entry.Kind.UnixDomainSocket,
419 os.DT.WHT => Entry.Kind.Whiteout,
420420 else => Entry.Kind.Unknown,
421421 };
422422 return Entry{
lib/std/fs/wasi.zig+1-1
......@@ -175,5 +175,5 @@ test "extracting WASI preopens" {
175175 try std.testing.expectEqual(@as(usize, 1), preopens.asSlice().len);
176176 const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable;
177177 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);
179179}
lib/std/os.zig+1
......@@ -68,6 +68,7 @@ pub const ARCH = system.ARCH;
6868pub const AT = system.AT;
6969pub const CLOCK = system.CLOCK;
7070pub const CPU_COUNT = system.CPU_COUNT;
71pub const DT = system.DT;
7172pub const E = system.E;
7273pub const Elf_Symndx = system.Elf_Symndx;
7374pub const F = system.F;
lib/std/os/linux.zig+93-154
......@@ -105,18 +105,19 @@ pub const MAP = struct {
105105 /// Interpret addr exactly
106106 pub const FIXED = 0x10;
107107 /// 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
109110 /// populate (prefault) pagetables
110 pub const POPULATE = 0x8000;
111 pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
111112 /// do not block on IO
112 pub const NONBLOCK = 0x10000;
113 pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
113114 /// 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;
115116 /// create a huge page mapping
116 pub const HUGETLB = 0x40000;
117 pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
117118 /// perform synchronous page faults for the mapping
118119 pub const SYNC = 0x80000;
119 /// FIXED which doesn't unmap underlying mapping
120 /// MAP_FIXED which doesn't unmap underlying mapping
120121 pub const FIXED_NOREPLACE = 0x100000;
121122 /// For anonymous mmap, memory could be uninitialized
122123 pub const UNINITIALIZED = 0x4000000;
......@@ -2111,154 +2112,92 @@ pub const AF = struct {
21112112 pub const MAX = PF.MAX;
21122113};
21132114
2114pub const SO = if (is_mips) struct {
2115 pub const SECURITY_AUTHENTICATION = 22;
2116 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
2117 pub const SECURITY_ENCRYPTION_NETWORK = 24;
2118
2119 pub const BINDTODEVICE = 25;
2120
2121 pub const ATTACH_FILTER = 26;
2122 pub const DETACH_FILTER = 27;
2123 pub const GET_FILTER = ATTACH_FILTER;
2124
2125 pub const PEERNAME = 28;
2126 pub const TIMESTAMP_OLD = 29;
2127 pub const PASSSEC = 34;
2128 pub const TIMESTAMPNS_OLD = 35;
2129 pub const MARK = 36;
2130 pub const TIMESTAMPING_OLD = 37;
2131
2132 pub const RXQ_OVFL = 40;
2133 pub const WIFI_STATUS = 41;
2134 pub const PEEK_OFF = 42;
2135 pub const NOFCS = 43;
2136 pub const LOCK_FILTER = 44;
2137 pub const SELECT_ERR_QUEUE = 45;
2138 pub const BUSY_POLL = 46;
2139 pub const MAX_PACING_RATE = 47;
2140 pub const BPF_EXTENSIONS = 48;
2141 pub const INCOMING_CPU = 49;
2142 pub const ATTACH_BPF = 50;
2143 pub const DETACH_BPF = DETACH_FILTER;
2144 pub const ATTACH_REUSEPORT_CBPF = 51;
2145 pub const ATTACH_REUSEPORT_EBPF = 52;
2146 pub const CNX_ADVICE = 53;
2147 pub const MEMINFO = 55;
2148 pub const INCOMING_NAPI_ID = 56;
2149 pub const COOKIE = 57;
2150 pub const PEERGROUPS = 59;
2151 pub const ZEROCOPY = 60;
2152 pub const TXTIME = 61;
2153 pub const BINDTOIFINDEX = 62;
2154 pub const TIMESTAMP_NEW = 63;
2155 pub const TIMESTAMPNS_NEW = 64;
2156 pub const TIMESTAMPING_NEW = 65;
2157 pub const RCVTIMEO_NEW = 66;
2158 pub const SNDTIMEO_NEW = 67;
2159 pub const DETACH_REUSEPORT_BPF = 68;
2160} else if (is_ppc or is_ppc64) struct {
2161 pub const DEBUG = 1;
2162 pub const REUSEADDR = 2;
2163 pub const TYPE = 3;
2164 pub const ERROR = 4;
2165 pub const DONTROUTE = 5;
2166 pub const BROADCAST = 6;
2167 pub const SNDBUF = 7;
2168 pub const RCVBUF = 8;
2169 pub const KEEPALIVE = 9;
2170 pub const OOBINLINE = 10;
2171 pub const NO_CHECK = 11;
2172 pub const PRIORITY = 12;
2173 pub const LINGER = 13;
2174 pub const BSDCOMPAT = 14;
2175 pub const REUSEPORT = 15;
2176 pub const RCVLOWAT = 16;
2177 pub const SNDLOWAT = 17;
2178 pub const RCVTIMEO = 18;
2179 pub const SNDTIMEO = 19;
2180 pub const PASSCRED = 20;
2181 pub const PEERCRED = 21;
2182 pub const ACCEPTCONN = 30;
2183 pub const PEERSEC = 31;
2184 pub const SNDBUFFORCE = 32;
2185 pub const RCVBUFFORCE = 33;
2186 pub const PROTOCOL = 38;
2187 pub const DOMAIN = 39;
2188
2189 pub const SECURITY_AUTHENTICATION = 22;
2190 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
2191 pub const SECURITY_ENCRYPTION_NETWORK = 24;
2192
2193 pub const BINDTODEVICE = 25;
2194
2195 pub const ATTACH_FILTER = 26;
2196 pub const DETACH_FILTER = 27;
2197 pub const GET_FILTER = ATTACH_FILTER;
2198
2199 pub const PEERNAME = 28;
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;
2115pub const SO = struct {
2116 pub usingnamespace if (is_mips) struct {
2117 pub const DEBUG = 1;
2118 pub const REUSEADDR = 0x0004;
2119 pub const KEEPALIVE = 0x0008;
2120 pub const DONTROUTE = 0x0010;
2121 pub const BROADCAST = 0x0020;
2122 pub const LINGER = 0x0080;
2123 pub const OOBINLINE = 0x0100;
2124 pub const REUSEPORT = 0x0200;
2125 pub const SNDBUF = 0x1001;
2126 pub const RCVBUF = 0x1002;
2127 pub const SNDLOWAT = 0x1003;
2128 pub const RCVLOWAT = 0x1004;
2129 pub const RCVTIMEO = 0x1006;
2130 pub const SNDTIMEO = 0x1005;
2131 pub const ERROR = 0x1007;
2132 pub const TYPE = 0x1008;
2133 pub const ACCEPTCONN = 0x1009;
2134 pub const PROTOCOL = 0x1028;
2135 pub const DOMAIN = 0x1029;
2136 pub const NO_CHECK = 11;
2137 pub const PRIORITY = 12;
2138 pub const BSDCOMPAT = 14;
2139 pub const PASSCRED = 17;
2140 pub const PEERCRED = 18;
2141 pub const PEERSEC = 30;
2142 pub const SNDBUFFORCE = 31;
2143 pub const RCVBUFFORCE = 33;
2144 } else if (is_ppc or is_ppc64) struct {
2145 pub const DEBUG = 1;
2146 pub const REUSEADDR = 2;
2147 pub const TYPE = 3;
2148 pub const ERROR = 4;
2149 pub const DONTROUTE = 5;
2150 pub const BROADCAST = 6;
2151 pub const SNDBUF = 7;
2152 pub const RCVBUF = 8;
2153 pub const KEEPALIVE = 9;
2154 pub const OOBINLINE = 10;
2155 pub const NO_CHECK = 11;
2156 pub const PRIORITY = 12;
2157 pub const LINGER = 13;
2158 pub const BSDCOMPAT = 14;
2159 pub const REUSEPORT = 15;
2160 pub const RCVLOWAT = 16;
2161 pub const SNDLOWAT = 17;
2162 pub const RCVTIMEO = 18;
2163 pub const SNDTIMEO = 19;
2164 pub const PASSCRED = 20;
2165 pub const PEERCRED = 21;
2166 pub const ACCEPTCONN = 30;
2167 pub const PEERSEC = 31;
2168 pub const SNDBUFFORCE = 32;
2169 pub const RCVBUFFORCE = 33;
2170 pub const PROTOCOL = 38;
2171 pub const DOMAIN = 39;
2172 } else struct {
2173 pub const DEBUG = 1;
2174 pub const REUSEADDR = 2;
2175 pub const TYPE = 3;
2176 pub const ERROR = 4;
2177 pub const DONTROUTE = 5;
2178 pub const BROADCAST = 6;
2179 pub const SNDBUF = 7;
2180 pub const RCVBUF = 8;
2181 pub const KEEPALIVE = 9;
2182 pub const OOBINLINE = 10;
2183 pub const NO_CHECK = 11;
2184 pub const PRIORITY = 12;
2185 pub const LINGER = 13;
2186 pub const BSDCOMPAT = 14;
2187 pub const REUSEPORT = 15;
2188 pub const PASSCRED = 16;
2189 pub const PEERCRED = 17;
2190 pub const RCVLOWAT = 18;
2191 pub const SNDLOWAT = 19;
2192 pub const RCVTIMEO = 20;
2193 pub const SNDTIMEO = 21;
2194 pub const ACCEPTCONN = 30;
2195 pub const PEERSEC = 31;
2196 pub const SNDBUFFORCE = 32;
2197 pub const RCVBUFFORCE = 33;
2198 pub const PROTOCOL = 38;
2199 pub const DOMAIN = 39;
2200 };
22622201
22632202 pub const SECURITY_AUTHENTICATION = 22;
22642203 pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
lib/std/os/linux/mips.zig-30
......@@ -696,36 +696,6 @@ pub const MAP = struct {
696696 pub const @"32BIT" = 0x40;
697697};
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
729699pub const VDSO = struct {
730700 pub const CGT_SYM = "__kernel_clock_gettime";
731701 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;
292292
293293pub const exitcode_t = u32;
294294
295pub const fd_t = u32;
295pub const fd_t = i32;
296296
297297pub const fdflags_t = u16;
298298pub const FDFLAG = struct {
......@@ -461,8 +461,10 @@ pub const RIGHT = struct {
461461};
462462
463463pub const sdflags_t = u8;
464pub const SHUT_RD: sdflags_t = 0x01;
465pub const SHUT_WR: sdflags_t = 0x02;
464pub const SHUT = struct {
465 pub const RD: sdflags_t = 0x01;
466 pub const WR: sdflags_t = 0x02;
467};
466468
467469pub const siflags_t = u16;
468470
test/compile_errors.zig+4-2
......@@ -243,9 +243,9 @@ pub fn addCases(ctx: *TestContext) !void {
243243
244244 ctx.objErrStage1("array in c exported function",
245245 \\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"));
247247 \\}
248 \\
248 \\const std = @import("std");
249249 \\export fn zig_return_array() [10]u8 {
250250 \\ return "1234567890".*;
251251 \\}
......@@ -2787,6 +2787,7 @@ pub fn addCases(ctx: *TestContext) !void {
27872787 \\ _ = msg; _ = error_return_trace;
27882788 \\ while (true) {}
27892789 \\}
2790 \\const builtin = @import("std").builtin;
27902791 , &[_][]const u8{
27912792 "error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'",
27922793 "note: only one of the functions is generic",
......@@ -2832,6 +2833,7 @@ pub fn addCases(ctx: *TestContext) !void {
28322833 \\ var s: Foo = Foo.E;
28332834 \\ _ = s;
28342835 \\}
2836 \\const D = 1;
28352837 , &[_][]const u8{
28362838 "tmp.zig:1:17: error: enum 'Foo' depends on itself",
28372839 });