| author | |
| committer | |
| log | 2dd74cd312ec21a18b05ff7576f0d584ec7a41a2 |
| tree | 7cb3b74ad341890151d1e9c8c78c84c1ea973293 |
| parent | c011abc4ddacb12ebca1e091d241a782f0e8a2f2 |
17 files changed, 392 insertions(+), 88 deletions(-)
bootstrap.c+2| ... | ... | @@ -64,6 +64,8 @@ static const char *get_host_os(void) { |
| 64 | 64 | return "linux"; |
| 65 | 65 | #elif defined(__FreeBSD__) |
| 66 | 66 | return "freebsd"; |
| 67 | #elif defined(__HAIKU__) | |
| 68 | return "haiku"; | |
| 67 | 69 | #else |
| 68 | 70 | panic("unknown host os, specify with ZIG_HOST_TARGET_OS"); |
| 69 | 71 | #endif |
lib/std/c.zig+2-2| ... | ... | @@ -1687,8 +1687,8 @@ pub extern "c" fn getpeername(sockfd: c.fd_t, noalias addr: *c.sockaddr, noalias |
| 1687 | 1687 | pub extern "c" fn connect(sockfd: c.fd_t, sock_addr: *const c.sockaddr, addrlen: c.socklen_t) c_int; |
| 1688 | 1688 | pub extern "c" fn accept(sockfd: c.fd_t, noalias addr: ?*c.sockaddr, noalias addrlen: ?*c.socklen_t) c_int; |
| 1689 | 1689 | pub extern "c" fn accept4(sockfd: c.fd_t, noalias addr: ?*c.sockaddr, noalias addrlen: ?*c.socklen_t, flags: c_uint) c_int; |
| 1690 | pub extern "c" fn getsockopt(sockfd: c.fd_t, level: u32, optname: u32, noalias optval: ?*anyopaque, noalias optlen: *c.socklen_t) c_int; | |
| 1691 | pub extern "c" fn setsockopt(sockfd: c.fd_t, level: u32, optname: u32, optval: ?*const anyopaque, optlen: c.socklen_t) c_int; | |
| 1690 | pub extern "c" fn getsockopt(sockfd: c.fd_t, level: i32, optname: u32, noalias optval: ?*anyopaque, noalias optlen: *c.socklen_t) c_int; | |
| 1691 | pub extern "c" fn setsockopt(sockfd: c.fd_t, level: i32, optname: u32, optval: ?*const anyopaque, optlen: c.socklen_t) c_int; | |
| 1692 | 1692 | pub extern "c" fn send(sockfd: c.fd_t, buf: *const anyopaque, len: usize, flags: u32) isize; |
| 1693 | 1693 | pub extern "c" fn sendto( |
| 1694 | 1694 | sockfd: c.fd_t, |
lib/std/c/darwin.zig+2-2| ... | ... | @@ -1139,7 +1139,7 @@ pub const siginfo_t = extern struct { |
| 1139 | 1139 | pid: pid_t, |
| 1140 | 1140 | uid: uid_t, |
| 1141 | 1141 | status: c_int, |
| 1142 | addr: *anyopaque, | |
| 1142 | addr: *allowzero anyopaque, | |
| 1143 | 1143 | value: extern union { |
| 1144 | 1144 | int: c_int, |
| 1145 | 1145 | ptr: *anyopaque, |
| ... | ... | @@ -1151,7 +1151,7 @@ pub const siginfo_t = extern struct { |
| 1151 | 1151 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. |
| 1152 | 1152 | pub const Sigaction = extern struct { |
| 1153 | 1153 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 1154 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 1154 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 1155 | 1155 | |
| 1156 | 1156 | handler: extern union { |
| 1157 | 1157 | handler: ?handler_fn, |
lib/std/c/dragonfly.zig+2-2| ... | ... | @@ -668,7 +668,7 @@ pub const siginfo_t = extern struct { |
| 668 | 668 | pid: c_int, |
| 669 | 669 | uid: uid_t, |
| 670 | 670 | status: c_int, |
| 671 | addr: ?*anyopaque, | |
| 671 | addr: *allowzero anyopaque, | |
| 672 | 672 | value: sigval, |
| 673 | 673 | band: c_long, |
| 674 | 674 | __spare__: [7]c_int, |
| ... | ... | @@ -691,7 +691,7 @@ pub const sig_atomic_t = c_int; |
| 691 | 691 | |
| 692 | 692 | pub const Sigaction = extern struct { |
| 693 | 693 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 694 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 694 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 695 | 695 | |
| 696 | 696 | /// signal handler |
| 697 | 697 | handler: extern union { |
lib/std/c/freebsd.zig+2-2| ... | ... | @@ -1172,7 +1172,7 @@ const NSIG = 32; |
| 1172 | 1172 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 1173 | 1173 | pub const Sigaction = extern struct { |
| 1174 | 1174 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 1175 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 1175 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 1176 | 1176 | |
| 1177 | 1177 | /// signal handler |
| 1178 | 1178 | handler: extern union { |
| ... | ... | @@ -1206,7 +1206,7 @@ pub const siginfo_t = extern struct { |
| 1206 | 1206 | /// Exit value. |
| 1207 | 1207 | status: c_int, |
| 1208 | 1208 | /// Faulting instruction. |
| 1209 | addr: ?*anyopaque, | |
| 1209 | addr: *allowzero anyopaque, | |
| 1210 | 1210 | /// Signal value. |
| 1211 | 1211 | value: sigval, |
| 1212 | 1212 | reason: extern union { |
lib/std/c/haiku.zig+352-48| ... | ... | @@ -9,7 +9,7 @@ extern "c" fn _errnop() *c_int; |
| 9 | 9 | |
| 10 | 10 | pub const _errno = _errnop; |
| 11 | 11 | |
| 12 | pub extern "c" fn find_directory(which: c_int, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) u64; | |
| 12 | pub extern "c" fn find_directory(which: directory_which, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) u64; | |
| 13 | 13 | |
| 14 | 14 | pub extern "c" fn find_thread(thread_name: ?*anyopaque) i32; |
| 15 | 15 | |
| ... | ... | @@ -427,23 +427,18 @@ pub const W = struct { |
| 427 | 427 | } |
| 428 | 428 | }; |
| 429 | 429 | |
| 430 | pub const SA = struct { | |
| 431 | pub const ONSTACK = 0x20; | |
| 432 | pub const RESTART = 0x10; | |
| 433 | pub const RESETHAND = 0x04; | |
| 434 | pub const NOCLDSTOP = 0x01; | |
| 435 | pub const NODEFER = 0x08; | |
| 436 | pub const NOCLDWAIT = 0x02; | |
| 437 | pub const SIGINFO = 0x40; | |
| 438 | pub const NOMASK = NODEFER; | |
| 439 | pub const STACK = ONSTACK; | |
| 440 | pub const ONESHOT = RESETHAND; | |
| 441 | }; | |
| 430 | // posix/signal.h | |
| 431 | ||
| 432 | pub const sigset_t = u64; | |
| 433 | pub const empty_sigset: sigset_t = 0; | |
| 434 | pub const filled_sigset = ~@as(sigset_t, 0); | |
| 442 | 435 | |
| 443 | 436 | pub const SIG = struct { |
| 444 | pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); | |
| 445 | 437 | pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
| 446 | 438 | pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
| 439 | pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); | |
| 440 | ||
| 441 | pub const HOLD: ?Sigaction.handler_fn = @ptrFromInt(3); | |
| 447 | 442 | |
| 448 | 443 | pub const HUP = 1; |
| 449 | 444 | pub const INT = 2; |
| ... | ... | @@ -484,6 +479,340 @@ pub const SIG = struct { |
| 484 | 479 | pub const SETMASK = 3; |
| 485 | 480 | }; |
| 486 | 481 | |
| 482 | pub const siginfo_t = extern struct { | |
| 483 | signo: c_int, | |
| 484 | code: c_int, | |
| 485 | errno: c_int, | |
| 486 | ||
| 487 | pid: pid_t, | |
| 488 | uid: uid_t, | |
| 489 | addr: *allowzero anyopaque, | |
| 490 | }; | |
| 491 | ||
| 492 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 493 | pub const Sigaction = extern struct { | |
| 494 | pub const handler_fn = *align(1) const fn (i32) callconv(.C) void; | |
| 495 | pub const sigaction_fn = *const fn (c_int, *allowzero anyopaque, ?*anyopaque) callconv(.C) void; | |
| 496 | ||
| 497 | /// signal handler | |
| 498 | handler: extern union { | |
| 499 | handler: handler_fn, | |
| 500 | sigaction: sigaction_fn, | |
| 501 | }, | |
| 502 | ||
| 503 | /// signal mask to apply | |
| 504 | mask: sigset_t, | |
| 505 | ||
| 506 | /// see signal options | |
| 507 | flags: c_int, | |
| 508 | ||
| 509 | /// will be passed to the signal handler, BeOS extension | |
| 510 | userdata: *allowzero anyopaque = undefined, | |
| 511 | }; | |
| 512 | ||
| 513 | pub const SA = struct { | |
| 514 | pub const NOCLDSTOP = 0x01; | |
| 515 | pub const NOCLDWAIT = 0x02; | |
| 516 | pub const RESETHAND = 0x04; | |
| 517 | pub const NODEFER = 0x08; | |
| 518 | pub const RESTART = 0x10; | |
| 519 | pub const ONSTACK = 0x20; | |
| 520 | pub const SIGINFO = 0x40; | |
| 521 | pub const NOMASK = NODEFER; | |
| 522 | pub const STACK = ONSTACK; | |
| 523 | pub const ONESHOT = RESETHAND; | |
| 524 | }; | |
| 525 | ||
| 526 | pub const SS = struct { | |
| 527 | pub const ONSTACK = 0x1; | |
| 528 | pub const DISABLE = 0x2; | |
| 529 | }; | |
| 530 | ||
| 531 | pub const MINSIGSTKSZ = 8192; | |
| 532 | pub const SIGSTKSZ = 16384; | |
| 533 | ||
| 534 | pub const stack_t = extern struct { | |
| 535 | sp: [*]u8, | |
| 536 | size: isize, | |
| 537 | flags: i32, | |
| 538 | }; | |
| 539 | ||
| 540 | pub const NSIG = 65; | |
| 541 | ||
| 542 | pub const mcontext_t = vregs; | |
| 543 | ||
| 544 | pub const ucontext_t = extern struct { | |
| 545 | link: ?*ucontext_t, | |
| 546 | sigmask: sigset_t, | |
| 547 | stack: stack_t, | |
| 548 | mcontext: mcontext_t, | |
| 549 | }; | |
| 550 | ||
| 551 | // arch/*/signal.h | |
| 552 | ||
| 553 | pub const vregs = switch (builtin.cpu.arch) { | |
| 554 | .arm, .thumb => extern struct { | |
| 555 | r0: u32, | |
| 556 | r1: u32, | |
| 557 | r2: u32, | |
| 558 | r3: u32, | |
| 559 | r4: u32, | |
| 560 | r5: u32, | |
| 561 | r6: u32, | |
| 562 | r7: u32, | |
| 563 | r8: u32, | |
| 564 | r9: u32, | |
| 565 | r10: u32, | |
| 566 | r11: u32, | |
| 567 | r12: u32, | |
| 568 | r13: u32, | |
| 569 | r14: u32, | |
| 570 | r15: u32, | |
| 571 | cpsr: u32, | |
| 572 | }, | |
| 573 | .aarch64 => extern struct { | |
| 574 | x: [10]u64, | |
| 575 | lr: u64, | |
| 576 | sp: u64, | |
| 577 | elr: u64, | |
| 578 | spsr: u64, | |
| 579 | fp_q: [32]u128, | |
| 580 | fpsr: u32, | |
| 581 | fpcr: u32, | |
| 582 | }, | |
| 583 | .m68k => extern struct { | |
| 584 | pc: u32, | |
| 585 | d0: u32, | |
| 586 | d1: u32, | |
| 587 | d2: u32, | |
| 588 | d3: u32, | |
| 589 | d4: u32, | |
| 590 | d5: u32, | |
| 591 | d6: u32, | |
| 592 | d7: u32, | |
| 593 | a0: u32, | |
| 594 | a1: u32, | |
| 595 | a2: u32, | |
| 596 | a3: u32, | |
| 597 | a4: u32, | |
| 598 | a5: u32, | |
| 599 | a6: u32, | |
| 600 | a7: u32, | |
| 601 | ccr: u8, | |
| 602 | f0: f64, | |
| 603 | f1: f64, | |
| 604 | f2: f64, | |
| 605 | f3: f64, | |
| 606 | f4: f64, | |
| 607 | f5: f64, | |
| 608 | f6: f64, | |
| 609 | f7: f64, | |
| 610 | f8: f64, | |
| 611 | f9: f64, | |
| 612 | f10: f64, | |
| 613 | f11: f64, | |
| 614 | f12: f64, | |
| 615 | f13: f64, | |
| 616 | }, | |
| 617 | .mipsel => extern struct { | |
| 618 | r0: u32, | |
| 619 | }, | |
| 620 | .powerpc => extern struct { | |
| 621 | pc: u32, | |
| 622 | r0: u32, | |
| 623 | r1: u32, | |
| 624 | r2: u32, | |
| 625 | r3: u32, | |
| 626 | r4: u32, | |
| 627 | r5: u32, | |
| 628 | r6: u32, | |
| 629 | r7: u32, | |
| 630 | r8: u32, | |
| 631 | r9: u32, | |
| 632 | r10: u32, | |
| 633 | r11: u32, | |
| 634 | r12: u32, | |
| 635 | f0: f64, | |
| 636 | f1: f64, | |
| 637 | f2: f64, | |
| 638 | f3: f64, | |
| 639 | f4: f64, | |
| 640 | f5: f64, | |
| 641 | f6: f64, | |
| 642 | f7: f64, | |
| 643 | f8: f64, | |
| 644 | f9: f64, | |
| 645 | f10: f64, | |
| 646 | f11: f64, | |
| 647 | f12: f64, | |
| 648 | f13: f64, | |
| 649 | reserved: u32, | |
| 650 | fpscr: u32, | |
| 651 | ctr: u32, | |
| 652 | xer: u32, | |
| 653 | cr: u32, | |
| 654 | msr: u32, | |
| 655 | lr: u32, | |
| 656 | }, | |
| 657 | .riscv64 => extern struct { | |
| 658 | x: [31]u64, | |
| 659 | pc: u64, | |
| 660 | f: [32]f64, | |
| 661 | fcsr: u64, | |
| 662 | }, | |
| 663 | .sparc64 => extern struct { | |
| 664 | g1: u64, | |
| 665 | g2: u64, | |
| 666 | g3: u64, | |
| 667 | g4: u64, | |
| 668 | g5: u64, | |
| 669 | g6: u64, | |
| 670 | g7: u64, | |
| 671 | o0: u64, | |
| 672 | o1: u64, | |
| 673 | o2: u64, | |
| 674 | o3: u64, | |
| 675 | o4: u64, | |
| 676 | o5: u64, | |
| 677 | sp: u64, | |
| 678 | o7: u64, | |
| 679 | l0: u64, | |
| 680 | l1: u64, | |
| 681 | l2: u64, | |
| 682 | l3: u64, | |
| 683 | l4: u64, | |
| 684 | l5: u64, | |
| 685 | l6: u64, | |
| 686 | l7: u64, | |
| 687 | i0: u64, | |
| 688 | i1: u64, | |
| 689 | i2: u64, | |
| 690 | i3: u64, | |
| 691 | i4: u64, | |
| 692 | i5: u64, | |
| 693 | fp: u64, | |
| 694 | i7: u64, | |
| 695 | }, | |
| 696 | .x86 => extern struct { | |
| 697 | pub const old_extended_regs = extern struct { | |
| 698 | control: u16, | |
| 699 | reserved1: u16, | |
| 700 | status: u16, | |
| 701 | reserved2: u16, | |
| 702 | tag: u16, | |
| 703 | reserved3: u16, | |
| 704 | eip: u32, | |
| 705 | cs: u16, | |
| 706 | opcode: u16, | |
| 707 | datap: u32, | |
| 708 | ds: u16, | |
| 709 | reserved4: u16, | |
| 710 | fp_mmx: [8][10]u8, | |
| 711 | }; | |
| 712 | ||
| 713 | pub const fp_register = extern struct { value: [10]u8, reserved: [6]u8 }; | |
| 714 | ||
| 715 | pub const xmm_register = extern struct { value: [16]u8 }; | |
| 716 | ||
| 717 | pub const new_extended_regs = extern struct { | |
| 718 | control: u16, | |
| 719 | status: u16, | |
| 720 | tag: u16, | |
| 721 | opcode: u16, | |
| 722 | eip: u32, | |
| 723 | cs: u16, | |
| 724 | reserved1: u16, | |
| 725 | datap: u32, | |
| 726 | ds: u16, | |
| 727 | reserved2: u16, | |
| 728 | mxcsr: u32, | |
| 729 | reserved3: u32, | |
| 730 | fp_mmx: [8]fp_register, | |
| 731 | xmmx: [8]xmm_register, | |
| 732 | reserved4: [224]u8, | |
| 733 | }; | |
| 734 | ||
| 735 | pub const extended_regs = extern struct { | |
| 736 | state: extern union { | |
| 737 | old_format: old_extended_regs, | |
| 738 | new_format: new_extended_regs, | |
| 739 | }, | |
| 740 | format: u32, | |
| 741 | }; | |
| 742 | ||
| 743 | eip: u32, | |
| 744 | eflags: u32, | |
| 745 | eax: u32, | |
| 746 | ecx: u32, | |
| 747 | edx: u32, | |
| 748 | esp: u32, | |
| 749 | ebp: u32, | |
| 750 | reserved: u32, | |
| 751 | xregs: extended_regs, | |
| 752 | edi: u32, | |
| 753 | esi: u32, | |
| 754 | ebx: u32, | |
| 755 | }, | |
| 756 | .x86_64 => extern struct { | |
| 757 | pub const fp_register = extern struct { | |
| 758 | value: [10]u8, | |
| 759 | reserved: [6]u8, | |
| 760 | }; | |
| 761 | ||
| 762 | pub const xmm_register = extern struct { | |
| 763 | value: [16]u8, | |
| 764 | }; | |
| 765 | ||
| 766 | pub const fpu_state = extern struct { | |
| 767 | control: u16, | |
| 768 | status: u16, | |
| 769 | tag: u16, | |
| 770 | opcode: u16, | |
| 771 | rip: u64, | |
| 772 | rdp: u64, | |
| 773 | mxcsr: u32, | |
| 774 | mscsr_mask: u32, | |
| 775 | ||
| 776 | fp_mmx: [8]fp_register, | |
| 777 | xmm: [16]xmm_register, | |
| 778 | reserved: [96]u8, | |
| 779 | }; | |
| 780 | ||
| 781 | pub const xstate_hdr = extern struct { | |
| 782 | bv: u64, | |
| 783 | xcomp_bv: u64, | |
| 784 | reserved: [48]u8, | |
| 785 | }; | |
| 786 | ||
| 787 | pub const savefpu = extern struct { | |
| 788 | fxsave: fpu_state, | |
| 789 | xstate: xstate_hdr, | |
| 790 | ymm: [16]xmm_register, | |
| 791 | }; | |
| 792 | ||
| 793 | rax: u64, | |
| 794 | rbx: u64, | |
| 795 | rcx: u64, | |
| 796 | rdx: u64, | |
| 797 | rdi: u64, | |
| 798 | rsi: u64, | |
| 799 | rbp: u64, | |
| 800 | r8: u64, | |
| 801 | r9: u64, | |
| 802 | r10: u64, | |
| 803 | r11: u64, | |
| 804 | r12: u64, | |
| 805 | r13: u64, | |
| 806 | r14: u64, | |
| 807 | r15: u64, | |
| 808 | rsp: u64, | |
| 809 | rip: u64, | |
| 810 | rflags: u64, | |
| 811 | fpu: savefpu, | |
| 812 | }, | |
| 813 | else => void, | |
| 814 | }; | |
| 815 | ||
| 487 | 816 | // access function |
| 488 | 817 | pub const F_OK = 0; // test for existence of file |
| 489 | 818 | pub const X_OK = 1; // test for execute or search permission |
| ... | ... | @@ -527,6 +856,15 @@ pub const SOCK = struct { |
| 527 | 856 | pub const DGRAM = 2; |
| 528 | 857 | pub const RAW = 3; |
| 529 | 858 | pub const SEQPACKET = 5; |
| 859 | ||
| 860 | /// WARNING: this flag is not supported by windows socket functions directly, | |
| 861 | /// it is only supported by std.os.socket. Be sure that this value does | |
| 862 | /// not share any bits with any of the `SOCK` values. | |
| 863 | pub const CLOEXEC = 0x10000; | |
| 864 | /// WARNING: this flag is not supported by windows socket functions directly, | |
| 865 | /// it is only supported by std.os.socket. Be sure that this value does | |
| 866 | /// not share any bits with any of the `SOCK` values. | |
| 867 | pub const NONBLOCK = 0x20000; | |
| 530 | 868 | }; |
| 531 | 869 | |
| 532 | 870 | pub const SO = struct { |
| ... | ... | @@ -686,28 +1024,6 @@ pub const winsize = extern struct { |
| 686 | 1024 | ws_ypixel: u16, |
| 687 | 1025 | }; |
| 688 | 1026 | |
| 689 | const NSIG = 32; | |
| 690 | ||
| 691 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 692 | pub const Sigaction = extern struct { | |
| 693 | pub const handler_fn = *align(1) const fn (i32) callconv(.C) void; | |
| 694 | ||
| 695 | /// signal handler | |
| 696 | __sigaction_u: extern union { | |
| 697 | __sa_handler: handler_fn, | |
| 698 | }, | |
| 699 | ||
| 700 | /// see signal options | |
| 701 | sa_flags: u32, | |
| 702 | ||
| 703 | /// signal mask to apply | |
| 704 | sa_mask: sigset_t, | |
| 705 | }; | |
| 706 | ||
| 707 | pub const sigset_t = extern struct { | |
| 708 | __bits: [SIG.WORDS]u32, | |
| 709 | }; | |
| 710 | ||
| 711 | 1027 | const B_POSIX_ERROR_BASE = -2147454976; |
| 712 | 1028 | |
| 713 | 1029 | pub const E = enum(i32) { |
| ... | ... | @@ -802,18 +1118,6 @@ pub const E = enum(i32) { |
| 802 | 1118 | _, |
| 803 | 1119 | }; |
| 804 | 1120 | |
| 805 | pub const MINSIGSTKSZ = 8192; | |
| 806 | pub const SIGSTKSZ = 16384; | |
| 807 | ||
| 808 | pub const SS_ONSTACK = 0x1; | |
| 809 | pub const SS_DISABLE = 0x2; | |
| 810 | ||
| 811 | pub const stack_t = extern struct { | |
| 812 | sp: [*]u8, | |
| 813 | size: isize, | |
| 814 | flags: i32, | |
| 815 | }; | |
| 816 | ||
| 817 | 1121 | pub const S = struct { |
| 818 | 1122 | pub const IFMT = 0o170000; |
| 819 | 1123 | pub const IFSOCK = 0o140000; |
lib/std/c/netbsd.zig+2-2| ... | ... | @@ -865,7 +865,7 @@ pub const SIG = struct { |
| 865 | 865 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 866 | 866 | pub const Sigaction = extern struct { |
| 867 | 867 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 868 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 868 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 869 | 869 | |
| 870 | 870 | /// signal handler |
| 871 | 871 | handler: extern union { |
| ... | ... | @@ -908,7 +908,7 @@ pub const _ksiginfo = extern struct { |
| 908 | 908 | stime: clock_t, |
| 909 | 909 | }, |
| 910 | 910 | fault: extern struct { |
| 911 | addr: ?*anyopaque, | |
| 911 | addr: *allowzero anyopaque, | |
| 912 | 912 | trap: i32, |
| 913 | 913 | trap2: i32, |
| 914 | 914 | trap3: i32, |
lib/std/c/openbsd.zig+2-2| ... | ... | @@ -843,7 +843,7 @@ pub const SIG = struct { |
| 843 | 843 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 844 | 844 | pub const Sigaction = extern struct { |
| 845 | 845 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 846 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 846 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 847 | 847 | |
| 848 | 848 | /// signal handler |
| 849 | 849 | handler: extern union { |
| ... | ... | @@ -881,7 +881,7 @@ pub const siginfo_t = extern struct { |
| 881 | 881 | }, |
| 882 | 882 | }, |
| 883 | 883 | fault: extern struct { |
| 884 | addr: ?*anyopaque, | |
| 884 | addr: *allowzero anyopaque, | |
| 885 | 885 | trapno: c_int, |
| 886 | 886 | }, |
| 887 | 887 | __pad: [128 - 3 * @sizeOf(c_int)]u8, |
lib/std/c/solaris.zig+2-2| ... | ... | @@ -875,7 +875,7 @@ pub const SIG = struct { |
| 875 | 875 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 876 | 876 | pub const Sigaction = extern struct { |
| 877 | 877 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 878 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 878 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 879 | 879 | |
| 880 | 880 | /// signal options |
| 881 | 881 | flags: c_uint, |
| ... | ... | @@ -917,7 +917,7 @@ pub const siginfo_t = extern struct { |
| 917 | 917 | zone: zoneid_t, |
| 918 | 918 | }, |
| 919 | 919 | fault: extern struct { |
| 920 | addr: ?*anyopaque, | |
| 920 | addr: *allowzero anyopaque, | |
| 921 | 921 | trapno: c_int, |
| 922 | 922 | pc: ?*anyopaque, |
| 923 | 923 | }, |
lib/std/debug.zig+1-1| ... | ... | @@ -229,7 +229,7 @@ pub fn relocateContext(context: *ThreadContext) void { |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | pub const have_getcontext = @hasDecl(posix.system, "getcontext") and |
| 232 | native_os != .openbsd and | |
| 232 | native_os != .openbsd and native_os != .haiku and | |
| 233 | 233 | (native_os != .linux or switch (builtin.cpu.arch) { |
| 234 | 234 | .x86, |
| 235 | 235 | .x86_64, |
lib/std/fs/get_app_data_dir.zig+3-9| ... | ... | @@ -42,15 +42,9 @@ pub fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDi |
| 42 | 42 | return fs.path.join(allocator, &[_][]const u8{ home_dir, ".local", "share", appname }); |
| 43 | 43 | }, |
| 44 | 44 | .haiku => { |
| 45 | var dir_path_ptr: [*:0]u8 = undefined; | |
| 46 | if (true) { | |
| 47 | _ = &dir_path_ptr; | |
| 48 | @compileError("TODO: init dir_path_ptr"); | |
| 49 | } | |
| 50 | // TODO look into directory_which | |
| 51 | const be_user_settings = 0xbbe; | |
| 52 | const rc = std.c.find_directory(be_user_settings, -1, true, dir_path_ptr, 1); | |
| 53 | const settings_dir = try allocator.dupeZ(u8, mem.sliceTo(dir_path_ptr, 0)); | |
| 45 | var dir_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 46 | const rc = std.c.find_directory(.B_USER_SETTINGS_DIRECTORY, -1, true, &dir_path_buf, dir_path_buf.len); | |
| 47 | const settings_dir = try allocator.dupeZ(u8, mem.sliceTo(&dir_path_buf, 0)); | |
| 54 | 48 | defer allocator.free(settings_dir); |
| 55 | 49 | switch (rc) { |
| 56 | 50 | 0 => return fs.path.join(allocator, &[_][]const u8{ settings_dir, appname }), |
lib/std/io.zig+4-1| ... | ... | @@ -610,7 +610,10 @@ pub fn Poller(comptime StreamEnum: type) type { |
| 610 | 610 | // allocate grows exponentially. |
| 611 | 611 | const bump_amt = 512; |
| 612 | 612 | |
| 613 | const err_mask = posix.POLL.ERR | posix.POLL.NVAL | posix.POLL.HUP; | |
| 613 | const err_mask = switch (builtin.target.os.tag) { | |
| 614 | .haiku => posix.POLL.ERR | posix.POLL.HUP, | |
| 615 | else => posix.POLL.ERR | posix.POLL.NVAL | posix.POLL.HUP, | |
| 616 | }; | |
| 614 | 617 | |
| 615 | 618 | const events_len = try posix.poll(&self.poll_fds, if (nanoseconds) |ns| |
| 616 | 619 | std.math.cast(i32, ns / std.time.ns_per_ms) orelse std.math.maxInt(i32) |
lib/std/os/emscripten.zig+2-2| ... | ... | @@ -696,7 +696,7 @@ pub const SIG = struct { |
| 696 | 696 | |
| 697 | 697 | pub const Sigaction = extern struct { |
| 698 | 698 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 699 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 699 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 700 | 700 | |
| 701 | 701 | handler: extern union { |
| 702 | 702 | handler: ?handler_fn, |
| ... | ... | @@ -738,7 +738,7 @@ const siginfo_fields_union = extern union { |
| 738 | 738 | }, |
| 739 | 739 | }, |
| 740 | 740 | sigfault: extern struct { |
| 741 | addr: *anyopaque, | |
| 741 | addr: *allowzero anyopaque, | |
| 742 | 742 | addr_lsb: i16, |
| 743 | 743 | first: extern union { |
| 744 | 744 | addr_bnd: extern struct { |
lib/std/os/linux.zig+8-8| ... | ... | @@ -1609,18 +1609,18 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { |
| 1609 | 1609 | return syscall3(.socket, domain, socket_type, protocol); |
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { | |
| 1612 | pub fn setsockopt(fd: i32, level: i32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { | |
| 1613 | 1613 | if (native_arch == .x86) { |
| 1614 | return socketcall(SC.setsockopt, &[5]usize{ @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @as(usize, @intCast(optlen)) }); | |
| 1614 | return socketcall(SC.setsockopt, &[5]usize{ @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @as(usize, @intCast(optlen)) }); | |
| 1615 | 1615 | } |
| 1616 | return syscall5(.setsockopt, @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @as(usize, @intCast(optlen))); | |
| 1616 | return syscall5(.setsockopt, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @as(usize, @intCast(optlen))); | |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { | |
| 1619 | pub fn getsockopt(fd: i32, level: i32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { | |
| 1620 | 1620 | if (native_arch == .x86) { |
| 1621 | return socketcall(SC.getsockopt, &[5]usize{ @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @intFromPtr(optlen) }); | |
| 1621 | return socketcall(SC.getsockopt, &[5]usize{ @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @intFromPtr(optlen) }); | |
| 1622 | 1622 | } |
| 1623 | return syscall5(.getsockopt, @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @intFromPtr(optlen)); | |
| 1623 | return syscall5(.getsockopt, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, level))), optname, @intFromPtr(optval), @intFromPtr(optlen)); | |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | pub fn sendmsg(fd: i32, msg: *const msghdr_const, flags: u32) usize { |
| ... | ... | @@ -4329,7 +4329,7 @@ pub const k_sigaction = switch (native_arch) { |
| 4329 | 4329 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 4330 | 4330 | pub const Sigaction = extern struct { |
| 4331 | 4331 | pub const handler_fn = *align(1) const fn (c_int) callconv(.C) void; |
| 4332 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 4332 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 4333 | 4333 | |
| 4334 | 4334 | handler: extern union { |
| 4335 | 4335 | handler: ?handler_fn, |
| ... | ... | @@ -4690,7 +4690,7 @@ const siginfo_fields_union = extern union { |
| 4690 | 4690 | }, |
| 4691 | 4691 | }, |
| 4692 | 4692 | sigfault: extern struct { |
| 4693 | addr: *anyopaque, | |
| 4693 | addr: *allowzero anyopaque, | |
| 4694 | 4694 | addr_lsb: i16, |
| 4695 | 4695 | first: extern union { |
| 4696 | 4696 | addr_bnd: extern struct { |
lib/std/os/plan9.zig+1-1| ... | ... | @@ -187,7 +187,7 @@ pub const siginfo_t = c_long; |
| 187 | 187 | // TODO plan9 doesn't have sigaction_fn. Sigaction is not a union, but we incude it here to be compatible. |
| 188 | 188 | pub const Sigaction = extern struct { |
| 189 | 189 | pub const handler_fn = *const fn (c_int) callconv(.C) void; |
| 190 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; | |
| 190 | pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.C) void; | |
| 191 | 191 | |
| 192 | 192 | handler: extern union { |
| 193 | 193 | handler: ?handler_fn, |
lib/std/posix.zig+4-4| ... | ... | @@ -3493,7 +3493,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!socket_t |
| 3493 | 3493 | return rc; |
| 3494 | 3494 | } |
| 3495 | 3495 | |
| 3496 | const have_sock_flags = !builtin.target.isDarwin(); | |
| 3496 | const have_sock_flags = !builtin.target.isDarwin() and native_os != .haiku; | |
| 3497 | 3497 | const filtered_sock_type = if (!have_sock_flags) |
| 3498 | 3498 | socket_type & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC) |
| 3499 | 3499 | else |
| ... | ... | @@ -3789,7 +3789,7 @@ pub fn accept( |
| 3789 | 3789 | /// description of the `CLOEXEC` flag in `open` for reasons why this may be useful. |
| 3790 | 3790 | flags: u32, |
| 3791 | 3791 | ) AcceptError!socket_t { |
| 3792 | const have_accept4 = !(builtin.target.isDarwin() or native_os == .windows); | |
| 3792 | const have_accept4 = !(builtin.target.isDarwin() or native_os == .windows or native_os == .haiku); | |
| 3793 | 3793 | assert(0 == (flags & ~@as(u32, SOCK.NONBLOCK | SOCK.CLOEXEC))); // Unsupported flag(s) |
| 3794 | 3794 | |
| 3795 | 3795 | const accepted_sock: socket_t = while (true) { |
| ... | ... | @@ -6676,9 +6676,9 @@ pub const SetSockOptError = error{ |
| 6676 | 6676 | } || UnexpectedError; |
| 6677 | 6677 | |
| 6678 | 6678 | /// Set a socket's options. |
| 6679 | pub fn setsockopt(fd: socket_t, level: u32, optname: u32, opt: []const u8) SetSockOptError!void { | |
| 6679 | pub fn setsockopt(fd: socket_t, level: i32, optname: u32, opt: []const u8) SetSockOptError!void { | |
| 6680 | 6680 | if (native_os == .windows) { |
| 6681 | const rc = windows.ws2_32.setsockopt(fd, @intCast(level), @intCast(optname), opt.ptr, @intCast(opt.len)); | |
| 6681 | const rc = windows.ws2_32.setsockopt(fd, level, @intCast(optname), opt.ptr, @intCast(opt.len)); | |
| 6682 | 6682 | if (rc == windows.ws2_32.SOCKET_ERROR) { |
| 6683 | 6683 | switch (windows.ws2_32.WSAGetLastError()) { |
| 6684 | 6684 | .WSANOTINITIALISED => unreachable, |
src/target.zig+1| ... | ... | @@ -301,6 +301,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 { |
| 301 | 301 | "-lroot", |
| 302 | 302 | "-lpthread", |
| 303 | 303 | "-lc", |
| 304 | "-lnetwork", | |
| 304 | 305 | }, |
| 305 | 306 | else => switch (target.abi) { |
| 306 | 307 | .android => &[_][]const u8{ |