| author | |
| committer | |
| log | 057f0fec33c4e54e87383d1181e946d3cddbc4c0 |
| tree | 506380fe20cdf941ae6f255f7def1da4de6f7418 |
| parent | feec4b0614c1fd64fa59634af8774a992c7a5646 |
17 files changed, 457 insertions(+), 489 deletions(-)
lib/std/c.zig+3-1| ... | ... | @@ -57,6 +57,8 @@ pub usingnamespace switch (builtin.os.tag) { |
| 57 | 57 | else => struct {}, |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int; | |
| 61 | ||
| 60 | 62 | pub usingnamespace switch (builtin.os.tag) { |
| 61 | 63 | .netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {}, |
| 62 | 64 | else => struct { |
| ... | ... | @@ -106,7 +108,7 @@ pub extern "c" fn exit(code: c_int) noreturn; |
| 106 | 108 | pub extern "c" fn _exit(code: c_int) noreturn; |
| 107 | 109 | pub extern "c" fn isatty(fd: c.fd_t) c_int; |
| 108 | 110 | pub extern "c" fn close(fd: c.fd_t) c_int; |
| 109 | pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: c_int) c.off_t; | |
| 111 | pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: whence_t) c.off_t; | |
| 110 | 112 | pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int; |
| 111 | 113 | pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int; |
| 112 | 114 | pub 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 | 613 | pub const FAILED = @intToPtr(*c_void, maxInt(usize)); |
| 614 | 614 | }; |
| 615 | 615 | |
| 616 | /// [XSI] no hang in wait/no child to reap | |
| 617 | pub const WNOHANG = 0x00000001; | |
| 618 | ||
| 619 | /// [XSI] notify on stop, untraced child | |
| 620 | pub const WUNTRACED = 0x00000002; | |
| 621 | ||
| 622 | /// take signal on signal stack | |
| 623 | pub const SA_ONSTACK = 0x0001; | |
| 624 | ||
| 625 | /// restart system on signal return | |
| 626 | pub const SA_RESTART = 0x0002; | |
| 627 | ||
| 628 | /// reset to SIG.DFL when taking signal | |
| 629 | pub const SA_RESETHAND = 0x0004; | |
| 630 | ||
| 631 | /// do not generate SIG.CHLD on child stop | |
| 632 | pub const SA_NOCLDSTOP = 0x0008; | |
| 633 | ||
| 634 | /// don't mask the signal we're delivering | |
| 635 | pub const SA_NODEFER = 0x0010; | |
| 636 | ||
| 637 | /// don't keep zombies around | |
| 638 | pub const SA_NOCLDWAIT = 0x0020; | |
| 639 | ||
| 640 | /// signal handler with SA_SIGINFO args | |
| 641 | pub const SA_SIGINFO = 0x0040; | |
| 642 | ||
| 643 | /// do not bounce off kernel's sigtramp | |
| 644 | pub const SA_USERTRAMP = 0x0100; | |
| 645 | ||
| 646 | /// signal handler with SA_SIGINFO args with 64bit regs information | |
| 647 | pub const SA_64REGSET = 0x0200; | |
| 616 | pub 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 | }; | |
| 648 | 636 | |
| 649 | 637 | pub const F_OK = 0; |
| 650 | 638 | pub const X_OK = 1; |
| ... | ... | @@ -694,19 +682,23 @@ pub const O = struct { |
| 694 | 682 | pub const SYNC = 128; |
| 695 | 683 | }; |
| 696 | 684 | |
| 697 | pub const SEEK_SET = 0x0; | |
| 698 | pub const SEEK_CUR = 0x1; | |
| 699 | pub const SEEK_END = 0x2; | |
| 685 | pub const SEEK = struct { | |
| 686 | pub const SET = 0x0; | |
| 687 | pub const CUR = 0x1; | |
| 688 | pub const END = 0x2; | |
| 689 | }; | |
| 700 | 690 | |
| 701 | pub const DT_UNKNOWN = 0; | |
| 702 | pub const DT_FIFO = 1; | |
| 703 | pub const DT_CHR = 2; | |
| 704 | pub const DT_DIR = 4; | |
| 705 | pub const DT_BLK = 6; | |
| 706 | pub const DT_REG = 8; | |
| 707 | pub const DT_LNK = 10; | |
| 708 | pub const DT_SOCK = 12; | |
| 709 | pub const DT_WHT = 14; | |
| 691 | pub 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 | }; | |
| 710 | 702 | |
| 711 | 703 | /// no flag value |
| 712 | 704 | pub const KEVENT_FLAG_NONE = 0x000; |
| ... | ... | @@ -1070,6 +1062,11 @@ pub const SO = struct { |
| 1070 | 1062 | }; |
| 1071 | 1063 | |
| 1072 | 1064 | pub 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 | 1070 | pub fn EXITSTATUS(x: u32) u8 { |
| 1074 | 1071 | return @intCast(u8, x >> 8); |
| 1075 | 1072 | } |
| ... | ... | @@ -1759,9 +1756,11 @@ pub const rlimit = extern struct { |
| 1759 | 1756 | max: rlim_t, |
| 1760 | 1757 | }; |
| 1761 | 1758 | |
| 1762 | pub const SHUT_RD = 0; | |
| 1763 | pub const SHUT_WR = 1; | |
| 1764 | pub const SHUT_RDWR = 2; | |
| 1759 | pub const SHUT = struct { | |
| 1760 | pub const RD = 0; | |
| 1761 | pub const WR = 1; | |
| 1762 | pub const RDWR = 2; | |
| 1763 | }; | |
| 1765 | 1764 | |
| 1766 | 1765 | // Term |
| 1767 | 1766 | pub const VEOF = 0; |
lib/std/c/dragonfly.zig+61-51| ... | ... | @@ -182,20 +182,43 @@ pub const MAP = struct { |
| 182 | 182 | pub const SIZEALIGN = 262144; |
| 183 | 183 | }; |
| 184 | 184 | |
| 185 | pub const WNOHANG = 0x0001; | |
| 186 | pub const WUNTRACED = 0x0002; | |
| 187 | pub const WCONTINUED = 0x0004; | |
| 188 | pub const WSTOPPED = WUNTRACED; | |
| 189 | pub const WNOWAIT = 0x0008; | |
| 190 | pub const WEXITED = 0x0010; | |
| 191 | pub const WTRAPPED = 0x0020; | |
| 192 | ||
| 193 | pub const SA_ONSTACK = 0x0001; | |
| 194 | pub const SA_RESTART = 0x0002; | |
| 195 | pub const SA_RESETHAND = 0x0004; | |
| 196 | pub const SA_NODEFER = 0x0010; | |
| 197 | pub const SA_NOCLDWAIT = 0x0020; | |
| 198 | pub const SA_SIGINFO = 0x0040; | |
| 185 | pub 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 | ||
| 214 | pub 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 | }; | |
| 199 | 222 | |
| 200 | 223 | pub const PATH_MAX = 1024; |
| 201 | 224 | pub const IOV_MAX = KERN_IOV_MAX; |
| ... | ... | @@ -348,11 +371,13 @@ pub const O = struct { |
| 348 | 371 | pub const DIRECTORY = 134217728; |
| 349 | 372 | }; |
| 350 | 373 | |
| 351 | pub const SEEK_SET = 0; | |
| 352 | pub const SEEK_CUR = 1; | |
| 353 | pub const SEEK_END = 2; | |
| 354 | pub const SEEK_DATA = 3; | |
| 355 | pub const SEEK_HOLE = 4; | |
| 374 | pub 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 | }; | |
| 356 | 381 | |
| 357 | 382 | pub const F = struct { |
| 358 | 383 | pub const ULOCK = 0; |
| ... | ... | @@ -388,25 +413,6 @@ pub const AT = struct { |
| 388 | 413 | pub const SYMLINK_FOLLOW = 8; |
| 389 | 414 | }; |
| 390 | 415 | |
| 391 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 392 | return @intCast(u8, (s & 0xff00) >> 8); | |
| 393 | } | |
| 394 | pub fn WTERMSIG(s: u32) u32 { | |
| 395 | return s & 0x7f; | |
| 396 | } | |
| 397 | pub fn WSTOPSIG(s: u32) u32 { | |
| 398 | return WEXITSTATUS(s); | |
| 399 | } | |
| 400 | pub fn WIFEXITED(s: u32) bool { | |
| 401 | return WTERMSIG(s) == 0; | |
| 402 | } | |
| 403 | pub fn WIFSTOPPED(s: u32) bool { | |
| 404 | return @intCast(u16, (((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00; | |
| 405 | } | |
| 406 | pub fn WIFSIGNALED(s: u32) bool { | |
| 407 | return (s & 0xffff) -% 1 < 0xff; | |
| 408 | } | |
| 409 | ||
| 410 | 416 | pub const dirent = extern struct { |
| 411 | 417 | d_fileno: c_ulong, |
| 412 | 418 | d_namlen: u16, |
| ... | ... | @@ -420,16 +426,18 @@ pub const dirent = extern struct { |
| 420 | 426 | } |
| 421 | 427 | }; |
| 422 | 428 | |
| 423 | pub const DT_UNKNOWN = 0; | |
| 424 | pub const DT_FIFO = 1; | |
| 425 | pub const DT_CHR = 2; | |
| 426 | pub const DT_DIR = 4; | |
| 427 | pub const DT_BLK = 6; | |
| 428 | pub const DT_REG = 8; | |
| 429 | pub const DT_LNK = 10; | |
| 430 | pub const DT_SOCK = 12; | |
| 431 | pub const DT_WHT = 14; | |
| 432 | pub const DT_DBF = 15; | |
| 429 | pub 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 | }; | |
| 433 | 441 | |
| 434 | 442 | pub const CLOCK = struct { |
| 435 | 443 | pub const REALTIME = 0; |
| ... | ... | @@ -1075,9 +1083,11 @@ pub const rlimit = extern struct { |
| 1075 | 1083 | max: rlim_t, |
| 1076 | 1084 | }; |
| 1077 | 1085 | |
| 1078 | pub const SHUT_RD = 0; | |
| 1079 | pub const SHUT_WR = 1; | |
| 1080 | pub const SHUT_RDWR = 2; | |
| 1086 | pub const SHUT = struct { | |
| 1087 | pub const RD = 0; | |
| 1088 | pub const WR = 1; | |
| 1089 | pub const RDWR = 2; | |
| 1090 | }; | |
| 1081 | 1091 | |
| 1082 | 1092 | pub const nfds_t = u32; |
| 1083 | 1093 |
lib/std/c/freebsd.zig+21-15| ... | ... | @@ -569,9 +569,11 @@ pub const LOCK = struct { |
| 569 | 569 | |
| 570 | 570 | pub const FD_CLOEXEC = 1; |
| 571 | 571 | |
| 572 | pub const SEEK_SET = 0; | |
| 573 | pub const SEEK_CUR = 1; | |
| 574 | pub const SEEK_END = 2; | |
| 572 | pub const SEEK = struct { | |
| 573 | pub const SET = 0; | |
| 574 | pub const CUR = 1; | |
| 575 | pub const END = 2; | |
| 576 | }; | |
| 575 | 577 | |
| 576 | 578 | pub const SOCK = struct { |
| 577 | 579 | pub const STREAM = 1; |
| ... | ... | @@ -721,15 +723,17 @@ pub const AF = struct { |
| 721 | 723 | pub const MAX = 42; |
| 722 | 724 | }; |
| 723 | 725 | |
| 724 | pub const DT_UNKNOWN = 0; | |
| 725 | pub const DT_FIFO = 1; | |
| 726 | pub const DT_CHR = 2; | |
| 727 | pub const DT_DIR = 4; | |
| 728 | pub const DT_BLK = 6; | |
| 729 | pub const DT_REG = 8; | |
| 730 | pub const DT_LNK = 10; | |
| 731 | pub const DT_SOCK = 12; | |
| 732 | pub const DT_WHT = 14; | |
| 726 | pub 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 | }; | |
| 733 | 737 | |
| 734 | 738 | /// add event to kq (implies enable) |
| 735 | 739 | pub const EV_ADD = 0x0001; |
| ... | ... | @@ -1541,9 +1545,11 @@ pub const rlimit = extern struct { |
| 1541 | 1545 | max: rlim_t, |
| 1542 | 1546 | }; |
| 1543 | 1547 | |
| 1544 | pub const SHUT_RD = 0; | |
| 1545 | pub const SHUT_WR = 1; | |
| 1546 | pub const SHUT_RDWR = 2; | |
| 1548 | pub const SHUT = struct { | |
| 1549 | pub const RD = 0; | |
| 1550 | pub const WR = 1; | |
| 1551 | pub const RDWR = 2; | |
| 1552 | }; | |
| 1547 | 1553 | |
| 1548 | 1554 | pub const nfds_t = u32; |
| 1549 | 1555 |
lib/std/c/haiku.zig+67-58| ... | ... | @@ -408,23 +408,52 @@ pub const MAP = struct { |
| 408 | 408 | pub const PREFAULT_READ = 0x00040000; |
| 409 | 409 | pub const @"32BIT" = 0x00080000; |
| 410 | 410 | }; |
| 411 | pub const WNOHANG = 0x1; | |
| 412 | pub const WUNTRACED = 0x2; | |
| 413 | pub const WSTOPPED = 0x10; | |
| 414 | pub const WCONTINUED = 0x4; | |
| 415 | pub const WNOWAIT = 0x20; | |
| 416 | pub const WEXITED = 0x08; | |
| 417 | ||
| 418 | pub const SA_ONSTACK = 0x20; | |
| 419 | pub const SA_RESTART = 0x10; | |
| 420 | pub const SA_RESETHAND = 0x04; | |
| 421 | pub const SA_NOCLDSTOP = 0x01; | |
| 422 | pub const SA_NODEFER = 0x08; | |
| 423 | pub const SA_NOCLDWAIT = 0x02; | |
| 424 | pub const SA_SIGINFO = 0x40; | |
| 425 | pub const SA_NOMASK = SA_NODEFER; | |
| 426 | pub const SA_STACK = SA_ONSTACK; | |
| 427 | pub const SA_ONESHOT = SA_RESETHAND; | |
| 411 | ||
| 412 | pub 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 | ||
| 445 | pub 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 | }; | |
| 428 | 457 | |
| 429 | 458 | pub const SIG = struct { |
| 430 | 459 | pub const ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize)); |
| ... | ... | @@ -558,9 +587,11 @@ pub const LOCK = struct { |
| 558 | 587 | |
| 559 | 588 | pub const FD_CLOEXEC = 1; |
| 560 | 589 | |
| 561 | pub const SEEK_SET = 0; | |
| 562 | pub const SEEK_CUR = 1; | |
| 563 | pub const SEEK_END = 2; | |
| 590 | pub const SEEK = struct { | |
| 591 | pub const SET = 0; | |
| 592 | pub const CUR = 1; | |
| 593 | pub const END = 2; | |
| 594 | }; | |
| 564 | 595 | |
| 565 | 596 | pub const SOCK = struct { |
| 566 | 597 | pub const STREAM = 1; |
| ... | ... | @@ -710,15 +741,17 @@ pub const AF = struct { |
| 710 | 741 | pub const MAX = 42; |
| 711 | 742 | }; |
| 712 | 743 | |
| 713 | pub const DT_UNKNOWN = 0; | |
| 714 | pub const DT_FIFO = 1; | |
| 715 | pub const DT_CHR = 2; | |
| 716 | pub const DT_DIR = 4; | |
| 717 | pub const DT_BLK = 6; | |
| 718 | pub const DT_REG = 8; | |
| 719 | pub const DT_LNK = 10; | |
| 720 | pub const DT_SOCK = 12; | |
| 721 | pub const DT_WHT = 14; | |
| 744 | pub 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 | }; | |
| 722 | 755 | |
| 723 | 756 | /// add event to kq (implies enable) |
| 724 | 757 | pub const EV_ADD = 0x0001; |
| ... | ... | @@ -806,32 +839,6 @@ pub const T = struct { |
| 806 | 839 | pub const IOCGSID = 0x8024; |
| 807 | 840 | }; |
| 808 | 841 | |
| 809 | pub 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 | ||
| 835 | 842 | pub const winsize = extern struct { |
| 836 | 843 | ws_row: u16, |
| 837 | 844 | ws_col: u16, |
| ... | ... | @@ -1364,9 +1371,11 @@ pub const rlimit = extern struct { |
| 1364 | 1371 | max: rlim_t, |
| 1365 | 1372 | }; |
| 1366 | 1373 | |
| 1367 | pub const SHUT_RD = 0; | |
| 1368 | pub const SHUT_WR = 1; | |
| 1369 | pub const SHUT_RDWR = 2; | |
| 1374 | pub const SHUT = struct { | |
| 1375 | pub const RD = 0; | |
| 1376 | pub const WR = 1; | |
| 1377 | pub const RDWR = 2; | |
| 1378 | }; | |
| 1370 | 1379 | |
| 1371 | 1380 | // TODO fill out if needed |
| 1372 | 1381 | pub const directory_which = enum(c_int) { |
lib/std/c/linux.zig+1| ... | ... | @@ -96,6 +96,7 @@ pub const ucontext_t = linux.ucontext_t; |
| 96 | 96 | pub const uid_t = linux.uid_t; |
| 97 | 97 | pub const user_desc = linux.user_desc; |
| 98 | 98 | pub const utsname = linux.utsname; |
| 99 | pub const PR = linux.PR; | |
| 99 | 100 | |
| 100 | 101 | pub const _errno = switch (native_abi) { |
| 101 | 102 | .android => struct { |
lib/std/c/netbsd.zig+66-55| ... | ... | @@ -569,21 +569,51 @@ pub const MAP = struct { |
| 569 | 569 | pub const ANONYMOUS = ANON; |
| 570 | 570 | pub const STACK = 0x2000; |
| 571 | 571 | }; |
| 572 | pub const WNOHANG = 0x00000001; | |
| 573 | pub const WUNTRACED = 0x00000002; | |
| 574 | pub const WSTOPPED = WUNTRACED; | |
| 575 | pub const WCONTINUED = 0x00000010; | |
| 576 | pub const WNOWAIT = 0x00010000; | |
| 577 | pub const WEXITED = 0x00000020; | |
| 578 | pub const WTRAPPED = 0x00000040; | |
| 579 | ||
| 580 | pub const SA_ONSTACK = 0x0001; | |
| 581 | pub const SA_RESTART = 0x0002; | |
| 582 | pub const SA_RESETHAND = 0x0004; | |
| 583 | pub const SA_NOCLDSTOP = 0x0008; | |
| 584 | pub const SA_NODEFER = 0x0010; | |
| 585 | pub const SA_NOCLDWAIT = 0x0020; | |
| 586 | pub const SA_SIGINFO = 0x0040; | |
| 572 | ||
| 573 | pub 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 | ||
| 608 | pub 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 | }; | |
| 587 | 617 | |
| 588 | 618 | // access function |
| 589 | 619 | pub const F_OK = 0; // test for existence of file |
| ... | ... | @@ -666,19 +696,23 @@ pub const LOCK = struct { |
| 666 | 696 | |
| 667 | 697 | pub const FD_CLOEXEC = 1; |
| 668 | 698 | |
| 669 | pub const SEEK_SET = 0; | |
| 670 | pub const SEEK_CUR = 1; | |
| 671 | pub const SEEK_END = 2; | |
| 699 | pub const SEEK = struct { | |
| 700 | pub const SET = 0; | |
| 701 | pub const CUR = 1; | |
| 702 | pub const END = 2; | |
| 703 | }; | |
| 672 | 704 | |
| 673 | pub const DT_UNKNOWN = 0; | |
| 674 | pub const DT_FIFO = 1; | |
| 675 | pub const DT_CHR = 2; | |
| 676 | pub const DT_DIR = 4; | |
| 677 | pub const DT_BLK = 6; | |
| 678 | pub const DT_REG = 8; | |
| 679 | pub const DT_LNK = 10; | |
| 680 | pub const DT_SOCK = 12; | |
| 681 | pub const DT_WHT = 14; | |
| 705 | pub 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 | }; | |
| 682 | 716 | |
| 683 | 717 | /// add event to kq (implies enable) |
| 684 | 718 | pub const EV_ADD = 0x0001; |
| ... | ... | @@ -845,31 +879,6 @@ pub const T = struct { |
| 845 | 879 | pub const IOCXMTFRAME = 0x80087444; |
| 846 | 880 | }; |
| 847 | 881 | |
| 848 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 849 | return @intCast(u8, (s >> 8) & 0xff); | |
| 850 | } | |
| 851 | pub fn WTERMSIG(s: u32) u32 { | |
| 852 | return s & 0x7f; | |
| 853 | } | |
| 854 | pub fn WSTOPSIG(s: u32) u32 { | |
| 855 | return WEXITSTATUS(s); | |
| 856 | } | |
| 857 | pub fn WIFEXITED(s: u32) bool { | |
| 858 | return WTERMSIG(s) == 0; | |
| 859 | } | |
| 860 | ||
| 861 | pub fn WIFCONTINUED(s: u32) bool { | |
| 862 | return ((s & 0x7f) == 0xffff); | |
| 863 | } | |
| 864 | ||
| 865 | pub fn WIFSTOPPED(s: u32) bool { | |
| 866 | return ((s & 0x7f != 0x7f) and !WIFCONTINUED(s)); | |
| 867 | } | |
| 868 | ||
| 869 | pub fn WIFSIGNALED(s: u32) bool { | |
| 870 | return !WIFSTOPPED(s) and !WIFCONTINUED(s) and !WIFEXITED(s); | |
| 871 | } | |
| 872 | ||
| 873 | 882 | pub const winsize = extern struct { |
| 874 | 883 | ws_row: u16, |
| 875 | 884 | ws_col: u16, |
| ... | ... | @@ -1388,9 +1397,11 @@ pub const rlimit = extern struct { |
| 1388 | 1397 | max: rlim_t, |
| 1389 | 1398 | }; |
| 1390 | 1399 | |
| 1391 | pub const SHUT_RD = 0; | |
| 1392 | pub const SHUT_WR = 1; | |
| 1393 | pub const SHUT_RDWR = 2; | |
| 1400 | pub const SHUT = struct { | |
| 1401 | pub const RD = 0; | |
| 1402 | pub const WR = 1; | |
| 1403 | pub const RDWR = 2; | |
| 1404 | }; | |
| 1394 | 1405 | |
| 1395 | 1406 | pub const nfds_t = u32; |
| 1396 | 1407 |
lib/std/c/openbsd.zig+62-51| ... | ... | @@ -361,17 +361,47 @@ pub const MAP = struct { |
| 361 | 361 | pub const STACK = 0x4000; |
| 362 | 362 | pub const CONCEAL = 0x8000; |
| 363 | 363 | }; |
| 364 | pub const WNOHANG = 1; | |
| 365 | pub const WUNTRACED = 2; | |
| 366 | pub const WCONTINUED = 8; | |
| 367 | ||
| 368 | pub const SA_ONSTACK = 0x0001; | |
| 369 | pub const SA_RESTART = 0x0002; | |
| 370 | pub const SA_RESETHAND = 0x0004; | |
| 371 | pub const SA_NOCLDSTOP = 0x0008; | |
| 372 | pub const SA_NODEFER = 0x0010; | |
| 373 | pub const SA_NOCLDWAIT = 0x0020; | |
| 374 | pub const SA_SIGINFO = 0x0040; | |
| 364 | ||
| 365 | pub 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 | ||
| 396 | pub 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 | }; | |
| 375 | 405 | |
| 376 | 406 | // access function |
| 377 | 407 | pub const F_OK = 0; // test for existence of file |
| ... | ... | @@ -448,9 +478,11 @@ pub const LOCK = struct { |
| 448 | 478 | |
| 449 | 479 | pub const FD_CLOEXEC = 1; |
| 450 | 480 | |
| 451 | pub const SEEK_SET = 0; | |
| 452 | pub const SEEK_CUR = 1; | |
| 453 | pub const SEEK_END = 2; | |
| 481 | pub const SEEK = struct { | |
| 482 | pub const SET = 0; | |
| 483 | pub const CUR = 1; | |
| 484 | pub const END = 2; | |
| 485 | }; | |
| 454 | 486 | |
| 455 | 487 | pub const SOCK = struct { |
| 456 | 488 | pub const STREAM = 1; |
| ... | ... | @@ -530,15 +562,17 @@ pub const AF = struct { |
| 530 | 562 | pub const MAX = 36; |
| 531 | 563 | }; |
| 532 | 564 | |
| 533 | pub const DT_UNKNOWN = 0; | |
| 534 | pub const DT_FIFO = 1; | |
| 535 | pub const DT_CHR = 2; | |
| 536 | pub const DT_DIR = 4; | |
| 537 | pub const DT_BLK = 6; | |
| 538 | pub const DT_REG = 8; | |
| 539 | pub const DT_LNK = 10; | |
| 540 | pub const DT_SOCK = 12; | |
| 541 | pub const DT_WHT = 14; // XXX | |
| 565 | pub 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 | }; | |
| 542 | 576 | |
| 543 | 577 | pub const EV_ADD = 0x0001; |
| 544 | 578 | pub const EV_DELETE = 0x0002; |
| ... | ... | @@ -668,31 +702,6 @@ pub const T = struct { |
| 668 | 702 | pub const IOCXMTFRAME = 0x80087444; |
| 669 | 703 | }; |
| 670 | 704 | |
| 671 | pub fn WEXITSTATUS(s: u32) u8 { | |
| 672 | return @intCast(u8, (s >> 8) & 0xff); | |
| 673 | } | |
| 674 | pub fn WTERMSIG(s: u32) u32 { | |
| 675 | return (s & 0x7f); | |
| 676 | } | |
| 677 | pub fn WSTOPSIG(s: u32) u32 { | |
| 678 | return WEXITSTATUS(s); | |
| 679 | } | |
| 680 | pub fn WIFEXITED(s: u32) bool { | |
| 681 | return WTERMSIG(s) == 0; | |
| 682 | } | |
| 683 | ||
| 684 | pub fn WIFCONTINUED(s: u32) bool { | |
| 685 | return ((s & 0o177777) == 0o177777); | |
| 686 | } | |
| 687 | ||
| 688 | pub fn WIFSTOPPED(s: u32) bool { | |
| 689 | return (s & 0xff == 0o177); | |
| 690 | } | |
| 691 | ||
| 692 | pub fn WIFSIGNALED(s: u32) bool { | |
| 693 | return (((s) & 0o177) != 0o177) and (((s) & 0o177) != 0); | |
| 694 | } | |
| 695 | ||
| 696 | 705 | pub const winsize = extern struct { |
| 697 | 706 | ws_row: c_ushort, |
| 698 | 707 | ws_col: c_ushort, |
| ... | ... | @@ -1178,9 +1187,11 @@ pub const rlimit = extern struct { |
| 1178 | 1187 | max: rlim_t, |
| 1179 | 1188 | }; |
| 1180 | 1189 | |
| 1181 | pub const SHUT_RD = 0; | |
| 1182 | pub const SHUT_WR = 1; | |
| 1183 | pub const SHUT_RDWR = 2; | |
| 1190 | pub const SHUT = struct { | |
| 1191 | pub const RD = 0; | |
| 1192 | pub const WR = 1; | |
| 1193 | pub const RDWR = 2; | |
| 1194 | }; | |
| 1184 | 1195 | |
| 1185 | 1196 | pub const nfds_t = c_uint; |
| 1186 | 1197 |
lib/std/c/wasi.zig+4-1| ... | ... | @@ -8,7 +8,7 @@ pub fn _errno() *c_int { |
| 8 | 8 | return &errno; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | pub const fd_t = c_int; | |
| 11 | pub const fd_t = wasi.fd_t; | |
| 12 | 12 | pub const pid_t = c_int; |
| 13 | 13 | pub const uid_t = u32; |
| 14 | 14 | pub const gid_t = u32; |
| ... | ... | @@ -22,6 +22,9 @@ pub const STDIN_FILENO = wasi.STDIN_FILENO; |
| 22 | 22 | pub const STDOUT_FILENO = wasi.STDOUT_FILENO; |
| 23 | 23 | pub const E = wasi.E; |
| 24 | 24 | pub const CLOCK = wasi.CLOCK; |
| 25 | pub const S = wasi.S; | |
| 26 | pub const IOV_MAX = wasi.IOV_MAX; | |
| 27 | pub const AT = wasi.AT; | |
| 25 | 28 | |
| 26 | 29 | pub const Stat = extern struct { |
| 27 | 30 | dev: i32, |
lib/std/c/windows.zig+5-3| ... | ... | @@ -88,9 +88,11 @@ pub const SIG = struct { |
| 88 | 88 | pub const ERR = -1; |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | pub const SEEK_SET = 0; | |
| 92 | pub const SEEK_CUR = 1; | |
| 93 | pub const SEEK_END = 2; | |
| 91 | pub const SEEK = struct { | |
| 92 | pub const SET = 0; | |
| 93 | pub const CUR = 1; | |
| 94 | pub const END = 2; | |
| 95 | }; | |
| 94 | 96 | |
| 95 | 97 | pub const E = enum(u16) { |
| 96 | 98 | /// No error occurred. |
lib/std/fs.zig+17-17| ... | ... | @@ -344,7 +344,7 @@ pub const Dir = struct { |
| 344 | 344 | self.index = 0; |
| 345 | 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 | 348 | const next_index = self.index + darwin_entry.reclen(); |
| 349 | 349 | self.index = next_index; |
| 350 | 350 | |
| ... | ... | @@ -355,14 +355,14 @@ pub const Dir = struct { |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | 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, | |
| 366 | 366 | else => Entry.Kind.Unknown, |
| 367 | 367 | }; |
| 368 | 368 | return Entry{ |
| ... | ... | @@ -409,14 +409,14 @@ pub const Dir = struct { |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | 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, | |
| 420 | 420 | else => Entry.Kind.Unknown, |
| 421 | 421 | }; |
| 422 | 422 | return Entry{ |
lib/std/fs/wasi.zig+1-1| ... | ... | @@ -175,5 +175,5 @@ test "extracting WASI preopens" { |
| 175 | 175 | try std.testing.expectEqual(@as(usize, 1), preopens.asSlice().len); |
| 176 | 176 | const preopen = preopens.find(PreopenType{ .Dir = "." }) orelse unreachable; |
| 177 | 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 | 68 | pub const AT = system.AT; |
| 69 | 69 | pub const CLOCK = system.CLOCK; |
| 70 | 70 | pub const CPU_COUNT = system.CPU_COUNT; |
| 71 | pub const DT = system.DT; | |
| 71 | 72 | pub const E = system.E; |
| 72 | 73 | pub const Elf_Symndx = system.Elf_Symndx; |
| 73 | 74 | pub const F = system.F; |
lib/std/os/linux.zig+93-154| ... | ... | @@ -105,18 +105,19 @@ pub const MAP = struct { |
| 105 | 105 | /// Interpret addr exactly |
| 106 | 106 | pub const FIXED = 0x10; |
| 107 | 107 | /// 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 | 110 | /// populate (prefault) pagetables |
| 110 | pub const POPULATE = 0x8000; | |
| 111 | pub const POPULATE = if (is_mips) 0x10000 else 0x8000; | |
| 111 | 112 | /// do not block on IO |
| 112 | pub const NONBLOCK = 0x10000; | |
| 113 | pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000; | |
| 113 | 114 | /// 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 | 116 | /// create a huge page mapping |
| 116 | pub const HUGETLB = 0x40000; | |
| 117 | pub const HUGETLB = if (is_mips) 0x80000 else 0x40000; | |
| 117 | 118 | /// perform synchronous page faults for the mapping |
| 118 | 119 | pub const SYNC = 0x80000; |
| 119 | /// FIXED which doesn't unmap underlying mapping | |
| 120 | /// MAP_FIXED which doesn't unmap underlying mapping | |
| 120 | 121 | pub const FIXED_NOREPLACE = 0x100000; |
| 121 | 122 | /// For anonymous mmap, memory could be uninitialized |
| 122 | 123 | pub const UNINITIALIZED = 0x4000000; |
| ... | ... | @@ -2111,154 +2112,92 @@ pub const AF = struct { |
| 2111 | 2112 | pub const MAX = PF.MAX; |
| 2112 | 2113 | }; |
| 2113 | 2114 | |
| 2114 | pub 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; | |
| 2115 | pub 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 | }; | |
| 2262 | 2201 | |
| 2263 | 2202 | pub const SECURITY_AUTHENTICATION = 22; |
| 2264 | 2203 | pub const SECURITY_ENCRYPTION_TRANSPORT = 23; |
lib/std/os/linux/mips.zig-30| ... | ... | @@ -696,36 +696,6 @@ pub const MAP = struct { |
| 696 | 696 | pub const @"32BIT" = 0x40; |
| 697 | 697 | }; |
| 698 | 698 | |
| 699 | pub 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 | ||
| 729 | 699 | pub const VDSO = struct { |
| 730 | 700 | pub const CGT_SYM = "__kernel_clock_gettime"; |
| 731 | 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 | 292 | |
| 293 | 293 | pub const exitcode_t = u32; |
| 294 | 294 | |
| 295 | pub const fd_t = u32; | |
| 295 | pub const fd_t = i32; | |
| 296 | 296 | |
| 297 | 297 | pub const fdflags_t = u16; |
| 298 | 298 | pub const FDFLAG = struct { |
| ... | ... | @@ -461,8 +461,10 @@ pub const RIGHT = struct { |
| 461 | 461 | }; |
| 462 | 462 | |
| 463 | 463 | pub const sdflags_t = u8; |
| 464 | pub const SHUT_RD: sdflags_t = 0x01; | |
| 465 | pub const SHUT_WR: sdflags_t = 0x02; | |
| 464 | pub const SHUT = struct { | |
| 465 | pub const RD: sdflags_t = 0x01; | |
| 466 | pub const WR: sdflags_t = 0x02; | |
| 467 | }; | |
| 466 | 468 | |
| 467 | 469 | pub const siflags_t = u16; |
| 468 | 470 |
test/compile_errors.zig+4-2| ... | ... | @@ -243,9 +243,9 @@ pub fn addCases(ctx: *TestContext) !void { |
| 243 | 243 | |
| 244 | 244 | ctx.objErrStage1("array in c exported function", |
| 245 | 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 | 249 | \\export fn zig_return_array() [10]u8 { |
| 250 | 250 | \\ return "1234567890".*; |
| 251 | 251 | \\} |
| ... | ... | @@ -2787,6 +2787,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 2787 | 2787 | \\ _ = msg; _ = error_return_trace; |
| 2788 | 2788 | \\ while (true) {} |
| 2789 | 2789 | \\} |
| 2790 | \\const builtin = @import("std").builtin; | |
| 2790 | 2791 | , &[_][]const u8{ |
| 2791 | 2792 | "error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'", |
| 2792 | 2793 | "note: only one of the functions is generic", |
| ... | ... | @@ -2832,6 +2833,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 2832 | 2833 | \\ var s: Foo = Foo.E; |
| 2833 | 2834 | \\ _ = s; |
| 2834 | 2835 | \\} |
| 2836 | \\const D = 1; | |
| 2835 | 2837 | , &[_][]const u8{ |
| 2836 | 2838 | "tmp.zig:1:17: error: enum 'Foo' depends on itself", |
| 2837 | 2839 | }); |