| ... | @@ -703,7 +703,7 @@ pub fn dup2(old: i32, new: i32) usize { | ... | @@ -703,7 +703,7 @@ pub fn dup2(old: i32, new: i32) usize { |
| 703 | } | 703 | } |
| 704 | | 704 | |
| 705 | pub fn dup3(old: i32, new: i32, flags: u32) usize { | 705 | pub fn dup3(old: i32, new: i32, flags: u32) usize { |
| 706 | return syscall3(SYS_dup3, @intCast(usize, old), @intCast(usize, new), flags); | 706 | return syscall3(SYS_dup3, @bitCast(usize, isize(old)), @bitCast(usize, isize(new)), flags); |
| 707 | } | 707 | } |
| 708 | | 708 | |
| 709 | // TODO https://github.com/ziglang/zig/issues/265 | 709 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -747,7 +747,7 @@ pub fn getcwd(buf: [*]u8, size: usize) usize { | ... | @@ -747,7 +747,7 @@ pub fn getcwd(buf: [*]u8, size: usize) usize { |
| 747 | } | 747 | } |
| 748 | | 748 | |
| 749 | pub fn getdents64(fd: i32, dirp: [*]u8, count: usize) usize { | 749 | pub fn getdents64(fd: i32, dirp: [*]u8, count: usize) usize { |
| 750 | return syscall3(SYS_getdents64, @intCast(usize, fd), @ptrToInt(dirp), count); | 750 | return syscall3(SYS_getdents64, @bitCast(usize, isize(fd)), @ptrToInt(dirp), count); |
| 751 | } | 751 | } |
| 752 | | 752 | |
| 753 | pub fn inotify_init1(flags: u32) usize { | 753 | pub fn inotify_init1(flags: u32) usize { |
| ... | @@ -755,16 +755,16 @@ pub fn inotify_init1(flags: u32) usize { | ... | @@ -755,16 +755,16 @@ pub fn inotify_init1(flags: u32) usize { |
| 755 | } | 755 | } |
| 756 | | 756 | |
| 757 | pub fn inotify_add_watch(fd: i32, pathname: [*]const u8, mask: u32) usize { | 757 | pub fn inotify_add_watch(fd: i32, pathname: [*]const u8, mask: u32) usize { |
| 758 | return syscall3(SYS_inotify_add_watch, @intCast(usize, fd), @ptrToInt(pathname), mask); | 758 | return syscall3(SYS_inotify_add_watch, @bitCast(usize, isize(fd)), @ptrToInt(pathname), mask); |
| 759 | } | 759 | } |
| 760 | | 760 | |
| 761 | pub fn inotify_rm_watch(fd: i32, wd: i32) usize { | 761 | pub fn inotify_rm_watch(fd: i32, wd: i32) usize { |
| 762 | return syscall2(SYS_inotify_rm_watch, @intCast(usize, fd), @intCast(usize, wd)); | 762 | return syscall2(SYS_inotify_rm_watch, @bitCast(usize, isize(fd)), @bitCast(usize, isize(wd))); |
| 763 | } | 763 | } |
| 764 | | 764 | |
| 765 | pub fn isatty(fd: i32) bool { | 765 | pub fn isatty(fd: i32) bool { |
| 766 | var wsz: winsize = undefined; | 766 | var wsz: winsize = undefined; |
| 767 | return syscall3(SYS_ioctl, @intCast(usize, fd), TIOCGWINSZ, @ptrToInt(&wsz)) == 0; | 767 | return syscall3(SYS_ioctl, @bitCast(usize, isize(fd)), TIOCGWINSZ, @ptrToInt(&wsz)) == 0; |
| 768 | } | 768 | } |
| 769 | | 769 | |
| 770 | // TODO https://github.com/ziglang/zig/issues/265 | 770 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -774,7 +774,7 @@ pub fn readlink(noalias path: [*]const u8, noalias buf_ptr: [*]u8, buf_len: usiz | ... | @@ -774,7 +774,7 @@ pub fn readlink(noalias path: [*]const u8, noalias buf_ptr: [*]u8, buf_len: usiz |
| 774 | | 774 | |
| 775 | // TODO https://github.com/ziglang/zig/issues/265 | 775 | // TODO https://github.com/ziglang/zig/issues/265 |
| 776 | pub fn readlinkat(dirfd: i32, noalias path: [*]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize { | 776 | pub fn readlinkat(dirfd: i32, noalias path: [*]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize { |
| 777 | return syscall4(SYS_readlinkat, @intCast(usize, dirfd), @ptrToInt(path), @ptrToInt(buf_ptr), buf_len); | 777 | return syscall4(SYS_readlinkat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), @ptrToInt(buf_ptr), buf_len); |
| 778 | } | 778 | } |
| 779 | | 779 | |
| 780 | // TODO https://github.com/ziglang/zig/issues/265 | 780 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -784,7 +784,7 @@ pub fn mkdir(path: [*]const u8, mode: u32) usize { | ... | @@ -784,7 +784,7 @@ pub fn mkdir(path: [*]const u8, mode: u32) usize { |
| 784 | | 784 | |
| 785 | // TODO https://github.com/ziglang/zig/issues/265 | 785 | // TODO https://github.com/ziglang/zig/issues/265 |
| 786 | pub fn mkdirat(dirfd: i32, path: [*]const u8, mode: u32) usize { | 786 | pub fn mkdirat(dirfd: i32, path: [*]const u8, mode: u32) usize { |
| 787 | return syscall3(SYS_mkdirat, @intCast(usize, dirfd), @ptrToInt(path), mode); | 787 | return syscall3(SYS_mkdirat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), mode); |
| 788 | } | 788 | } |
| 789 | | 789 | |
| 790 | // TODO https://github.com/ziglang/zig/issues/265 | 790 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -803,7 +803,7 @@ pub fn umount2(special: [*]const u8, flags: u32) usize { | ... | @@ -803,7 +803,7 @@ pub fn umount2(special: [*]const u8, flags: u32) usize { |
| 803 | } | 803 | } |
| 804 | | 804 | |
| 805 | pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: isize) usize { | 805 | pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: isize) usize { |
| 806 | return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @intCast(usize, fd), @bitCast(usize, offset)); | 806 | return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, offset)); |
| 807 | } | 807 | } |
| 808 | | 808 | |
| 809 | pub fn munmap(address: usize, length: usize) usize { | 809 | pub fn munmap(address: usize, length: usize) usize { |
| ... | @@ -811,23 +811,23 @@ pub fn munmap(address: usize, length: usize) usize { | ... | @@ -811,23 +811,23 @@ pub fn munmap(address: usize, length: usize) usize { |
| 811 | } | 811 | } |
| 812 | | 812 | |
| 813 | pub fn read(fd: i32, buf: [*]u8, count: usize) usize { | 813 | pub fn read(fd: i32, buf: [*]u8, count: usize) usize { |
| 814 | return syscall3(SYS_read, @intCast(usize, fd), @ptrToInt(buf), count); | 814 | return syscall3(SYS_read, @bitCast(usize, isize(fd)), @ptrToInt(buf), count); |
| 815 | } | 815 | } |
| 816 | | 816 | |
| 817 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: u64) usize { | 817 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: u64) usize { |
| 818 | return syscall4(SYS_preadv, @intCast(usize, fd), @ptrToInt(iov), count, offset); | 818 | return syscall4(SYS_preadv, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset); |
| 819 | } | 819 | } |
| 820 | | 820 | |
| 821 | pub fn readv(fd: i32, iov: [*]const iovec, count: usize) usize { | 821 | pub fn readv(fd: i32, iov: [*]const iovec, count: usize) usize { |
| 822 | return syscall3(SYS_readv, @intCast(usize, fd), @ptrToInt(iov), count); | 822 | return syscall3(SYS_readv, @bitCast(usize, isize(fd)), @ptrToInt(iov), count); |
| 823 | } | 823 | } |
| 824 | | 824 | |
| 825 | pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { | 825 | pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { |
| 826 | return syscall3(SYS_writev, @intCast(usize, fd), @ptrToInt(iov), count); | 826 | return syscall3(SYS_writev, @bitCast(usize, isize(fd)), @ptrToInt(iov), count); |
| 827 | } | 827 | } |
| 828 | | 828 | |
| 829 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64) usize { | 829 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64) usize { |
| 830 | return syscall4(SYS_pwritev, @intCast(usize, fd), @ptrToInt(iov), count, offset); | 830 | return syscall4(SYS_pwritev, @bitCast(usize, isize(fd)), @ptrToInt(iov), count, offset); |
| 831 | } | 831 | } |
| 832 | | 832 | |
| 833 | // TODO https://github.com/ziglang/zig/issues/265 | 833 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -842,12 +842,12 @@ pub fn symlink(existing: [*]const u8, new: [*]const u8) usize { | ... | @@ -842,12 +842,12 @@ pub fn symlink(existing: [*]const u8, new: [*]const u8) usize { |
| 842 | | 842 | |
| 843 | // TODO https://github.com/ziglang/zig/issues/265 | 843 | // TODO https://github.com/ziglang/zig/issues/265 |
| 844 | pub fn symlinkat(existing: [*]const u8, newfd: i32, newpath: [*]const u8) usize { | 844 | pub fn symlinkat(existing: [*]const u8, newfd: i32, newpath: [*]const u8) usize { |
| 845 | return syscall3(SYS_symlinkat, @ptrToInt(existing), @intCast(usize, newfd), @ptrToInt(newpath)); | 845 | return syscall3(SYS_symlinkat, @ptrToInt(existing), @bitCast(usize, isize(newfd)), @ptrToInt(newpath)); |
| 846 | } | 846 | } |
| 847 | | 847 | |
| 848 | // TODO https://github.com/ziglang/zig/issues/265 | 848 | // TODO https://github.com/ziglang/zig/issues/265 |
| 849 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: usize) usize { | 849 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: usize) usize { |
| 850 | return syscall4(SYS_pread, @intCast(usize, fd), @ptrToInt(buf), count, offset); | 850 | return syscall4(SYS_pread, @bitCast(usize, isize(fd)), @ptrToInt(buf), count, offset); |
| 851 | } | 851 | } |
| 852 | | 852 | |
| 853 | // TODO https://github.com/ziglang/zig/issues/265 | 853 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -856,7 +856,7 @@ pub fn access(path: [*]const u8, mode: u32) usize { | ... | @@ -856,7 +856,7 @@ pub fn access(path: [*]const u8, mode: u32) usize { |
| 856 | } | 856 | } |
| 857 | | 857 | |
| 858 | pub fn faccessat(dirfd: i32, path: [*]const u8, mode: u32) usize { | 858 | pub fn faccessat(dirfd: i32, path: [*]const u8, mode: u32) usize { |
| 859 | return syscall3(SYS_faccessat, @intCast(usize, dirfd), @ptrToInt(path), mode); | 859 | return syscall3(SYS_faccessat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), mode); |
| 860 | } | 860 | } |
| 861 | | 861 | |
| 862 | pub fn pipe(fd: *[2]i32) usize { | 862 | pub fn pipe(fd: *[2]i32) usize { |
| ... | @@ -868,11 +868,11 @@ pub fn pipe2(fd: *[2]i32, flags: u32) usize { | ... | @@ -868,11 +868,11 @@ pub fn pipe2(fd: *[2]i32, flags: u32) usize { |
| 868 | } | 868 | } |
| 869 | | 869 | |
| 870 | pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { | 870 | pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { |
| 871 | return syscall3(SYS_write, @intCast(usize, fd), @ptrToInt(buf), count); | 871 | return syscall3(SYS_write, @bitCast(usize, isize(fd)), @ptrToInt(buf), count); |
| 872 | } | 872 | } |
| 873 | | 873 | |
| 874 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: usize) usize { | 874 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: usize) usize { |
| 875 | return syscall4(SYS_pwrite, @intCast(usize, fd), @ptrToInt(buf), count, offset); | 875 | return syscall4(SYS_pwrite, @bitCast(usize, isize(fd)), @ptrToInt(buf), count, offset); |
| 876 | } | 876 | } |
| 877 | | 877 | |
| 878 | // TODO https://github.com/ziglang/zig/issues/265 | 878 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -882,7 +882,7 @@ pub fn rename(old: [*]const u8, new: [*]const u8) usize { | ... | @@ -882,7 +882,7 @@ pub fn rename(old: [*]const u8, new: [*]const u8) usize { |
| 882 | | 882 | |
| 883 | // TODO https://github.com/ziglang/zig/issues/265 | 883 | // TODO https://github.com/ziglang/zig/issues/265 |
| 884 | pub fn renameat2(oldfd: i32, oldpath: [*]const u8, newfd: i32, newpath: [*]const u8, flags: u32) usize { | 884 | pub fn renameat2(oldfd: i32, oldpath: [*]const u8, newfd: i32, newpath: [*]const u8, flags: u32) usize { |
| 885 | return syscall5(SYS_renameat2, @intCast(usize, oldfd), @ptrToInt(oldpath), @intCast(usize, newfd), @ptrToInt(newpath), flags); | 885 | return syscall5(SYS_renameat2, @bitCast(usize, isize(oldfd)), @ptrToInt(oldpath), @bitCast(usize, isize(newfd)), @ptrToInt(newpath), flags); |
| 886 | } | 886 | } |
| 887 | | 887 | |
| 888 | // TODO https://github.com/ziglang/zig/issues/265 | 888 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -897,7 +897,8 @@ pub fn create(path: [*]const u8, perm: usize) usize { | ... | @@ -897,7 +897,8 @@ pub fn create(path: [*]const u8, perm: usize) usize { |
| 897 | | 897 | |
| 898 | // TODO https://github.com/ziglang/zig/issues/265 | 898 | // TODO https://github.com/ziglang/zig/issues/265 |
| 899 | pub fn openat(dirfd: i32, path: [*]const u8, flags: u32, mode: usize) usize { | 899 | pub fn openat(dirfd: i32, path: [*]const u8, flags: u32, mode: usize) usize { |
| 900 | return syscall4(SYS_openat, @intCast(usize, dirfd), @ptrToInt(path), flags, mode); | 900 | // dirfd could be negative, for example AT_FDCWD is -100 |
| | 901 | return syscall4(SYS_openat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), flags, mode); |
| 901 | } | 902 | } |
| 902 | | 903 | |
| 903 | /// See also `clone` (from the arch-specific include) | 904 | /// See also `clone` (from the arch-specific include) |
| ... | @@ -911,11 +912,11 @@ pub fn clone2(flags: u32, child_stack_ptr: usize) usize { | ... | @@ -911,11 +912,11 @@ pub fn clone2(flags: u32, child_stack_ptr: usize) usize { |
| 911 | } | 912 | } |
| 912 | | 913 | |
| 913 | pub fn close(fd: i32) usize { | 914 | pub fn close(fd: i32) usize { |
| 914 | return syscall1(SYS_close, @intCast(usize, fd)); | 915 | return syscall1(SYS_close, @bitCast(usize, isize(fd))); |
| 915 | } | 916 | } |
| 916 | | 917 | |
| 917 | pub fn lseek(fd: i32, offset: isize, ref_pos: usize) usize { | 918 | pub fn lseek(fd: i32, offset: isize, ref_pos: usize) usize { |
| 918 | return syscall3(SYS_lseek, @intCast(usize, fd), @bitCast(usize, offset), ref_pos); | 919 | return syscall3(SYS_lseek, @bitCast(usize, isize(fd)), @bitCast(usize, offset), ref_pos); |
| 919 | } | 920 | } |
| 920 | | 921 | |
| 921 | pub fn exit(status: i32) noreturn { | 922 | pub fn exit(status: i32) noreturn { |
| ... | @@ -933,7 +934,7 @@ pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { | ... | @@ -933,7 +934,7 @@ pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { |
| 933 | } | 934 | } |
| 934 | | 935 | |
| 935 | pub fn kill(pid: i32, sig: i32) usize { | 936 | pub fn kill(pid: i32, sig: i32) usize { |
| 936 | return syscall2(SYS_kill, @bitCast(usize, isize(pid)), @intCast(usize, sig)); | 937 | return syscall2(SYS_kill, @bitCast(usize, isize(pid)), @bitCast(usize, isize(sig))); |
| 937 | } | 938 | } |
| 938 | | 939 | |
| 939 | // TODO https://github.com/ziglang/zig/issues/265 | 940 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -943,7 +944,7 @@ pub fn unlink(path: [*]const u8) usize { | ... | @@ -943,7 +944,7 @@ pub fn unlink(path: [*]const u8) usize { |
| 943 | | 944 | |
| 944 | // TODO https://github.com/ziglang/zig/issues/265 | 945 | // TODO https://github.com/ziglang/zig/issues/265 |
| 945 | pub fn unlinkat(dirfd: i32, path: [*]const u8, flags: u32) usize { | 946 | pub fn unlinkat(dirfd: i32, path: [*]const u8, flags: u32) usize { |
| 946 | return syscall3(SYS_unlinkat, @intCast(usize, dirfd), @ptrToInt(path), flags); | 947 | return syscall3(SYS_unlinkat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), flags); |
| 947 | } | 948 | } |
| 948 | | 949 | |
| 949 | pub fn waitpid(pid: i32, status: *i32, options: i32) usize { | 950 | pub fn waitpid(pid: i32, status: *i32, options: i32) usize { |
| ... | @@ -1120,8 +1121,8 @@ pub const empty_sigset = []usize{0} ** sigset_t.len; | ... | @@ -1120,8 +1121,8 @@ pub const empty_sigset = []usize{0} ** sigset_t.len; |
| 1120 | pub fn raise(sig: i32) usize { | 1121 | pub fn raise(sig: i32) usize { |
| 1121 | var set: sigset_t = undefined; | 1122 | var set: sigset_t = undefined; |
| 1122 | blockAppSignals(&set); | 1123 | blockAppSignals(&set); |
| 1123 | const tid = @intCast(i32, syscall0(SYS_gettid)); | 1124 | const tid = syscall0(SYS_gettid); |
| 1124 | const ret = syscall2(SYS_tkill, @intCast(usize, tid), @intCast(usize, sig)); | 1125 | const ret = syscall2(SYS_tkill, tid, @bitCast(usize, isize(sig))); |
| 1125 | restoreSignals(&set); | 1126 | restoreSignals(&set); |
| 1126 | return ret; | 1127 | return ret; |
| 1127 | } | 1128 | } |
| ... | @@ -1189,11 +1190,11 @@ pub const iovec_const = extern struct { | ... | @@ -1189,11 +1190,11 @@ pub const iovec_const = extern struct { |
| 1189 | }; | 1190 | }; |
| 1190 | | 1191 | |
| 1191 | pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1192 | pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1192 | return syscall3(SYS_getsockname, @intCast(usize, fd), @ptrToInt(addr), @ptrToInt(len)); | 1193 | return syscall3(SYS_getsockname, @bitCast(usize, isize(fd)), @ptrToInt(addr), @ptrToInt(len)); |
| 1193 | } | 1194 | } |
| 1194 | | 1195 | |
| 1195 | pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1196 | pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1196 | return syscall3(SYS_getpeername, @intCast(usize, fd), @ptrToInt(addr), @ptrToInt(len)); | 1197 | return syscall3(SYS_getpeername, @bitCast(usize, isize(fd)), @ptrToInt(addr), @ptrToInt(len)); |
| 1197 | } | 1198 | } |
| 1198 | | 1199 | |
| 1199 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { | 1200 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { |
| ... | @@ -1201,47 +1202,47 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { | ... | @@ -1201,47 +1202,47 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { |
| 1201 | } | 1202 | } |
| 1202 | | 1203 | |
| 1203 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { | 1204 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { |
| 1204 | return syscall5(SYS_setsockopt, @intCast(usize, fd), level, optname, @ptrToInt(optval), @intCast(usize, optlen)); | 1205 | return syscall5(SYS_setsockopt, @bitCast(usize, isize(fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen)); |
| 1205 | } | 1206 | } |
| 1206 | | 1207 | |
| 1207 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { | 1208 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { |
| 1208 | return syscall5(SYS_getsockopt, @intCast(usize, fd), level, optname, @ptrToInt(optval), @ptrToInt(optlen)); | 1209 | return syscall5(SYS_getsockopt, @bitCast(usize, isize(fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen)); |
| 1209 | } | 1210 | } |
| 1210 | | 1211 | |
| 1211 | pub fn sendmsg(fd: i32, msg: *const msghdr, flags: u32) usize { | 1212 | pub fn sendmsg(fd: i32, msg: *const msghdr, flags: u32) usize { |
| 1212 | return syscall3(SYS_sendmsg, @intCast(usize, fd), @ptrToInt(msg), flags); | 1213 | return syscall3(SYS_sendmsg, @bitCast(usize, isize(fd)), @ptrToInt(msg), flags); |
| 1213 | } | 1214 | } |
| 1214 | | 1215 | |
| 1215 | pub fn connect(fd: i32, addr: *const c_void, len: socklen_t) usize { | 1216 | pub fn connect(fd: i32, addr: *const c_void, len: socklen_t) usize { |
| 1216 | return syscall3(SYS_connect, @intCast(usize, fd), @ptrToInt(addr), len); | 1217 | return syscall3(SYS_connect, @bitCast(usize, isize(fd)), @ptrToInt(addr), len); |
| 1217 | } | 1218 | } |
| 1218 | | 1219 | |
| 1219 | pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize { | 1220 | pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize { |
| 1220 | return syscall3(SYS_recvmsg, @intCast(usize, fd), @ptrToInt(msg), flags); | 1221 | return syscall3(SYS_recvmsg, @bitCast(usize, isize(fd)), @ptrToInt(msg), flags); |
| 1221 | } | 1222 | } |
| 1222 | | 1223 | |
| 1223 | pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize { | 1224 | pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize { |
| 1224 | return syscall6(SYS_recvfrom, @intCast(usize, fd), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen)); | 1225 | return syscall6(SYS_recvfrom, @bitCast(usize, isize(fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen)); |
| 1225 | } | 1226 | } |
| 1226 | | 1227 | |
| 1227 | pub fn shutdown(fd: i32, how: i32) usize { | 1228 | pub fn shutdown(fd: i32, how: i32) usize { |
| 1228 | return syscall2(SYS_shutdown, @intCast(usize, fd), @intCast(usize, how)); | 1229 | return syscall2(SYS_shutdown, @bitCast(usize, isize(fd)), @bitCast(usize, isize(how))); |
| 1229 | } | 1230 | } |
| 1230 | | 1231 | |
| 1231 | pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { | 1232 | pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { |
| 1232 | return syscall3(SYS_bind, @intCast(usize, fd), @ptrToInt(addr), @intCast(usize, len)); | 1233 | return syscall3(SYS_bind, @bitCast(usize, isize(fd)), @ptrToInt(addr), @intCast(usize, len)); |
| 1233 | } | 1234 | } |
| 1234 | | 1235 | |
| 1235 | pub fn listen(fd: i32, backlog: u32) usize { | 1236 | pub fn listen(fd: i32, backlog: u32) usize { |
| 1236 | return syscall2(SYS_listen, @intCast(usize, fd), backlog); | 1237 | return syscall2(SYS_listen, @bitCast(usize, isize(fd)), backlog); |
| 1237 | } | 1238 | } |
| 1238 | | 1239 | |
| 1239 | pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { | 1240 | pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { |
| 1240 | return syscall6(SYS_sendto, @intCast(usize, fd), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen)); | 1241 | return syscall6(SYS_sendto, @bitCast(usize, isize(fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen)); |
| 1241 | } | 1242 | } |
| 1242 | | 1243 | |
| 1243 | pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) usize { | 1244 | pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) usize { |
| 1244 | return syscall4(SYS_socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(*fd[0])); | 1245 | return syscall4(SYS_socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(&fd[0])); |
| 1245 | } | 1246 | } |
| 1246 | | 1247 | |
| 1247 | pub fn accept(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1248 | pub fn accept(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| ... | @@ -1249,11 +1250,11 @@ pub fn accept(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | ... | @@ -1249,11 +1250,11 @@ pub fn accept(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1249 | } | 1250 | } |
| 1250 | | 1251 | |
| 1251 | pub fn accept4(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t, flags: u32) usize { | 1252 | pub fn accept4(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t, flags: u32) usize { |
| 1252 | return syscall4(SYS_accept4, @intCast(usize, fd), @ptrToInt(addr), @ptrToInt(len), flags); | 1253 | return syscall4(SYS_accept4, @bitCast(usize, isize(fd)), @ptrToInt(addr), @ptrToInt(len), flags); |
| 1253 | } | 1254 | } |
| 1254 | | 1255 | |
| 1255 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { | 1256 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { |
| 1256 | return syscall2(SYS_fstat, @intCast(usize, fd), @ptrToInt(stat_buf)); | 1257 | return syscall2(SYS_fstat, @bitCast(usize, isize(fd)), @ptrToInt(stat_buf)); |
| 1257 | } | 1258 | } |
| 1258 | | 1259 | |
| 1259 | // TODO https://github.com/ziglang/zig/issues/265 | 1260 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -1268,7 +1269,7 @@ pub fn lstat(pathname: [*]const u8, statbuf: *Stat) usize { | ... | @@ -1268,7 +1269,7 @@ pub fn lstat(pathname: [*]const u8, statbuf: *Stat) usize { |
| 1268 | | 1269 | |
| 1269 | // TODO https://github.com/ziglang/zig/issues/265 | 1270 | // TODO https://github.com/ziglang/zig/issues/265 |
| 1270 | pub fn fstatat(dirfd: i32, path: [*]const u8, stat_buf: *Stat, flags: u32) usize { | 1271 | pub fn fstatat(dirfd: i32, path: [*]const u8, stat_buf: *Stat, flags: u32) usize { |
| 1271 | return syscall4(SYS_fstatat, @intCast(usize, dirfd), @ptrToInt(path), @ptrToInt(stat_buf), flags); | 1272 | return syscall4(SYS_fstatat, @bitCast(usize, isize(dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags); |
| 1272 | } | 1273 | } |
| 1273 | | 1274 | |
| 1274 | // TODO https://github.com/ziglang/zig/issues/265 | 1275 | // TODO https://github.com/ziglang/zig/issues/265 |
| ... | @@ -1355,7 +1356,7 @@ pub fn epoll_create1(flags: usize) usize { | ... | @@ -1355,7 +1356,7 @@ pub fn epoll_create1(flags: usize) usize { |
| 1355 | } | 1356 | } |
| 1356 | | 1357 | |
| 1357 | pub fn epoll_ctl(epoll_fd: i32, op: u32, fd: i32, ev: *epoll_event) usize { | 1358 | pub fn epoll_ctl(epoll_fd: i32, op: u32, fd: i32, ev: *epoll_event) usize { |
| 1358 | return syscall4(SYS_epoll_ctl, @intCast(usize, epoll_fd), @intCast(usize, op), @intCast(usize, fd), @ptrToInt(ev)); | 1359 | return syscall4(SYS_epoll_ctl, @bitCast(usize, isize(epoll_fd)), @intCast(usize, op), @bitCast(usize, isize(fd)), @ptrToInt(ev)); |
| 1359 | } | 1360 | } |
| 1360 | | 1361 | |
| 1361 | pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32) usize { | 1362 | pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32) usize { |
| ... | @@ -1363,7 +1364,15 @@ pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout | ... | @@ -1363,7 +1364,15 @@ pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout |
| 1363 | } | 1364 | } |
| 1364 | | 1365 | |
| 1365 | pub fn epoll_pwait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32, sigmask: ?*sigset_t) usize { | 1366 | pub fn epoll_pwait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32, sigmask: ?*sigset_t) usize { |
| 1366 | return syscall6(SYS_epoll_pwait, @intCast(usize, epoll_fd), @ptrToInt(events), @intCast(usize, maxevents), @intCast(usize, timeout), @ptrToInt(sigmask), @sizeOf(sigset_t)); | 1367 | return syscall6( |
| | 1368 | SYS_epoll_pwait, |
| | 1369 | @bitCast(usize, isize(epoll_fd)), |
| | 1370 | @ptrToInt(events), |
| | 1371 | @intCast(usize, maxevents), |
| | 1372 | @bitCast(usize, isize(timeout)), |
| | 1373 | @ptrToInt(sigmask), |
| | 1374 | @sizeOf(sigset_t), |
| | 1375 | ); |
| 1367 | } | 1376 | } |
| 1368 | | 1377 | |
| 1369 | pub fn eventfd(count: u32, flags: u32) usize { | 1378 | pub fn eventfd(count: u32, flags: u32) usize { |
| ... | @@ -1371,7 +1380,7 @@ pub fn eventfd(count: u32, flags: u32) usize { | ... | @@ -1371,7 +1380,7 @@ pub fn eventfd(count: u32, flags: u32) usize { |
| 1371 | } | 1380 | } |
| 1372 | | 1381 | |
| 1373 | pub fn timerfd_create(clockid: i32, flags: u32) usize { | 1382 | pub fn timerfd_create(clockid: i32, flags: u32) usize { |
| 1374 | return syscall2(SYS_timerfd_create, @intCast(usize, clockid), flags); | 1383 | return syscall2(SYS_timerfd_create, @bitCast(usize, isize(clockid)), flags); |
| 1375 | } | 1384 | } |
| 1376 | | 1385 | |
| 1377 | pub const itimerspec = extern struct { | 1386 | pub const itimerspec = extern struct { |
| ... | @@ -1380,11 +1389,11 @@ pub const itimerspec = extern struct { | ... | @@ -1380,11 +1389,11 @@ pub const itimerspec = extern struct { |
| 1380 | }; | 1389 | }; |
| 1381 | | 1390 | |
| 1382 | pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize { | 1391 | pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize { |
| 1383 | return syscall2(SYS_timerfd_gettime, @intCast(usize, fd), @ptrToInt(curr_value)); | 1392 | return syscall2(SYS_timerfd_gettime, @bitCast(usize, isize(fd)), @ptrToInt(curr_value)); |
| 1384 | } | 1393 | } |
| 1385 | | 1394 | |
| 1386 | pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { | 1395 | pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { |
| 1387 | return syscall4(SYS_timerfd_settime, @intCast(usize, fd), flags, @ptrToInt(new_value), @ptrToInt(old_value)); | 1396 | return syscall4(SYS_timerfd_settime, @bitCast(usize, isize(fd)), flags, @ptrToInt(new_value), @ptrToInt(old_value)); |
| 1388 | } | 1397 | } |
| 1389 | | 1398 | |
| 1390 | pub const _LINUX_CAPABILITY_VERSION_1 = 0x19980330; | 1399 | pub const _LINUX_CAPABILITY_VERSION_1 = 0x19980330; |