on master help sign in
Remove vendored go packages (#77)

* rm vendor * Update Nix vendor sha for go modules Co-authored-by: Connor Brewster <cbrewster@hey.com>

commit7d0ec699993e8c904c90939cab218c9c39caa7e9 authorAllAwesome497 <47748690+AllAwesome497@users.noreply.github.com> dateTue 16 Nov 2021, 16:25 (5 years ago) parent75959c3
330 files changed+1−171115
build-prybar.nix+1−1 vendor/github.com/chzyer/readline/.gitignore−1 vendor/github.com/chzyer/readline/.travis.yml−8 vendor/github.com/chzyer/readline/CHANGELOG.md−58 vendor/github.com/chzyer/readline/LICENSE−22 vendor/github.com/chzyer/readline/README.md−114 vendor/github.com/chzyer/readline/ansi_windows.go−249 vendor/github.com/chzyer/readline/complete.go−285 vendor/github.com/chzyer/readline/complete_helper.go−165 vendor/github.com/chzyer/readline/complete_segment.go−82 vendor/github.com/chzyer/readline/history.go−330 vendor/github.com/chzyer/readline/operation.go−531 vendor/github.com/chzyer/readline/password.go−33 vendor/github.com/chzyer/readline/rawreader_windows.go−125 vendor/github.com/chzyer/readline/readline.go−326 vendor/github.com/chzyer/readline/remote.go−475 vendor/github.com/chzyer/readline/runebuf.go−629 vendor/github.com/chzyer/readline/runes.go−223 vendor/github.com/chzyer/readline/search.go−164 vendor/github.com/chzyer/readline/std.go−197 vendor/github.com/chzyer/readline/std_windows.go−9 vendor/github.com/chzyer/readline/term.go−123 vendor/github.com/chzyer/readline/term_bsd.go−29 vendor/github.com/chzyer/readline/term_linux.go−33 vendor/github.com/chzyer/readline/term_solaris.go−32 vendor/github.com/chzyer/readline/term_unix.go−24 vendor/github.com/chzyer/readline/term_windows.go−171 vendor/github.com/chzyer/readline/terminal.go−238 vendor/github.com/chzyer/readline/utils.go−277 vendor/github.com/chzyer/readline/utils_unix.go−83 vendor/github.com/chzyer/readline/utils_windows.go−41 vendor/github.com/chzyer/readline/vim.go−176 vendor/github.com/chzyer/readline/windows_api.go−152 vendor/golang.org/x/sys/AUTHORS−3 vendor/golang.org/x/sys/CONTRIBUTORS−3 vendor/golang.org/x/sys/LICENSE−27 vendor/golang.org/x/sys/PATENTS−22 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go−30 vendor/golang.org/x/sys/unix/.gitignore−2 vendor/golang.org/x/sys/unix/README.md−184 vendor/golang.org/x/sys/unix/affinity_linux.go−86 vendor/golang.org/x/sys/unix/aliases.go−15 vendor/golang.org/x/sys/unix/asm_aix_ppc64.s−17 vendor/golang.org/x/sys/unix/asm_bsd_386.s−29 vendor/golang.org/x/sys/unix/asm_bsd_amd64.s−29 vendor/golang.org/x/sys/unix/asm_bsd_arm.s−29 vendor/golang.org/x/sys/unix/asm_bsd_arm64.s−29 vendor/golang.org/x/sys/unix/asm_linux_386.s−65 vendor/golang.org/x/sys/unix/asm_linux_amd64.s−57 vendor/golang.org/x/sys/unix/asm_linux_arm.s−56 vendor/golang.org/x/sys/unix/asm_linux_arm64.s−52 vendor/golang.org/x/sys/unix/asm_linux_mips64x.s−56 vendor/golang.org/x/sys/unix/asm_linux_mipsx.s−54 vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s−44 vendor/golang.org/x/sys/unix/asm_linux_riscv64.s−47 vendor/golang.org/x/sys/unix/asm_linux_s390x.s−56 vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s−29 vendor/golang.org/x/sys/unix/asm_solaris_amd64.s−17 vendor/golang.org/x/sys/unix/asm_zos_s390x.s−426 vendor/golang.org/x/sys/unix/bluetooth_linux.go−36 vendor/golang.org/x/sys/unix/cap_freebsd.go−196 vendor/golang.org/x/sys/unix/constants.go−14 vendor/golang.org/x/sys/unix/dev_aix_ppc.go−27 vendor/golang.org/x/sys/unix/dev_aix_ppc64.go−29 vendor/golang.org/x/sys/unix/dev_darwin.go−24 vendor/golang.org/x/sys/unix/dev_dragonfly.go−30 vendor/golang.org/x/sys/unix/dev_freebsd.go−30 vendor/golang.org/x/sys/unix/dev_linux.go−42 vendor/golang.org/x/sys/unix/dev_netbsd.go−29 vendor/golang.org/x/sys/unix/dev_openbsd.go−29 vendor/golang.org/x/sys/unix/dev_zos.go−29 vendor/golang.org/x/sys/unix/dirent.go−103 vendor/golang.org/x/sys/unix/endian_big.go−10 vendor/golang.org/x/sys/unix/endian_little.go−10 vendor/golang.org/x/sys/unix/env_unix.go−32 vendor/golang.org/x/sys/unix/epoll_zos.go−221 vendor/golang.org/x/sys/unix/errors_freebsd_386.go−233 vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go−233 vendor/golang.org/x/sys/unix/errors_freebsd_arm.go−226 vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go−17 vendor/golang.org/x/sys/unix/fcntl.go−37 vendor/golang.org/x/sys/unix/fcntl_darwin.go−24 vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go−14 vendor/golang.org/x/sys/unix/fdset.go−30 vendor/golang.org/x/sys/unix/fstatfs_zos.go−164 vendor/golang.org/x/sys/unix/gccgo.go−60 vendor/golang.org/x/sys/unix/gccgo_c.c−45 vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go−21 vendor/golang.org/x/sys/unix/ioctl.go−75 vendor/golang.org/x/sys/unix/ioctl_zos.go−74 vendor/golang.org/x/sys/unix/mkall.sh−243 vendor/golang.org/x/sys/unix/mkerrors.sh−750 vendor/golang.org/x/sys/unix/pagesize_unix.go−16 vendor/golang.org/x/sys/unix/pledge_openbsd.go−163 vendor/golang.org/x/sys/unix/ptrace_darwin.go−12 vendor/golang.org/x/sys/unix/ptrace_ios.go−12 vendor/golang.org/x/sys/unix/race.go−31 vendor/golang.org/x/sys/unix/race0.go−26 vendor/golang.org/x/sys/unix/readdirent_getdents.go−13 vendor/golang.org/x/sys/unix/readdirent_getdirentries.go−20 vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go−16 vendor/golang.org/x/sys/unix/sockcmsg_linux.go−36 vendor/golang.org/x/sys/unix/sockcmsg_unix.go−93 vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go−47 vendor/golang.org/x/sys/unix/str.go−27 vendor/golang.org/x/sys/unix/syscall.go−95 vendor/golang.org/x/sys/unix/syscall_aix.go−553 vendor/golang.org/x/sys/unix/syscall_aix_ppc.go−54 vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go−85 vendor/golang.org/x/sys/unix/syscall_bsd.go−664 vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go−32 vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go−108 vendor/golang.org/x/sys/unix/syscall_darwin.go−677 vendor/golang.org/x/sys/unix/syscall_darwin_386.go−51 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go−51 vendor/golang.org/x/sys/unix/syscall_darwin_arm.go−51 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go−51 vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go−34 vendor/golang.org/x/sys/unix/syscall_dragonfly.go−541 vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go−57 vendor/golang.org/x/sys/unix/syscall_freebsd.go−872 vendor/golang.org/x/sys/unix/syscall_freebsd_386.go−67 vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go−67 vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go−63 vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go−63 vendor/golang.org/x/sys/unix/syscall_illumos.go−129 vendor/golang.org/x/sys/unix/syscall_linux.go−2510 vendor/golang.org/x/sys/unix/syscall_linux_386.go−388 vendor/golang.org/x/sys/unix/syscall_linux_amd64.go−195 vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go−13 vendor/golang.org/x/sys/unix/syscall_linux_arm.go−287 vendor/golang.org/x/sys/unix/syscall_linux_arm64.go−246 vendor/golang.org/x/sys/unix/syscall_linux_gc.go−15 vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go−17 vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go−14 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go−31 vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go−21 vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go−231 vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go−239 vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go−157 vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go−231 vendor/golang.org/x/sys/unix/syscall_linux_s390x.go−343 vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go−152 vendor/golang.org/x/sys/unix/syscall_netbsd.go−618 vendor/golang.org/x/sys/unix/syscall_netbsd_386.go−38 vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go−38 vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go−38 vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go−38 vendor/golang.org/x/sys/unix/syscall_openbsd.go−390 vendor/golang.org/x/sys/unix/syscall_openbsd_386.go−42 vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go−42 vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go−42 vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go−42 vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go−35 vendor/golang.org/x/sys/unix/syscall_solaris.go−746 vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go−28 vendor/golang.org/x/sys/unix/syscall_unix.go−431 vendor/golang.org/x/sys/unix/syscall_unix_gc.go−18 vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go−25 vendor/golang.org/x/sys/unix/syscall_zos_s390x.go−1781 vendor/golang.org/x/sys/unix/timestruct.go−77 vendor/golang.org/x/sys/unix/unveil_openbsd.go−42 vendor/golang.org/x/sys/unix/xattr_bsd.go−241 vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go−1385 vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go−1386 vendor/golang.org/x/sys/unix/zerrors_darwin_386.go−1789 vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go−1860 vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go−1789 vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go−1860 vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go−1738 vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go−1943 vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go−1942 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go−1841 vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go−1943 vendor/golang.org/x/sys/unix/zerrors_linux.go−2808 vendor/golang.org/x/sys/unix/zerrors_linux_386.go−801 vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go−801 vendor/golang.org/x/sys/unix/zerrors_linux_arm.go−807 vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go−798 vendor/golang.org/x/sys/unix/zerrors_linux_mips.go−808 vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go−808 vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go−808 vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go−808 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go−864 vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go−864 vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go−788 vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go−861 vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go−858 vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go−1780 vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go−1770 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go−1759 vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go−1770 vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go−1665 vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go−1775 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go−1667 vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go−1798 vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go−1863 vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go−1557 vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go−832 vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go−42 vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go−17 vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go−51 vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go−51 vendor/golang.org/x/sys/unix/zptrace_x86_linux.go−81 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go−1485 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go−1443 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go−1192 vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go−1070 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go−40 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s−12 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go−2431 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s−290 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go−40 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s−12 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go−2431 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s−290 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go−40 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s−12 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go−2417 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s−288 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go−40 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s−12 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go−2431 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s−290 vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go−1679 vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go−2016 vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go−2016 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go−2016 vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go−2016 vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go−128 vendor/golang.org/x/sys/unix/zsyscall_linux.go−1944 vendor/golang.org/x/sys/unix/zsyscall_linux_386.go−579 vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go−746 vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go−716 vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go−603 vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go−759 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go−730 vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go−730 vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go−759 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go−808 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go−808 vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go−583 vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go−578 vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go−741 vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go−1862 vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go−1862 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go−1862 vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go−1862 vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go−1693 vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go−1693 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go−1693 vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go−1693 vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go−1693 vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go−1983 vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go−1217 vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go−274 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go−272 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go−274 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go−276 vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go−280 vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go−438 vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go−440 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go−438 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go−438 vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go−317 vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go−397 vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go−397 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go−397 vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go−397 vendor/golang.org/x/sys/unix/zsysnum_linux_386.go−441 vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go−363 vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go−405 vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go−308 vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go−426 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go−356 vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go−356 vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go−426 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go−405 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go−405 vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go−307 vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go−370 vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go−384 vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go−275 vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go−275 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go−275 vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go−275 vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go−219 vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go−219 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go−219 vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go−218 vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go−221 vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go−2670 vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go−354 vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go−358 vendor/golang.org/x/sys/unix/ztypes_darwin_386.go−517 vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go−530 vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go−517 vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go−530 vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go−471 vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go−720 vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go−723 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go−704 vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go−701 vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go−40 vendor/golang.org/x/sys/unix/ztypes_linux.go−3737 vendor/golang.org/x/sys/unix/ztypes_linux_386.go−620 vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go−638 vendor/golang.org/x/sys/unix/ztypes_linux_arm.go−615 vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go−617 vendor/golang.org/x/sys/unix/ztypes_linux_mips.go−621 vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go−620 vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go−620 vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go−621 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go−627 vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go−627 vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go−645 vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go−641 vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go−622 vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go−500 vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go−508 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go−505 vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go−508 vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go−573 vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go−573 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go−574 vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go−567 vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go−567 vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go−442 vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go−402 vendor/modules.txt−11
build-prybar.nix+1−1
@@ -15,7 +15,7 @@ buildGoModule {
1515
1616 subPackages = [ "languages/${language}" ];
1717
18− vendorSha256 = null;
18+ vendorSha256 = "094js6lf6xpfn1i3418ifbsab5plci4z243spzryy1aah0yymd70";
1919
2020 # This prebiuild hook will setup the compiler flags on demand based on the package
2121 # If a language requires this, it MUST expost a ${pkgName}.pc file in its `lib/pkg-config`
vendor/github.com/chzyer/readline/.gitignoredeleted−1
@@ -1 +0,0 @@
1−.vscode/*
vendor/github.com/chzyer/readline/.travis.ymldeleted−8
@@ -1,8 +0,0 @@
1−language: go
2−go:
3− - 1.x
4−script:
5− - GOOS=windows go install github.com/chzyer/readline/example/...
6− - GOOS=linux go install github.com/chzyer/readline/example/...
7− - GOOS=darwin go install github.com/chzyer/readline/example/...
8− - go test -race -v
vendor/github.com/chzyer/readline/CHANGELOG.mddeleted−58
@@ -1,58 +0,0 @@
1−# ChangeLog
2−
3−### 1.4 - 2016-07-25
4−
5−* [#60][60] Support dynamic autocompletion
6−* Fix ANSI parser on Windows
7−* Fix wrong column width in complete mode on Windows
8−* Remove dependent package "golang.org/x/crypto/ssh/terminal"
9−
10−### 1.3 - 2016-05-09
11−
12−* [#38][38] add SetChildren for prefix completer interface
13−* [#42][42] improve multiple lines compatibility
14−* [#43][43] remove sub-package(runes) for gopkg compatibility
15−* [#46][46] Auto complete with space prefixed line
16−* [#48][48] support suspend process (ctrl+Z)
17−* [#49][49] fix bug that check equals with previous command
18−* [#53][53] Fix bug which causes integer divide by zero panicking when input buffer is empty
19−
20−### 1.2 - 2016-03-05
21−
22−* Add a demo for checking password strength [example/readline-pass-strength](https://github.com/chzyer/readline/blob/master/example/readline-pass-strength/readline-pass-strength.go), , written by [@sahib](https://github.com/sahib)
23−* [#23][23], support stdin remapping
24−* [#27][27], add a `UniqueEditLine` to `Config`, which will erase the editing line after user submited it, usually use in IM.
25−* Add a demo for multiline [example/readline-multiline](https://github.com/chzyer/readline/blob/master/example/readline-multiline/readline-multiline.go) which can submit one SQL by multiple lines.
26−* Supports performs even stdin/stdout is not a tty.
27−* Add a new simple apis for single instance, check by [here](https://github.com/chzyer/readline/blob/master/std.go). It need to save history manually if using this api.
28−* [#28][28], fixes the history is not working as expected.
29−* [#33][33], vim mode now support `c`, `d`, `x (delete character)`, `r (replace character)`
30−
31−### 1.1 - 2015-11-20
32−
33−* [#12][12] Add support for key `<Delete>`/`<Home>`/`<End>`
34−* Only enter raw mode as needed (calling `Readline()`), program will receive signal(e.g. Ctrl+C) if not interact with `readline`.
35−* Bugs fixed for `PrefixCompleter`
36−* Press `Ctrl+D` in empty line will cause `io.EOF` in error, Press `Ctrl+C` in anytime will cause `ErrInterrupt` instead of `io.EOF`, this will privodes a shell-like user experience.
37−* Customable Interrupt/EOF prompt in `Config`
38−* [#17][17] Change atomic package to use 32bit function to let it runnable on arm 32bit devices
39−* Provides a new password user experience(`readline.ReadPasswordEx()`).
40−
41−### 1.0 - 2015-10-14
42−
43−* Initial public release.
44−
45−[12]: https://github.com/chzyer/readline/pull/12
46−[17]: https://github.com/chzyer/readline/pull/17
47−[23]: https://github.com/chzyer/readline/pull/23
48−[27]: https://github.com/chzyer/readline/pull/27
49−[28]: https://github.com/chzyer/readline/pull/28
50−[33]: https://github.com/chzyer/readline/pull/33
51−[38]: https://github.com/chzyer/readline/pull/38
52−[42]: https://github.com/chzyer/readline/pull/42
53−[43]: https://github.com/chzyer/readline/pull/43
54−[46]: https://github.com/chzyer/readline/pull/46
55−[48]: https://github.com/chzyer/readline/pull/48
56−[49]: https://github.com/chzyer/readline/pull/49
57−[53]: https://github.com/chzyer/readline/pull/53
58−[60]: https://github.com/chzyer/readline/pull/60
vendor/github.com/chzyer/readline/LICENSEdeleted−22
@@ -1,22 +0,0 @@
1−The MIT License (MIT)
2−
3−Copyright (c) 2015 Chzyer
4−
5−Permission is hereby granted, free of charge, to any person obtaining a copy
6−of this software and associated documentation files (the "Software"), to deal
7−in the Software without restriction, including without limitation the rights
8−to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9−copies of the Software, and to permit persons to whom the Software is
10−furnished to do so, subject to the following conditions:
11−
12−The above copyright notice and this permission notice shall be included in all
13−copies or substantial portions of the Software.
14−
15−THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16−IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17−FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18−AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19−LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20−OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21−SOFTWARE.
22−
vendor/github.com/chzyer/readline/README.mddeleted−114
@@ -1,114 +0,0 @@
1−[![Build Status](https://travis-ci.org/chzyer/readline.svg?branch=master)](https://travis-ci.org/chzyer/readline)
2−[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
3−[![Version](https://img.shields.io/github/tag/chzyer/readline.svg)](https://github.com/chzyer/readline/releases)
4−[![GoDoc](https://godoc.org/github.com/chzyer/readline?status.svg)](https://godoc.org/github.com/chzyer/readline)
5−[![OpenCollective](https://opencollective.com/readline/badge/backers.svg)](#backers)
6−[![OpenCollective](https://opencollective.com/readline/badge/sponsors.svg)](#sponsors)
7−
8−<p align="center">
9−<img src="https://raw.githubusercontent.com/chzyer/readline/assets/logo.png" />
10−<a href="https://asciinema.org/a/32oseof9mkilg7t7d4780qt4m" target="_blank"><img src="https://asciinema.org/a/32oseof9mkilg7t7d4780qt4m.png" width="654"/></a>
11−<img src="https://raw.githubusercontent.com/chzyer/readline/assets/logo_f.png" />
12−</p>
13−
14−A powerful readline library in `Linux` `macOS` `Windows` `Solaris`
15−
16−## Guide
17−
18−* [Demo](example/readline-demo/readline-demo.go)
19−* [Shortcut](doc/shortcut.md)
20−
21−## Repos using readline
22−
23−[![cockroachdb](https://img.shields.io/github/stars/cockroachdb/cockroach.svg?label=cockroachdb/cockroach)](https://github.com/cockroachdb/cockroach)
24−[![robertkrimen/otto](https://img.shields.io/github/stars/robertkrimen/otto.svg?label=robertkrimen/otto)](https://github.com/robertkrimen/otto)
25−[![empire](https://img.shields.io/github/stars/remind101/empire.svg?label=remind101/empire)](https://github.com/remind101/empire)
26−[![mehrdadrad/mylg](https://img.shields.io/github/stars/mehrdadrad/mylg.svg?label=mehrdadrad/mylg)](https://github.com/mehrdadrad/mylg)
27−[![knq/usql](https://img.shields.io/github/stars/knq/usql.svg?label=knq/usql)](https://github.com/knq/usql)
28−[![youtube/doorman](https://img.shields.io/github/stars/youtube/doorman.svg?label=youtube/doorman)](https://github.com/youtube/doorman)
29−[![bom-d-van/harp](https://img.shields.io/github/stars/bom-d-van/harp.svg?label=bom-d-van/harp)](https://github.com/bom-d-van/harp)
30−[![abiosoft/ishell](https://img.shields.io/github/stars/abiosoft/ishell.svg?label=abiosoft/ishell)](https://github.com/abiosoft/ishell)
31−[![Netflix/hal-9001](https://img.shields.io/github/stars/Netflix/hal-9001.svg?label=Netflix/hal-9001)](https://github.com/Netflix/hal-9001)
32−[![docker/go-p9p](https://img.shields.io/github/stars/docker/go-p9p.svg?label=docker/go-p9p)](https://github.com/docker/go-p9p)
33−
34−
35−## Feedback
36−
37−If you have any questions, please submit a github issue and any pull requests is welcomed :)
38−
39−* [https://twitter.com/chzyer](https://twitter.com/chzyer)
40−* [http://weibo.com/2145262190](http://weibo.com/2145262190)
41−
42−
43−## Backers
44−
45−Love Readline? Help me keep it alive by donating funds to cover project expenses!<br />
46−[[Become a backer](https://opencollective.com/readline#backer)]
47−
48−<a href="https://opencollective.com/readline/backer/0/website" target="_blank"><img src="https://opencollective.com/readline/backer/0/avatar.svg"></a>
49−<a href="https://opencollective.com/readline/backer/1/website" target="_blank"><img src="https://opencollective.com/readline/backer/1/avatar.svg"></a>
50−<a href="https://opencollective.com/readline/backer/2/website" target="_blank"><img src="https://opencollective.com/readline/backer/2/avatar.svg"></a>
51−<a href="https://opencollective.com/readline/backer/3/website" target="_blank"><img src="https://opencollective.com/readline/backer/3/avatar.svg"></a>
52−<a href="https://opencollective.com/readline/backer/4/website" target="_blank"><img src="https://opencollective.com/readline/backer/4/avatar.svg"></a>
53−<a href="https://opencollective.com/readline/backer/5/website" target="_blank"><img src="https://opencollective.com/readline/backer/5/avatar.svg"></a>
54−<a href="https://opencollective.com/readline/backer/6/website" target="_blank"><img src="https://opencollective.com/readline/backer/6/avatar.svg"></a>
55−<a href="https://opencollective.com/readline/backer/7/website" target="_blank"><img src="https://opencollective.com/readline/backer/7/avatar.svg"></a>
56−<a href="https://opencollective.com/readline/backer/8/website" target="_blank"><img src="https://opencollective.com/readline/backer/8/avatar.svg"></a>
57−<a href="https://opencollective.com/readline/backer/9/website" target="_blank"><img src="https://opencollective.com/readline/backer/9/avatar.svg"></a>
58−<a href="https://opencollective.com/readline/backer/10/website" target="_blank"><img src="https://opencollective.com/readline/backer/10/avatar.svg"></a>
59−<a href="https://opencollective.com/readline/backer/11/website" target="_blank"><img src="https://opencollective.com/readline/backer/11/avatar.svg"></a>
60−<a href="https://opencollective.com/readline/backer/12/website" target="_blank"><img src="https://opencollective.com/readline/backer/12/avatar.svg"></a>
61−<a href="https://opencollective.com/readline/backer/13/website" target="_blank"><img src="https://opencollective.com/readline/backer/13/avatar.svg"></a>
62−<a href="https://opencollective.com/readline/backer/14/website" target="_blank"><img src="https://opencollective.com/readline/backer/14/avatar.svg"></a>
63−<a href="https://opencollective.com/readline/backer/15/website" target="_blank"><img src="https://opencollective.com/readline/backer/15/avatar.svg"></a>
64−<a href="https://opencollective.com/readline/backer/16/website" target="_blank"><img src="https://opencollective.com/readline/backer/16/avatar.svg"></a>
65−<a href="https://opencollective.com/readline/backer/17/website" target="_blank"><img src="https://opencollective.com/readline/backer/17/avatar.svg"></a>
66−<a href="https://opencollective.com/readline/backer/18/website" target="_blank"><img src="https://opencollective.com/readline/backer/18/avatar.svg"></a>
67−<a href="https://opencollective.com/readline/backer/19/website" target="_blank"><img src="https://opencollective.com/readline/backer/19/avatar.svg"></a>
68−<a href="https://opencollective.com/readline/backer/20/website" target="_blank"><img src="https://opencollective.com/readline/backer/20/avatar.svg"></a>
69−<a href="https://opencollective.com/readline/backer/21/website" target="_blank"><img src="https://opencollective.com/readline/backer/21/avatar.svg"></a>
70−<a href="https://opencollective.com/readline/backer/22/website" target="_blank"><img src="https://opencollective.com/readline/backer/22/avatar.svg"></a>
71−<a href="https://opencollective.com/readline/backer/23/website" target="_blank"><img src="https://opencollective.com/readline/backer/23/avatar.svg"></a>
72−<a href="https://opencollective.com/readline/backer/24/website" target="_blank"><img src="https://opencollective.com/readline/backer/24/avatar.svg"></a>
73−<a href="https://opencollective.com/readline/backer/25/website" target="_blank"><img src="https://opencollective.com/readline/backer/25/avatar.svg"></a>
74−<a href="https://opencollective.com/readline/backer/26/website" target="_blank"><img src="https://opencollective.com/readline/backer/26/avatar.svg"></a>
75−<a href="https://opencollective.com/readline/backer/27/website" target="_blank"><img src="https://opencollective.com/readline/backer/27/avatar.svg"></a>
76−<a href="https://opencollective.com/readline/backer/28/website" target="_blank"><img src="https://opencollective.com/readline/backer/28/avatar.svg"></a>
77−<a href="https://opencollective.com/readline/backer/29/website" target="_blank"><img src="https://opencollective.com/readline/backer/29/avatar.svg"></a>
78−
79−
80−## Sponsors
81−
82−Become a sponsor and get your logo here on our Github page. [[Become a sponsor](https://opencollective.com/readline#sponsor)]
83−
84−<a href="https://opencollective.com/readline/sponsor/0/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/0/avatar.svg"></a>
85−<a href="https://opencollective.com/readline/sponsor/1/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/1/avatar.svg"></a>
86−<a href="https://opencollective.com/readline/sponsor/2/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/2/avatar.svg"></a>
87−<a href="https://opencollective.com/readline/sponsor/3/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/3/avatar.svg"></a>
88−<a href="https://opencollective.com/readline/sponsor/4/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/4/avatar.svg"></a>
89−<a href="https://opencollective.com/readline/sponsor/5/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/5/avatar.svg"></a>
90−<a href="https://opencollective.com/readline/sponsor/6/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/6/avatar.svg"></a>
91−<a href="https://opencollective.com/readline/sponsor/7/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/7/avatar.svg"></a>
92−<a href="https://opencollective.com/readline/sponsor/8/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/8/avatar.svg"></a>
93−<a href="https://opencollective.com/readline/sponsor/9/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/9/avatar.svg"></a>
94−<a href="https://opencollective.com/readline/sponsor/10/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/10/avatar.svg"></a>
95−<a href="https://opencollective.com/readline/sponsor/11/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/11/avatar.svg"></a>
96−<a href="https://opencollective.com/readline/sponsor/12/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/12/avatar.svg"></a>
97−<a href="https://opencollective.com/readline/sponsor/13/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/13/avatar.svg"></a>
98−<a href="https://opencollective.com/readline/sponsor/14/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/14/avatar.svg"></a>
99−<a href="https://opencollective.com/readline/sponsor/15/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/15/avatar.svg"></a>
100−<a href="https://opencollective.com/readline/sponsor/16/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/16/avatar.svg"></a>
101−<a href="https://opencollective.com/readline/sponsor/17/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/17/avatar.svg"></a>
102−<a href="https://opencollective.com/readline/sponsor/18/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/18/avatar.svg"></a>
103−<a href="https://opencollective.com/readline/sponsor/19/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/19/avatar.svg"></a>
104−<a href="https://opencollective.com/readline/sponsor/20/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/20/avatar.svg"></a>
105−<a href="https://opencollective.com/readline/sponsor/21/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/21/avatar.svg"></a>
106−<a href="https://opencollective.com/readline/sponsor/22/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/22/avatar.svg"></a>
107−<a href="https://opencollective.com/readline/sponsor/23/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/23/avatar.svg"></a>
108−<a href="https://opencollective.com/readline/sponsor/24/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/24/avatar.svg"></a>
109−<a href="https://opencollective.com/readline/sponsor/25/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/25/avatar.svg"></a>
110−<a href="https://opencollective.com/readline/sponsor/26/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/26/avatar.svg"></a>
111−<a href="https://opencollective.com/readline/sponsor/27/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/27/avatar.svg"></a>
112−<a href="https://opencollective.com/readline/sponsor/28/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/28/avatar.svg"></a>
113−<a href="https://opencollective.com/readline/sponsor/29/website" target="_blank"><img src="https://opencollective.com/readline/sponsor/29/avatar.svg"></a>
114−
vendor/github.com/chzyer/readline/ansi_windows.godeleted−249
@@ -1,249 +0,0 @@
1−// +build windows
2−
3−package readline
4−
5−import (
6− "bufio"
7− "io"
8− "strconv"
9− "strings"
10− "sync"
11− "unicode/utf8"
12− "unsafe"
13−)
14−
15−const (
16− _ = uint16(0)
17− COLOR_FBLUE = 0x0001
18− COLOR_FGREEN = 0x0002
19− COLOR_FRED = 0x0004
20− COLOR_FINTENSITY = 0x0008
21−
22− COLOR_BBLUE = 0x0010
23− COLOR_BGREEN = 0x0020
24− COLOR_BRED = 0x0040
25− COLOR_BINTENSITY = 0x0080
26−
27− COMMON_LVB_UNDERSCORE = 0x8000
28− COMMON_LVB_BOLD = 0x0007
29−)
30−
31−var ColorTableFg = []word{
32− 0, // 30: Black
33− COLOR_FRED, // 31: Red
34− COLOR_FGREEN, // 32: Green
35− COLOR_FRED | COLOR_FGREEN, // 33: Yellow
36− COLOR_FBLUE, // 34: Blue
37− COLOR_FRED | COLOR_FBLUE, // 35: Magenta
38− COLOR_FGREEN | COLOR_FBLUE, // 36: Cyan
39− COLOR_FRED | COLOR_FBLUE | COLOR_FGREEN, // 37: White
40−}
41−
42−var ColorTableBg = []word{
43− 0, // 40: Black
44− COLOR_BRED, // 41: Red
45− COLOR_BGREEN, // 42: Green
46− COLOR_BRED | COLOR_BGREEN, // 43: Yellow
47− COLOR_BBLUE, // 44: Blue
48− COLOR_BRED | COLOR_BBLUE, // 45: Magenta
49− COLOR_BGREEN | COLOR_BBLUE, // 46: Cyan
50− COLOR_BRED | COLOR_BBLUE | COLOR_BGREEN, // 47: White
51−}
52−
53−type ANSIWriter struct {
54− target io.Writer
55− wg sync.WaitGroup
56− ctx *ANSIWriterCtx
57− sync.Mutex
58−}
59−
60−func NewANSIWriter(w io.Writer) *ANSIWriter {
61− a := &ANSIWriter{
62− target: w,
63− ctx: NewANSIWriterCtx(w),
64− }
65− return a
66−}
67−
68−func (a *ANSIWriter) Close() error {
69− a.wg.Wait()
70− return nil
71−}
72−
73−type ANSIWriterCtx struct {
74− isEsc bool
75− isEscSeq bool
76− arg []string
77− target *bufio.Writer
78− wantFlush bool
79−}
80−
81−func NewANSIWriterCtx(target io.Writer) *ANSIWriterCtx {
82− return &ANSIWriterCtx{
83− target: bufio.NewWriter(target),
84− }
85−}
86−
87−func (a *ANSIWriterCtx) Flush() {
88− a.target.Flush()
89−}
90−
91−func (a *ANSIWriterCtx) process(r rune) bool {
92− if a.wantFlush {
93− if r == 0 || r == CharEsc {
94− a.wantFlush = false
95− a.target.Flush()
96− }
97− }
98− if a.isEscSeq {
99− a.isEscSeq = a.ioloopEscSeq(a.target, r, &a.arg)
100− return true
101− }
102−
103− switch r {
104− case CharEsc:
105− a.isEsc = true
106− case '[':
107− if a.isEsc {
108− a.arg = nil
109− a.isEscSeq = true
110− a.isEsc = false
111− break
112− }
113− fallthrough
114− default:
115− a.target.WriteRune(r)
116− a.wantFlush = true
117− }
118− return true
119−}
120−
121−func (a *ANSIWriterCtx) ioloopEscSeq(w *bufio.Writer, r rune, argptr *[]string) bool {
122− arg := *argptr
123− var err error
124−
125− if r >= 'A' && r <= 'D' {
126− count := short(GetInt(arg, 1))
127− info, err := GetConsoleScreenBufferInfo()
128− if err != nil {
129− return false
130− }
131− switch r {
132− case 'A': // up
133− info.dwCursorPosition.y -= count
134− case 'B': // down
135− info.dwCursorPosition.y += count
136− case 'C': // right
137− info.dwCursorPosition.x += count
138− case 'D': // left
139− info.dwCursorPosition.x -= count
140− }
141− SetConsoleCursorPosition(&info.dwCursorPosition)
142− return false
143− }
144−
145− switch r {
146− case 'J':
147− killLines()
148− case 'K':
149− eraseLine()
150− case 'm':
151− color := word(0)
152− for _, item := range arg {
153− var c int
154− c, err = strconv.Atoi(item)
155− if err != nil {
156− w.WriteString("[" + strings.Join(arg, ";") + "m")
157− break
158− }
159− if c >= 30 && c < 40 {
160− color ^= COLOR_FINTENSITY
161− color |= ColorTableFg[c-30]
162− } else if c >= 40 && c < 50 {
163− color ^= COLOR_BINTENSITY
164− color |= ColorTableBg[c-40]
165− } else if c == 4 {
166− color |= COMMON_LVB_UNDERSCORE | ColorTableFg[7]
167− } else if c == 1 {
168− color |= COMMON_LVB_BOLD | COLOR_FINTENSITY
169− } else { // unknown code treat as reset
170− color = ColorTableFg[7]
171− }
172− }
173− if err != nil {
174− break
175− }
176− kernel.SetConsoleTextAttribute(stdout, uintptr(color))
177− case '\007': // set title
178− case ';':
179− if len(arg) == 0 || arg[len(arg)-1] != "" {
180− arg = append(arg, "")
181− *argptr = arg
182− }
183− return true
184− default:
185− if len(arg) == 0 {
186− arg = append(arg, "")
187− }
188− arg[len(arg)-1] += string(r)
189− *argptr = arg
190− return true
191− }
192− *argptr = nil
193− return false
194−}
195−
196−func (a *ANSIWriter) Write(b []byte) (int, error) {
197− a.Lock()
198− defer a.Unlock()
199−
200− off := 0
201− for len(b) > off {
202− r, size := utf8.DecodeRune(b[off:])
203− if size == 0 {
204− return off, io.ErrShortWrite
205− }
206− off += size
207− a.ctx.process(r)
208− }
209− a.ctx.Flush()
210− return off, nil
211−}
212−
213−func killLines() error {
214− sbi, err := GetConsoleScreenBufferInfo()
215− if err != nil {
216− return err
217− }
218−
219− size := (sbi.dwCursorPosition.y - sbi.dwSize.y) * sbi.dwSize.x
220− size += sbi.dwCursorPosition.x
221−
222− var written int
223− kernel.FillConsoleOutputAttribute(stdout, uintptr(ColorTableFg[7]),
224− uintptr(size),
225− sbi.dwCursorPosition.ptr(),
226− uintptr(unsafe.Pointer(&written)),
227− )
228− return kernel.FillConsoleOutputCharacterW(stdout, uintptr(' '),
229− uintptr(size),
230− sbi.dwCursorPosition.ptr(),
231− uintptr(unsafe.Pointer(&written)),
232− )
233−}
234−
235−func eraseLine() error {
236− sbi, err := GetConsoleScreenBufferInfo()
237− if err != nil {
238− return err
239− }
240−
241− size := sbi.dwSize.x
242− sbi.dwCursorPosition.x = 0
243− var written int
244− return kernel.FillConsoleOutputCharacterW(stdout, uintptr(' '),
245− uintptr(size),
246− sbi.dwCursorPosition.ptr(),
247− uintptr(unsafe.Pointer(&written)),
248− )
249−}
vendor/github.com/chzyer/readline/complete.godeleted−285
@@ -1,285 +0,0 @@
1−package readline
2−
3−import (
4− "bufio"
5− "bytes"
6− "fmt"
7− "io"
8−)
9−
10−type AutoCompleter interface {
11− // Readline will pass the whole line and current offset to it
12− // Completer need to pass all the candidates, and how long they shared the same characters in line
13− // Example:
14− // [go, git, git-shell, grep]
15− // Do("g", 1) => ["o", "it", "it-shell", "rep"], 1
16− // Do("gi", 2) => ["t", "t-shell"], 2
17− // Do("git", 3) => ["", "-shell"], 3
18− Do(line []rune, pos int) (newLine [][]rune, length int)
19−}
20−
21−type TabCompleter struct{}
22−
23−func (t *TabCompleter) Do([]rune, int) ([][]rune, int) {
24− return [][]rune{[]rune("\t")}, 0
25−}
26−
27−type opCompleter struct {
28− w io.Writer
29− op *Operation
30− width int
31−
32− inCompleteMode bool
33− inSelectMode bool
34− candidate [][]rune
35− candidateSource []rune
36− candidateOff int
37− candidateChoise int
38− candidateColNum int
39−}
40−
41−func newOpCompleter(w io.Writer, op *Operation, width int) *opCompleter {
42− return &opCompleter{
43− w: w,
44− op: op,
45− width: width,
46− }
47−}
48−
49−func (o *opCompleter) doSelect() {
50− if len(o.candidate) == 1 {
51− o.op.buf.WriteRunes(o.candidate[0])
52− o.ExitCompleteMode(false)
53− return
54− }
55− o.nextCandidate(1)
56− o.CompleteRefresh()
57−}
58−
59−func (o *opCompleter) nextCandidate(i int) {
60− o.candidateChoise += i
61− o.candidateChoise = o.candidateChoise % len(o.candidate)
62− if o.candidateChoise < 0 {
63− o.candidateChoise = len(o.candidate) + o.candidateChoise
64− }
65−}
66−
67−func (o *opCompleter) OnComplete() bool {
68− if o.width == 0 {
69− return false
70− }
71− if o.IsInCompleteSelectMode() {
72− o.doSelect()
73− return true
74− }
75−
76− buf := o.op.buf
77− rs := buf.Runes()
78−
79− if o.IsInCompleteMode() && o.candidateSource != nil && runes.Equal(rs, o.candidateSource) {
80− o.EnterCompleteSelectMode()
81− o.doSelect()
82− return true
83− }
84−
85− o.ExitCompleteSelectMode()
86− o.candidateSource = rs
87− newLines, offset := o.op.cfg.AutoComplete.Do(rs, buf.idx)
88− if len(newLines) == 0 {
89− o.ExitCompleteMode(false)
90− return true
91− }
92−
93− // only Aggregate candidates in non-complete mode
94− if !o.IsInCompleteMode() {
95− if len(newLines) == 1 {
96− buf.WriteRunes(newLines[0])
97− o.ExitCompleteMode(false)
98− return true
99− }
100−
101− same, size := runes.Aggregate(newLines)
102− if size > 0 {
103− buf.WriteRunes(same)
104− o.ExitCompleteMode(false)
105− return true
106− }
107− }
108−
109− o.EnterCompleteMode(offset, newLines)
110− return true
111−}
112−
113−func (o *opCompleter) IsInCompleteSelectMode() bool {
114− return o.inSelectMode
115−}
116−
117−func (o *opCompleter) IsInCompleteMode() bool {
118− return o.inCompleteMode
119−}
120−
121−func (o *opCompleter) HandleCompleteSelect(r rune) bool {
122− next := true
123− switch r {
124− case CharEnter, CharCtrlJ:
125− next = false
126− o.op.buf.WriteRunes(o.op.candidate[o.op.candidateChoise])
127− o.ExitCompleteMode(false)
128− case CharLineStart:
129− num := o.candidateChoise % o.candidateColNum
130− o.nextCandidate(-num)
131− case CharLineEnd:
132− num := o.candidateColNum - o.candidateChoise%o.candidateColNum - 1
133− o.candidateChoise += num
134− if o.candidateChoise >= len(o.candidate) {
135− o.candidateChoise = len(o.candidate) - 1
136− }
137− case CharBackspace:
138− o.ExitCompleteSelectMode()
139− next = false
140− case CharTab, CharForward:
141− o.doSelect()
142− case CharBell, CharInterrupt:
143− o.ExitCompleteMode(true)
144− next = false
145− case CharNext:
146− tmpChoise := o.candidateChoise + o.candidateColNum
147− if tmpChoise >= o.getMatrixSize() {
148− tmpChoise -= o.getMatrixSize()
149− } else if tmpChoise >= len(o.candidate) {
150− tmpChoise += o.candidateColNum
151− tmpChoise -= o.getMatrixSize()
152− }
153− o.candidateChoise = tmpChoise
154− case CharBackward:
155− o.nextCandidate(-1)
156− case CharPrev:
157− tmpChoise := o.candidateChoise - o.candidateColNum
158− if tmpChoise < 0 {
159− tmpChoise += o.getMatrixSize()
160− if tmpChoise >= len(o.candidate) {
161− tmpChoise -= o.candidateColNum
162− }
163− }
164− o.candidateChoise = tmpChoise
165− default:
166− next = false
167− o.ExitCompleteSelectMode()
168− }
169− if next {
170− o.CompleteRefresh()
171− return true
172− }
173− return false
174−}
175−
176−func (o *opCompleter) getMatrixSize() int {
177− line := len(o.candidate) / o.candidateColNum
178− if len(o.candidate)%o.candidateColNum != 0 {
179− line++
180− }
181− return line * o.candidateColNum
182−}
183−
184−func (o *opCompleter) OnWidthChange(newWidth int) {
185− o.width = newWidth
186−}
187−
188−func (o *opCompleter) CompleteRefresh() {
189− if !o.inCompleteMode {
190− return
191− }
192− lineCnt := o.op.buf.CursorLineCount()
193− colWidth := 0
194− for _, c := range o.candidate {
195− w := runes.WidthAll(c)
196− if w > colWidth {
197− colWidth = w
198− }
199− }
200− colWidth += o.candidateOff + 1
201− same := o.op.buf.RuneSlice(-o.candidateOff)
202−
203− // -1 to avoid reach the end of line
204− width := o.width - 1
205− colNum := width / colWidth
206− if colNum != 0 {
207− colWidth += (width - (colWidth * colNum)) / colNum
208− }
209−
210− o.candidateColNum = colNum
211− buf := bufio.NewWriter(o.w)
212− buf.Write(bytes.Repeat([]byte("\n"), lineCnt))
213−
214− colIdx := 0
215− lines := 1
216− buf.WriteString("\033[J")
217− for idx, c := range o.candidate {
218− inSelect := idx == o.candidateChoise && o.IsInCompleteSelectMode()
219− if inSelect {
220− buf.WriteString("\033[30;47m")
221− }
222− buf.WriteString(string(same))
223− buf.WriteString(string(c))
224− buf.Write(bytes.Repeat([]byte(" "), colWidth-runes.WidthAll(c)-runes.WidthAll(same)))
225−
226− if inSelect {
227− buf.WriteString("\033[0m")
228− }
229−
230− colIdx++
231− if colIdx == colNum {
232− buf.WriteString("\n")
233− lines++
234− colIdx = 0
235− }
236− }
237−
238− // move back
239− fmt.Fprintf(buf, "\033[%dA\r", lineCnt-1+lines)
240− fmt.Fprintf(buf, "\033[%dC", o.op.buf.idx+o.op.buf.PromptLen())
241− buf.Flush()
242−}
243−
244−func (o *opCompleter) aggCandidate(candidate [][]rune) int {
245− offset := 0
246− for i := 0; i < len(candidate[0]); i++ {
247− for j := 0; j < len(candidate)-1; j++ {
248− if i > len(candidate[j]) {
249− goto aggregate
250− }
251− if candidate[j][i] != candidate[j+1][i] {
252− goto aggregate
253− }
254− }
255− offset = i
256− }
257−aggregate:
258− return offset
259−}
260−
261−func (o *opCompleter) EnterCompleteSelectMode() {
262− o.inSelectMode = true
263− o.candidateChoise = -1
264− o.CompleteRefresh()
265−}
266−
267−func (o *opCompleter) EnterCompleteMode(offset int, candidate [][]rune) {
268− o.inCompleteMode = true
269− o.candidate = candidate
270− o.candidateOff = offset
271− o.CompleteRefresh()
272−}
273−
274−func (o *opCompleter) ExitCompleteSelectMode() {
275− o.inSelectMode = false
276− o.candidate = nil
277− o.candidateChoise = -1
278− o.candidateOff = -1
279− o.candidateSource = nil
280−}
281−
282−func (o *opCompleter) ExitCompleteMode(revent bool) {
283− o.inCompleteMode = false
284− o.ExitCompleteSelectMode()
285−}
vendor/github.com/chzyer/readline/complete_helper.godeleted−165
@@ -1,165 +0,0 @@
1−package readline
2−
3−import (
4− "bytes"
5− "strings"
6−)
7−
8−// Caller type for dynamic completion
9−type DynamicCompleteFunc func(string) []string
10−
11−type PrefixCompleterInterface interface {
12− Print(prefix string, level int, buf *bytes.Buffer)
13− Do(line []rune, pos int) (newLine [][]rune, length int)
14− GetName() []rune
15− GetChildren() []PrefixCompleterInterface
16− SetChildren(children []PrefixCompleterInterface)
17−}
18−
19−type DynamicPrefixCompleterInterface interface {
20− PrefixCompleterInterface
21− IsDynamic() bool
22− GetDynamicNames(line []rune) [][]rune
23−}
24−
25−type PrefixCompleter struct {
26− Name []rune
27− Dynamic bool
28− Callback DynamicCompleteFunc
29− Children []PrefixCompleterInterface
30−}
31−
32−func (p *PrefixCompleter) Tree(prefix string) string {
33− buf := bytes.NewBuffer(nil)
34− p.Print(prefix, 0, buf)
35− return buf.String()
36−}
37−
38−func Print(p PrefixCompleterInterface, prefix string, level int, buf *bytes.Buffer) {
39− if strings.TrimSpace(string(p.GetName())) != "" {
40− buf.WriteString(prefix)
41− if level > 0 {
42− buf.WriteString("├")
43− buf.WriteString(strings.Repeat("─", (level*4)-2))
44− buf.WriteString(" ")
45− }
46− buf.WriteString(string(p.GetName()) + "\n")
47− level++
48− }
49− for _, ch := range p.GetChildren() {
50− ch.Print(prefix, level, buf)
51− }
52−}
53−
54−func (p *PrefixCompleter) Print(prefix string, level int, buf *bytes.Buffer) {
55− Print(p, prefix, level, buf)
56−}
57−
58−func (p *PrefixCompleter) IsDynamic() bool {
59− return p.Dynamic
60−}
61−
62−func (p *PrefixCompleter) GetName() []rune {
63− return p.Name
64−}
65−
66−func (p *PrefixCompleter) GetDynamicNames(line []rune) [][]rune {
67− var names = [][]rune{}
68− for _, name := range p.Callback(string(line)) {
69− names = append(names, []rune(name+" "))
70− }
71− return names
72−}
73−
74−func (p *PrefixCompleter) GetChildren() []PrefixCompleterInterface {
75− return p.Children
76−}
77−
78−func (p *PrefixCompleter) SetChildren(children []PrefixCompleterInterface) {
79− p.Children = children
80−}
81−
82−func NewPrefixCompleter(pc ...PrefixCompleterInterface) *PrefixCompleter {
83− return PcItem("", pc...)
84−}
85−
86−func PcItem(name string, pc ...PrefixCompleterInterface) *PrefixCompleter {
87− name += " "
88− return &PrefixCompleter{
89− Name: []rune(name),
90− Dynamic: false,
91− Children: pc,
92− }
93−}
94−
95−func PcItemDynamic(callback DynamicCompleteFunc, pc ...PrefixCompleterInterface) *PrefixCompleter {
96− return &PrefixCompleter{
97− Callback: callback,
98− Dynamic: true,
99− Children: pc,
100− }
101−}
102−
103−func (p *PrefixCompleter) Do(line []rune, pos int) (newLine [][]rune, offset int) {
104− return doInternal(p, line, pos, line)
105−}
106−
107−func Do(p PrefixCompleterInterface, line []rune, pos int) (newLine [][]rune, offset int) {
108− return doInternal(p, line, pos, line)
109−}
110−
111−func doInternal(p PrefixCompleterInterface, line []rune, pos int, origLine []rune) (newLine [][]rune, offset int) {
112− line = runes.TrimSpaceLeft(line[:pos])
113− goNext := false
114− var lineCompleter PrefixCompleterInterface
115− for _, child := range p.GetChildren() {
116− childNames := make([][]rune, 1)
117−
118− childDynamic, ok := child.(DynamicPrefixCompleterInterface)
119− if ok && childDynamic.IsDynamic() {
120− childNames = childDynamic.GetDynamicNames(origLine)
121− } else {
122− childNames[0] = child.GetName()
123− }
124−
125− for _, childName := range childNames {
126− if len(line) >= len(childName) {
127− if runes.HasPrefix(line, childName) {
128− if len(line) == len(childName) {
129− newLine = append(newLine, []rune{' '})
130− } else {
131− newLine = append(newLine, childName)
132− }
133− offset = len(childName)
134− lineCompleter = child
135− goNext = true
136− }
137− } else {
138− if runes.HasPrefix(childName, line) {
139− newLine = append(newLine, childName[len(line):])
140− offset = len(line)
141− lineCompleter = child
142− }
143− }
144− }
145− }
146−
147− if len(newLine) != 1 {
148− return
149− }
150−
151− tmpLine := make([]rune, 0, len(line))
152− for i := offset; i < len(line); i++ {
153− if line[i] == ' ' {
154− continue
155− }
156−
157− tmpLine = append(tmpLine, line[i:]...)
158− return doInternal(lineCompleter, tmpLine, len(tmpLine), origLine)
159− }
160−
161− if goNext {
162− return doInternal(lineCompleter, nil, 0, origLine)
163− }
164− return
165−}
vendor/github.com/chzyer/readline/complete_segment.godeleted−82
@@ -1,82 +0,0 @@
1−package readline
2−
3−type SegmentCompleter interface {
4− // a
5− // |- a1
6− // |--- a11
7− // |- a2
8− // b
9− // input:
10− // DoTree([], 0) [a, b]
11− // DoTree([a], 1) [a]
12− // DoTree([a, ], 0) [a1, a2]
13− // DoTree([a, a], 1) [a1, a2]
14− // DoTree([a, a1], 2) [a1]
15− // DoTree([a, a1, ], 0) [a11]
16− // DoTree([a, a1, a], 1) [a11]
17− DoSegment([][]rune, int) [][]rune
18−}
19−
20−type dumpSegmentCompleter struct {
21− f func([][]rune, int) [][]rune
22−}
23−
24−func (d *dumpSegmentCompleter) DoSegment(segment [][]rune, n int) [][]rune {
25− return d.f(segment, n)
26−}
27−
28−func SegmentFunc(f func([][]rune, int) [][]rune) AutoCompleter {
29− return &SegmentComplete{&dumpSegmentCompleter{f}}
30−}
31−
32−func SegmentAutoComplete(completer SegmentCompleter) *SegmentComplete {
33− return &SegmentComplete{
34− SegmentCompleter: completer,
35− }
36−}
37−
38−type SegmentComplete struct {
39− SegmentCompleter
40−}
41−
42−func RetSegment(segments [][]rune, cands [][]rune, idx int) ([][]rune, int) {
43− ret := make([][]rune, 0, len(cands))
44− lastSegment := segments[len(segments)-1]
45− for _, cand := range cands {
46− if !runes.HasPrefix(cand, lastSegment) {
47− continue
48− }
49− ret = append(ret, cand[len(lastSegment):])
50− }
51− return ret, idx
52−}
53−
54−func SplitSegment(line []rune, pos int) ([][]rune, int) {
55− segs := [][]rune{}
56− lastIdx := -1
57− line = line[:pos]
58− pos = 0
59− for idx, l := range line {
60− if l == ' ' {
61− pos = 0
62− segs = append(segs, line[lastIdx+1:idx])
63− lastIdx = idx
64− } else {
65− pos++
66− }
67− }
68− segs = append(segs, line[lastIdx+1:])
69− return segs, pos
70−}
71−
72−func (c *SegmentComplete) Do(line []rune, pos int) (newLine [][]rune, offset int) {
73−
74− segment, idx := SplitSegment(line, pos)
75−
76− cands := c.DoSegment(segment, idx)
77− newLine, offset = RetSegment(segment, cands, idx)
78− for idx := range newLine {
79− newLine[idx] = append(newLine[idx], ' ')
80− }
81− return newLine, offset
82−}
vendor/github.com/chzyer/readline/history.godeleted−330
@@ -1,330 +0,0 @@
1−package readline
2−
3−import (
4− "bufio"
5− "container/list"
6− "fmt"
7− "os"
8− "strings"
9− "sync"
10−)
11−
12−type hisItem struct {
13− Source []rune
14− Version int64
15− Tmp []rune
16−}
17−
18−func (h *hisItem) Clean() {
19− h.Source = nil
20− h.Tmp = nil
21−}
22−
23−type opHistory struct {
24− cfg *Config
25− history *list.List
26− historyVer int64
27− current *list.Element
28− fd *os.File
29− fdLock sync.Mutex
30− enable bool
31−}
32−
33−func newOpHistory(cfg *Config) (o *opHistory) {
34− o = &opHistory{
35− cfg: cfg,
36− history: list.New(),
37− enable: true,
38− }
39− return o
40−}
41−
42−func (o *opHistory) Reset() {
43− o.history = list.New()
44− o.current = nil
45−}
46−
47−func (o *opHistory) IsHistoryClosed() bool {
48− o.fdLock.Lock()
49− defer o.fdLock.Unlock()
50− return o.fd.Fd() == ^(uintptr(0))
51−}
52−
53−func (o *opHistory) Init() {
54− if o.IsHistoryClosed() {
55− o.initHistory()
56− }
57−}
58−
59−func (o *opHistory) initHistory() {
60− if o.cfg.HistoryFile != "" {
61− o.historyUpdatePath(o.cfg.HistoryFile)
62− }
63−}
64−
65−// only called by newOpHistory
66−func (o *opHistory) historyUpdatePath(path string) {
67− o.fdLock.Lock()
68− defer o.fdLock.Unlock()
69− f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
70− if err != nil {
71− return
72− }
73− o.fd = f
74− r := bufio.NewReader(o.fd)
75− total := 0
76− for ; ; total++ {
77− line, err := r.ReadString('\n')
78− if err != nil {
79− break
80− }
81− // ignore the empty line
82− line = strings.TrimSpace(line)
83− if len(line) == 0 {
84− continue
85− }
86− o.Push([]rune(line))
87− o.Compact()
88− }
89− if total > o.cfg.HistoryLimit {
90− o.rewriteLocked()
91− }
92− o.historyVer++
93− o.Push(nil)
94− return
95−}
96−
97−func (o *opHistory) Compact() {
98− for o.history.Len() > o.cfg.HistoryLimit && o.history.Len() > 0 {
99− o.history.Remove(o.history.Front())
100− }
101−}
102−
103−func (o *opHistory) Rewrite() {
104− o.fdLock.Lock()
105− defer o.fdLock.Unlock()
106− o.rewriteLocked()
107−}
108−
109−func (o *opHistory) rewriteLocked() {
110− if o.cfg.HistoryFile == "" {
111− return
112− }
113−
114− tmpFile := o.cfg.HistoryFile + ".tmp"
115− fd, err := os.OpenFile(tmpFile, os.O_CREATE|os.O_WRONLY|os.O_TRUNC|os.O_APPEND, 0666)
116− if err != nil {
117− return
118− }
119−
120− buf := bufio.NewWriter(fd)
121− for elem := o.history.Front(); elem != nil; elem = elem.Next() {
122− buf.WriteString(string(elem.Value.(*hisItem).Source) + "\n")
123− }
124− buf.Flush()
125−
126− // replace history file
127− if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
128− fd.Close()
129− return
130− }
131−
132− if o.fd != nil {
133− o.fd.Close()
134− }
135− // fd is write only, just satisfy what we need.
136− o.fd = fd
137−}
138−
139−func (o *opHistory) Close() {
140− o.fdLock.Lock()
141− defer o.fdLock.Unlock()
142− if o.fd != nil {
143− o.fd.Close()
144− }
145−}
146−
147−func (o *opHistory) FindBck(isNewSearch bool, rs []rune, start int) (int, *list.Element) {
148− for elem := o.current; elem != nil; elem = elem.Prev() {
149− item := o.showItem(elem.Value)
150− if isNewSearch {
151− start += len(rs)
152− }
153− if elem == o.current {
154− if len(item) >= start {
155− item = item[:start]
156− }
157− }
158− idx := runes.IndexAllBckEx(item, rs, o.cfg.HistorySearchFold)
159− if idx < 0 {
160− continue
161− }
162− return idx, elem
163− }
164− return -1, nil
165−}
166−
167−func (o *opHistory) FindFwd(isNewSearch bool, rs []rune, start int) (int, *list.Element) {
168− for elem := o.current; elem != nil; elem = elem.Next() {
169− item := o.showItem(elem.Value)
170− if isNewSearch {
171− start -= len(rs)
172− if start < 0 {
173− start = 0
174− }
175− }
176− if elem == o.current {
177− if len(item)-1 >= start {
178− item = item[start:]
179− } else {
180− continue
181− }
182− }
183− idx := runes.IndexAllEx(item, rs, o.cfg.HistorySearchFold)
184− if idx < 0 {
185− continue
186− }
187− if elem == o.current {
188− idx += start
189− }
190− return idx, elem
191− }
192− return -1, nil
193−}
194−
195−func (o *opHistory) showItem(obj interface{}) []rune {
196− item := obj.(*hisItem)
197− if item.Version == o.historyVer {
198− return item.Tmp
199− }
200− return item.Source
201−}
202−
203−func (o *opHistory) Prev() []rune {
204− if o.current == nil {
205− return nil
206− }
207− current := o.current.Prev()
208− if current == nil {
209− return nil
210− }
211− o.current = current
212− return runes.Copy(o.showItem(current.Value))
213−}
214−
215−func (o *opHistory) Next() ([]rune, bool) {
216− if o.current == nil {
217− return nil, false
218− }
219− current := o.current.Next()
220− if current == nil {
221− return nil, false
222− }
223−
224− o.current = current
225− return runes.Copy(o.showItem(current.Value)), true
226−}
227−
228−// Disable the current history
229−func (o *opHistory) Disable() {
230− o.enable = false
231−}
232−
233−// Enable the current history
234−func (o *opHistory) Enable() {
235− o.enable = true
236−}
237−
238−func (o *opHistory) debug() {
239− Debug("-------")
240− for item := o.history.Front(); item != nil; item = item.Next() {
241− Debug(fmt.Sprintf("%+v", item.Value))
242− }
243−}
244−
245−// save history
246−func (o *opHistory) New(current []rune) (err error) {
247−
248− // history deactivated
249− if !o.enable {
250− return nil
251− }
252−
253− current = runes.Copy(current)
254−
255− // if just use last command without modify
256− // just clean lastest history
257− if back := o.history.Back(); back != nil {
258− prev := back.Prev()
259− if prev != nil {
260− if runes.Equal(current, prev.Value.(*hisItem).Source) {
261− o.current = o.history.Back()
262− o.current.Value.(*hisItem).Clean()
263− o.historyVer++
264− return nil
265− }
266− }
267− }
268−
269− if len(current) == 0 {
270− o.current = o.history.Back()
271− if o.current != nil {
272− o.current.Value.(*hisItem).Clean()
273− o.historyVer++
274− return nil
275− }
276− }
277−
278− if o.current != o.history.Back() {
279− // move history item to current command
280− currentItem := o.current.Value.(*hisItem)
281− // set current to last item
282− o.current = o.history.Back()
283−
284− current = runes.Copy(currentItem.Tmp)
285− }
286−
287− // err only can be a IO error, just report
288− err = o.Update(current, true)
289−
290− // push a new one to commit current command
291− o.historyVer++
292− o.Push(nil)
293− return
294−}
295−
296−func (o *opHistory) Revert() {
297− o.historyVer++
298− o.current = o.history.Back()
299−}
300−
301−func (o *opHistory) Update(s []rune, commit bool) (err error) {
302− o.fdLock.Lock()
303− defer o.fdLock.Unlock()
304− s = runes.Copy(s)
305− if o.current == nil {
306− o.Push(s)
307− o.Compact()
308− return
309− }
310− r := o.current.Value.(*hisItem)
311− r.Version = o.historyVer
312− if commit {
313− r.Source = s
314− if o.fd != nil {
315− // just report the error
316− _, err = o.fd.Write([]byte(string(r.Source) + "\n"))
317− }
318− } else {
319− r.Tmp = append(r.Tmp[:0], s...)
320− }
321− o.current.Value = r
322− o.Compact()
323− return
324−}
325−
326−func (o *opHistory) Push(s []rune) {
327− s = runes.Copy(s)
328− elem := o.history.PushBack(&hisItem{Source: s})
329− o.current = elem
330−}
vendor/github.com/chzyer/readline/operation.godeleted−531
@@ -1,531 +0,0 @@
1−package readline
2−
3−import (
4− "errors"
5− "io"
6− "sync"
7−)
8−
9−var (
10− ErrInterrupt = errors.New("Interrupt")
11−)
12−
13−type InterruptError struct {
14− Line []rune
15−}
16−
17−func (*InterruptError) Error() string {
18− return "Interrupted"
19−}
20−
21−type Operation struct {
22− m sync.Mutex
23− cfg *Config
24− t *Terminal
25− buf *RuneBuffer
26− outchan chan []rune
27− errchan chan error
28− w io.Writer
29−
30− history *opHistory
31− *opSearch
32− *opCompleter
33− *opPassword
34− *opVim
35−}
36−
37−func (o *Operation) SetBuffer(what string) {
38− o.buf.Set([]rune(what))
39−}
40−
41−type wrapWriter struct {
42− r *Operation
43− t *Terminal
44− target io.Writer
45−}
46−
47−func (w *wrapWriter) Write(b []byte) (int, error) {
48− if !w.t.IsReading() {
49− return w.target.Write(b)
50− }
51−
52− var (
53− n int
54− err error
55− )
56− w.r.buf.Refresh(func() {
57− n, err = w.target.Write(b)
58− })
59−
60− if w.r.IsSearchMode() {
61− w.r.SearchRefresh(-1)
62− }
63− if w.r.IsInCompleteMode() {
64− w.r.CompleteRefresh()
65− }
66− return n, err
67−}
68−
69−func NewOperation(t *Terminal, cfg *Config) *Operation {
70− width := cfg.FuncGetWidth()
71− op := &Operation{
72− t: t,
73− buf: NewRuneBuffer(t, cfg.Prompt, cfg, width),
74− outchan: make(chan []rune),
75− errchan: make(chan error, 1),
76− }
77− op.w = op.buf.w
78− op.SetConfig(cfg)
79− op.opVim = newVimMode(op)
80− op.opCompleter = newOpCompleter(op.buf.w, op, width)
81− op.opPassword = newOpPassword(op)
82− op.cfg.FuncOnWidthChanged(func() {
83− newWidth := cfg.FuncGetWidth()
84− op.opCompleter.OnWidthChange(newWidth)
85− op.opSearch.OnWidthChange(newWidth)
86− op.buf.OnWidthChange(newWidth)
87− })
88− go op.ioloop()
89− return op
90−}
91−
92−func (o *Operation) SetPrompt(s string) {
93− o.buf.SetPrompt(s)
94−}
95−
96−func (o *Operation) SetMaskRune(r rune) {
97− o.buf.SetMask(r)
98−}
99−
100−func (o *Operation) GetConfig() *Config {
101− o.m.Lock()
102− cfg := *o.cfg
103− o.m.Unlock()
104− return &cfg
105−}
106−
107−func (o *Operation) ioloop() {
108− for {
109− keepInSearchMode := false
110− keepInCompleteMode := false
111− r := o.t.ReadRune()
112− if o.GetConfig().FuncFilterInputRune != nil {
113− var process bool
114− r, process = o.GetConfig().FuncFilterInputRune(r)
115− if !process {
116− o.buf.Refresh(nil) // to refresh the line
117− continue // ignore this rune
118− }
119− }
120−
121− if r == 0 { // io.EOF
122− if o.buf.Len() == 0 {
123− o.buf.Clean()
124− select {
125− case o.errchan <- io.EOF:
126− }
127− break
128− } else {
129− // if stdin got io.EOF and there is something left in buffer,
130− // let's flush them by sending CharEnter.
131− // And we will got io.EOF int next loop.
132− r = CharEnter
133− }
134− }
135− isUpdateHistory := true
136−
137− if o.IsInCompleteSelectMode() {
138− keepInCompleteMode = o.HandleCompleteSelect(r)
139− if keepInCompleteMode {
140− continue
141− }
142−
143− o.buf.Refresh(nil)
144− switch r {
145− case CharEnter, CharCtrlJ:
146− o.history.Update(o.buf.Runes(), false)
147− fallthrough
148− case CharInterrupt:
149− o.t.KickRead()
150− fallthrough
151− case CharBell:
152− continue
153− }
154− }
155−
156− if o.IsEnableVimMode() {
157− r = o.HandleVim(r, o.t.ReadRune)
158− if r == 0 {
159− continue
160− }
161− }
162−
163− switch r {
164− case CharBell:
165− if o.IsSearchMode() {
166− o.ExitSearchMode(true)
167− o.buf.Refresh(nil)
168− }
169− if o.IsInCompleteMode() {
170− o.ExitCompleteMode(true)
171− o.buf.Refresh(nil)
172− }
173− case CharTab:
174− if o.GetConfig().AutoComplete == nil {
175− o.t.Bell()
176− break
177− }
178− if o.OnComplete() {
179− keepInCompleteMode = true
180− } else {
181− o.t.Bell()
182− break
183− }
184−
185− case CharBckSearch:
186− if !o.SearchMode(S_DIR_BCK) {
187− o.t.Bell()
188− break
189− }
190− keepInSearchMode = true
191− case CharCtrlU:
192− o.buf.KillFront()
193− case CharFwdSearch:
194− if !o.SearchMode(S_DIR_FWD) {
195− o.t.Bell()
196− break
197− }
198− keepInSearchMode = true
199− case CharKill:
200− o.buf.Kill()
201− keepInCompleteMode = true
202− case MetaForward:
203− o.buf.MoveToNextWord()
204− case CharTranspose:
205− o.buf.Transpose()
206− case MetaBackward:
207− o.buf.MoveToPrevWord()
208− case MetaDelete:
209− o.buf.DeleteWord()
210− case CharLineStart:
211− o.buf.MoveToLineStart()
212− case CharLineEnd:
213− o.buf.MoveToLineEnd()
214− case CharBackspace, CharCtrlH:
215− if o.IsSearchMode() {
216− o.SearchBackspace()
217− keepInSearchMode = true
218− break
219− }
220−
221− if o.buf.Len() == 0 {
222− o.t.Bell()
223− break
224− }
225− o.buf.Backspace()
226− if o.IsInCompleteMode() {
227− o.OnComplete()
228− }
229− case CharCtrlZ:
230− o.buf.Clean()
231− o.t.SleepToResume()
232− o.Refresh()
233− case CharCtrlL:
234− ClearScreen(o.w)
235− o.Refresh()
236− case MetaBackspace, CharCtrlW:
237− o.buf.BackEscapeWord()
238− case CharCtrlY:
239− o.buf.Yank()
240− case CharEnter, CharCtrlJ:
241− if o.IsSearchMode() {
242− o.ExitSearchMode(false)
243− }
244− o.buf.MoveToLineEnd()
245− var data []rune
246− if !o.GetConfig().UniqueEditLine {
247− o.buf.WriteRune('\n')
248− data = o.buf.Reset()
249− data = data[:len(data)-1] // trim \n
250− } else {
251− o.buf.Clean()
252− data = o.buf.Reset()
253− }
254− o.outchan <- data
255− if !o.GetConfig().DisableAutoSaveHistory {
256− // ignore IO error
257− _ = o.history.New(data)
258− } else {
259− isUpdateHistory = false
260− }
261− case CharBackward:
262− o.buf.MoveBackward()
263− case CharForward:
264− o.buf.MoveForward()
265− case CharPrev:
266− buf := o.history.Prev()
267− if buf != nil {
268− o.buf.Set(buf)
269− } else {
270− o.t.Bell()
271− }
272− case CharNext:
273− buf, ok := o.history.Next()
274− if ok {
275− o.buf.Set(buf)
276− } else {
277− o.t.Bell()
278− }
279− case CharDelete:
280− if o.buf.Len() > 0 || !o.IsNormalMode() {
281− o.t.KickRead()
282− if !o.buf.Delete() {
283− o.t.Bell()
284− }
285− break
286− }
287−
288− // treat as EOF
289− if !o.GetConfig().UniqueEditLine {
290− o.buf.WriteString(o.GetConfig().EOFPrompt + "\n")
291− }
292− o.buf.Reset()
293− isUpdateHistory = false
294− o.history.Revert()
295− o.errchan <- io.EOF
296− if o.GetConfig().UniqueEditLine {
297− o.buf.Clean()
298− }
299− case CharInterrupt:
300− if o.IsSearchMode() {
301− o.t.KickRead()
302− o.ExitSearchMode(true)
303− break
304− }
305− if o.IsInCompleteMode() {
306− o.t.KickRead()
307− o.ExitCompleteMode(true)
308− o.buf.Refresh(nil)
309− break
310− }
311− o.buf.MoveToLineEnd()
312− o.buf.Refresh(nil)
313− hint := o.GetConfig().InterruptPrompt + "\n"
314− if !o.GetConfig().UniqueEditLine {
315− o.buf.WriteString(hint)
316− }
317− remain := o.buf.Reset()
318− if !o.GetConfig().UniqueEditLine {
319− remain = remain[:len(remain)-len([]rune(hint))]
320− }
321− isUpdateHistory = false
322− o.history.Revert()
323− o.errchan <- &InterruptError{remain}
324− default:
325− if o.IsSearchMode() {
326− o.SearchChar(r)
327− keepInSearchMode = true
328− break
329− }
330− o.buf.WriteRune(r)
331− if o.IsInCompleteMode() {
332− o.OnComplete()
333− keepInCompleteMode = true
334− }
335− }
336−
337− listener := o.GetConfig().Listener
338− if listener != nil {
339− newLine, newPos, ok := listener.OnChange(o.buf.Runes(), o.buf.Pos(), r)
340− if ok {
341− o.buf.SetWithIdx(newPos, newLine)
342− }
343− }
344−
345− o.m.Lock()
346− if !keepInSearchMode && o.IsSearchMode() {
347− o.ExitSearchMode(false)
348− o.buf.Refresh(nil)
349− } else if o.IsInCompleteMode() {
350− if !keepInCompleteMode {
351− o.ExitCompleteMode(false)
352− o.Refresh()
353− } else {
354− o.buf.Refresh(nil)
355− o.CompleteRefresh()
356− }
357− }
358− if isUpdateHistory && !o.IsSearchMode() {
359− // it will cause null history
360− o.history.Update(o.buf.Runes(), false)
361− }
362− o.m.Unlock()
363− }
364−}
365−
366−func (o *Operation) Stderr() io.Writer {
367− return &wrapWriter{target: o.GetConfig().Stderr, r: o, t: o.t}
368−}
369−
370−func (o *Operation) Stdout() io.Writer {
371− return &wrapWriter{target: o.GetConfig().Stdout, r: o, t: o.t}
372−}
373−
374−func (o *Operation) String() (string, error) {
375− r, err := o.Runes()
376− return string(r), err
377−}
378−
379−func (o *Operation) Runes() ([]rune, error) {
380− o.t.EnterRawMode()
381− defer o.t.ExitRawMode()
382−
383− listener := o.GetConfig().Listener
384− if listener != nil {
385− listener.OnChange(nil, 0, 0)
386− }
387−
388− o.buf.Refresh(nil) // print prompt
389− o.t.KickRead()
390− select {
391− case r := <-o.outchan:
392− return r, nil
393− case err := <-o.errchan:
394− if e, ok := err.(*InterruptError); ok {
395− return e.Line, ErrInterrupt
396− }
397− return nil, err
398− }
399−}
400−
401−func (o *Operation) PasswordEx(prompt string, l Listener) ([]byte, error) {
402− cfg := o.GenPasswordConfig()
403− cfg.Prompt = prompt
404− cfg.Listener = l
405− return o.PasswordWithConfig(cfg)
406−}
407−
408−func (o *Operation) GenPasswordConfig() *Config {
409− return o.opPassword.PasswordConfig()
410−}
411−
412−func (o *Operation) PasswordWithConfig(cfg *Config) ([]byte, error) {
413− if err := o.opPassword.EnterPasswordMode(cfg); err != nil {
414− return nil, err
415− }
416− defer o.opPassword.ExitPasswordMode()
417− return o.Slice()
418−}
419−
420−func (o *Operation) Password(prompt string) ([]byte, error) {
421− return o.PasswordEx(prompt, nil)
422−}
423−
424−func (o *Operation) SetTitle(t string) {
425− o.w.Write([]byte("\033[2;" + t + "\007"))
426−}
427−
428−func (o *Operation) Slice() ([]byte, error) {
429− r, err := o.Runes()
430− if err != nil {
431− return nil, err
432− }
433− return []byte(string(r)), nil
434−}
435−
436−func (o *Operation) Close() {
437− o.history.Close()
438−}
439−
440−func (o *Operation) SetHistoryPath(path string) {
441− if o.history != nil {
442− o.history.Close()
443− }
444− o.cfg.HistoryFile = path
445− o.history = newOpHistory(o.cfg)
446−}
447−
448−func (o *Operation) IsNormalMode() bool {
449− return !o.IsInCompleteMode() && !o.IsSearchMode()
450−}
451−
452−func (op *Operation) SetConfig(cfg *Config) (*Config, error) {
453− op.m.Lock()
454− defer op.m.Unlock()
455− if op.cfg == cfg {
456− return op.cfg, nil
457− }
458− if err := cfg.Init(); err != nil {
459− return op.cfg, err
460− }
461− old := op.cfg
462− op.cfg = cfg
463− op.SetPrompt(cfg.Prompt)
464− op.SetMaskRune(cfg.MaskRune)
465− op.buf.SetConfig(cfg)
466− width := op.cfg.FuncGetWidth()
467−
468− if cfg.opHistory == nil {
469− op.SetHistoryPath(cfg.HistoryFile)
470− cfg.opHistory = op.history
471− cfg.opSearch = newOpSearch(op.buf.w, op.buf, op.history, cfg, width)
472− }
473− op.history = cfg.opHistory
474−
475− // SetHistoryPath will close opHistory which already exists
476− // so if we use it next time, we need to reopen it by `InitHistory()`
477− op.history.Init()
478−
479− if op.cfg.AutoComplete != nil {
480− op.opCompleter = newOpCompleter(op.buf.w, op, width)
481− }
482−
483− op.opSearch = cfg.opSearch
484− return old, nil
485−}
486−
487−func (o *Operation) ResetHistory() {
488− o.history.Reset()
489−}
490−
491−// if err is not nil, it just mean it fail to write to file
492−// other things goes fine.
493−func (o *Operation) SaveHistory(content string) error {
494− return o.history.New([]rune(content))
495−}
496−
497−func (o *Operation) Refresh() {
498− if o.t.IsReading() {
499− o.buf.Refresh(nil)
500− }
501−}
502−
503−func (o *Operation) Clean() {
504− o.buf.Clean()
505−}
506−
507−func FuncListener(f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)) Listener {
508− return &DumpListener{f: f}
509−}
510−
511−type DumpListener struct {
512− f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
513−}
514−
515−func (d *DumpListener) OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool) {
516− return d.f(line, pos, key)
517−}
518−
519−type Listener interface {
520− OnChange(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)
521−}
522−
523−type Painter interface {
524− Paint(line []rune, pos int) []rune
525−}
526−
527−type defaultPainter struct{}
528−
529−func (p *defaultPainter) Paint(line []rune, _ int) []rune {
530− return line
531−}
vendor/github.com/chzyer/readline/password.godeleted−33
@@ -1,33 +0,0 @@
1−package readline
2−
3−type opPassword struct {
4− o *Operation
5− backupCfg *Config
6−}
7−
8−func newOpPassword(o *Operation) *opPassword {
9− return &opPassword{o: o}
10−}
11−
12−func (o *opPassword) ExitPasswordMode() {
13− o.o.SetConfig(o.backupCfg)
14− o.backupCfg = nil
15−}
16−
17−func (o *opPassword) EnterPasswordMode(cfg *Config) (err error) {
18− o.backupCfg, err = o.o.SetConfig(cfg)
19− return
20−}
21−
22−func (o *opPassword) PasswordConfig() *Config {
23− return &Config{
24− EnableMask: true,
25− InterruptPrompt: "\n",
26− EOFPrompt: "\n",
27− HistoryLimit: -1,
28− Painter: &defaultPainter{},
29−
30− Stdout: o.o.cfg.Stdout,
31− Stderr: o.o.cfg.Stderr,
32− }
33−}
vendor/github.com/chzyer/readline/rawreader_windows.godeleted−125
@@ -1,125 +0,0 @@
1−// +build windows
2−
3−package readline
4−
5−import "unsafe"
6−
7−const (
8− VK_CANCEL = 0x03
9− VK_BACK = 0x08
10− VK_TAB = 0x09
11− VK_RETURN = 0x0D
12− VK_SHIFT = 0x10
13− VK_CONTROL = 0x11
14− VK_MENU = 0x12
15− VK_ESCAPE = 0x1B
16− VK_LEFT = 0x25
17− VK_UP = 0x26
18− VK_RIGHT = 0x27
19− VK_DOWN = 0x28
20− VK_DELETE = 0x2E
21− VK_LSHIFT = 0xA0
22− VK_RSHIFT = 0xA1
23− VK_LCONTROL = 0xA2
24− VK_RCONTROL = 0xA3
25−)
26−
27−// RawReader translate input record to ANSI escape sequence.
28−// To provides same behavior as unix terminal.
29−type RawReader struct {
30− ctrlKey bool
31− altKey bool
32−}
33−
34−func NewRawReader() *RawReader {
35− r := new(RawReader)
36− return r
37−}
38−
39−// only process one action in one read
40−func (r *RawReader) Read(buf []byte) (int, error) {
41− ir := new(_INPUT_RECORD)
42− var read int
43− var err error
44−next:
45− err = kernel.ReadConsoleInputW(stdin,
46− uintptr(unsafe.Pointer(ir)),
47− 1,
48− uintptr(unsafe.Pointer(&read)),
49− )
50− if err != nil {
51− return 0, err
52− }
53− if ir.EventType != EVENT_KEY {
54− goto next
55− }
56− ker := (*_KEY_EVENT_RECORD)(unsafe.Pointer(&ir.Event[0]))
57− if ker.bKeyDown == 0 { // keyup
58− if r.ctrlKey || r.altKey {
59− switch ker.wVirtualKeyCode {
60− case VK_RCONTROL, VK_LCONTROL:
61− r.ctrlKey = false
62− case VK_MENU: //alt
63− r.altKey = false
64− }
65− }
66− goto next
67− }
68−
69− if ker.unicodeChar == 0 {
70− var target rune
71− switch ker.wVirtualKeyCode {
72− case VK_RCONTROL, VK_LCONTROL:
73− r.ctrlKey = true
74− case VK_MENU: //alt
75− r.altKey = true
76− case VK_LEFT:
77− target = CharBackward
78− case VK_RIGHT:
79− target = CharForward
80− case VK_UP:
81− target = CharPrev
82− case VK_DOWN:
83− target = CharNext
84− }
85− if target != 0 {
86− return r.write(buf, target)
87− }
88− goto next
89− }
90− char := rune(ker.unicodeChar)
91− if r.ctrlKey {
92− switch char {
93− case 'A':
94− char = CharLineStart
95− case 'E':
96− char = CharLineEnd
97− case 'R':
98− char = CharBckSearch
99− case 'S':
100− char = CharFwdSearch
101− }
102− } else if r.altKey {
103− switch char {
104− case VK_BACK:
105− char = CharBackspace
106− }
107− return r.writeEsc(buf, char)
108− }
109− return r.write(buf, char)
110−}
111−
112−func (r *RawReader) writeEsc(b []byte, char rune) (int, error) {
113− b[0] = '\033'
114− n := copy(b[1:], []byte(string(char)))
115− return n + 1, nil
116−}
117−
118−func (r *RawReader) write(b []byte, char rune) (int, error) {
119− n := copy(b, []byte(string(char)))
120− return n, nil
121−}
122−
123−func (r *RawReader) Close() error {
124− return nil
125−}
vendor/github.com/chzyer/readline/readline.godeleted−326
@@ -1,326 +0,0 @@
1−// Readline is a pure go implementation for GNU-Readline kind library.
2−//
3−// example:
4−// rl, err := readline.New("> ")
5−// if err != nil {
6−// panic(err)
7−// }
8−// defer rl.Close()
9−//
10−// for {
11−// line, err := rl.Readline()
12−// if err != nil { // io.EOF
13−// break
14−// }
15−// println(line)
16−// }
17−//
18−package readline
19−
20−import "io"
21−
22−type Instance struct {
23− Config *Config
24− Terminal *Terminal
25− Operation *Operation
26−}
27−
28−type Config struct {
29− // prompt supports ANSI escape sequence, so we can color some characters even in windows
30− Prompt string
31−
32− // readline will persist historys to file where HistoryFile specified
33− HistoryFile string
34− // specify the max length of historys, it's 500 by default, set it to -1 to disable history
35− HistoryLimit int
36− DisableAutoSaveHistory bool
37− // enable case-insensitive history searching
38− HistorySearchFold bool
39−
40− // AutoCompleter will called once user press TAB
41− AutoComplete AutoCompleter
42−
43− // Any key press will pass to Listener
44− // NOTE: Listener will be triggered by (nil, 0, 0) immediately
45− Listener Listener
46−
47− Painter Painter
48−
49− // If VimMode is true, readline will in vim.insert mode by default
50− VimMode bool
51−
52− InterruptPrompt string
53− EOFPrompt string
54−
55− FuncGetWidth func() int
56−
57− Stdin io.ReadCloser
58− StdinWriter io.Writer
59− Stdout io.Writer
60− Stderr io.Writer
61−
62− EnableMask bool
63− MaskRune rune
64−
65− // erase the editing line after user submited it
66− // it use in IM usually.
67− UniqueEditLine bool
68−
69− // filter input runes (may be used to disable CtrlZ or for translating some keys to different actions)
70− // -> output = new (translated) rune and true/false if continue with processing this one
71− FuncFilterInputRune func(rune) (rune, bool)
72−
73− // force use interactive even stdout is not a tty
74− FuncIsTerminal func() bool
75− FuncMakeRaw func() error
76− FuncExitRaw func() error
77− FuncOnWidthChanged func(func())
78− ForceUseInteractive bool
79−
80− // private fields
81− inited bool
82− opHistory *opHistory
83− opSearch *opSearch
84−}
85−
86−func (c *Config) useInteractive() bool {
87− if c.ForceUseInteractive {
88− return true
89− }
90− return c.FuncIsTerminal()
91−}
92−
93−func (c *Config) Init() error {
94− if c.inited {
95− return nil
96− }
97− c.inited = true
98− if c.Stdin == nil {
99− c.Stdin = NewCancelableStdin(Stdin)
100− }
101−
102− c.Stdin, c.StdinWriter = NewFillableStdin(c.Stdin)
103−
104− if c.Stdout == nil {
105− c.Stdout = Stdout
106− }
107− if c.Stderr == nil {
108− c.Stderr = Stderr
109− }
110− if c.HistoryLimit == 0 {
111− c.HistoryLimit = 500
112− }
113−
114− if c.InterruptPrompt == "" {
115− c.InterruptPrompt = "^C"
116− } else if c.InterruptPrompt == "\n" {
117− c.InterruptPrompt = ""
118− }
119− if c.EOFPrompt == "" {
120− c.EOFPrompt = "^D"
121− } else if c.EOFPrompt == "\n" {
122− c.EOFPrompt = ""
123− }
124−
125− if c.AutoComplete == nil {
126− c.AutoComplete = &TabCompleter{}
127− }
128− if c.FuncGetWidth == nil {
129− c.FuncGetWidth = GetScreenWidth
130− }
131− if c.FuncIsTerminal == nil {
132− c.FuncIsTerminal = DefaultIsTerminal
133− }
134− rm := new(RawMode)
135− if c.FuncMakeRaw == nil {
136− c.FuncMakeRaw = rm.Enter
137− }
138− if c.FuncExitRaw == nil {
139− c.FuncExitRaw = rm.Exit
140− }
141− if c.FuncOnWidthChanged == nil {
142− c.FuncOnWidthChanged = DefaultOnWidthChanged
143− }
144−
145− return nil
146−}
147−
148−func (c Config) Clone() *Config {
149− c.opHistory = nil
150− c.opSearch = nil
151− return &c
152−}
153−
154−func (c *Config) SetListener(f func(line []rune, pos int, key rune) (newLine []rune, newPos int, ok bool)) {
155− c.Listener = FuncListener(f)
156−}
157−
158−func (c *Config) SetPainter(p Painter) {
159− c.Painter = p
160−}
161−
162−func NewEx(cfg *Config) (*Instance, error) {
163− t, err := NewTerminal(cfg)
164− if err != nil {
165− return nil, err
166− }
167− rl := t.Readline()
168− if cfg.Painter == nil {
169− cfg.Painter = &defaultPainter{}
170− }
171− return &Instance{
172− Config: cfg,
173− Terminal: t,
174− Operation: rl,
175− }, nil
176−}
177−
178−func New(prompt string) (*Instance, error) {
179− return NewEx(&Config{Prompt: prompt})
180−}
181−
182−func (i *Instance) ResetHistory() {
183− i.Operation.ResetHistory()
184−}
185−
186−func (i *Instance) SetPrompt(s string) {
187− i.Operation.SetPrompt(s)
188−}
189−
190−func (i *Instance) SetMaskRune(r rune) {
191− i.Operation.SetMaskRune(r)
192−}
193−
194−// change history persistence in runtime
195−func (i *Instance) SetHistoryPath(p string) {
196− i.Operation.SetHistoryPath(p)
197−}
198−
199−// readline will refresh automatic when write through Stdout()
200−func (i *Instance) Stdout() io.Writer {
201− return i.Operation.Stdout()
202−}
203−
204−// readline will refresh automatic when write through Stdout()
205−func (i *Instance) Stderr() io.Writer {
206− return i.Operation.Stderr()
207−}
208−
209−// switch VimMode in runtime
210−func (i *Instance) SetVimMode(on bool) {
211− i.Operation.SetVimMode(on)
212−}
213−
214−func (i *Instance) IsVimMode() bool {
215− return i.Operation.IsEnableVimMode()
216−}
217−
218−func (i *Instance) GenPasswordConfig() *Config {
219− return i.Operation.GenPasswordConfig()
220−}
221−
222−// we can generate a config by `i.GenPasswordConfig()`
223−func (i *Instance) ReadPasswordWithConfig(cfg *Config) ([]byte, error) {
224− return i.Operation.PasswordWithConfig(cfg)
225−}
226−
227−func (i *Instance) ReadPasswordEx(prompt string, l Listener) ([]byte, error) {
228− return i.Operation.PasswordEx(prompt, l)
229−}
230−
231−func (i *Instance) ReadPassword(prompt string) ([]byte, error) {
232− return i.Operation.Password(prompt)
233−}
234−
235−type Result struct {
236− Line string
237− Error error
238−}
239−
240−func (l *Result) CanContinue() bool {
241− return len(l.Line) != 0 && l.Error == ErrInterrupt
242−}
243−
244−func (l *Result) CanBreak() bool {
245− return !l.CanContinue() && l.Error != nil
246−}
247−
248−func (i *Instance) Line() *Result {
249− ret, err := i.Readline()
250− return &Result{ret, err}
251−}
252−
253−// err is one of (nil, io.EOF, readline.ErrInterrupt)
254−func (i *Instance) Readline() (string, error) {
255− return i.Operation.String()
256−}
257−
258−func (i *Instance) ReadlineWithDefault(what string) (string, error) {
259− i.Operation.SetBuffer(what)
260− return i.Operation.String()
261−}
262−
263−func (i *Instance) SaveHistory(content string) error {
264− return i.Operation.SaveHistory(content)
265−}
266−
267−// same as readline
268−func (i *Instance) ReadSlice() ([]byte, error) {
269− return i.Operation.Slice()
270−}
271−
272−// we must make sure that call Close() before process exit.
273−func (i *Instance) Close() error {
274− if err := i.Terminal.Close(); err != nil {
275− return err
276− }
277− i.Config.Stdin.Close()
278− i.Operation.Close()
279− return nil
280−}
281−func (i *Instance) Clean() {
282− i.Operation.Clean()
283−}
284−
285−func (i *Instance) Write(b []byte) (int, error) {
286− return i.Stdout().Write(b)
287−}
288−
289−// WriteStdin prefill the next Stdin fetch
290−// Next time you call ReadLine() this value will be writen before the user input
291−// ie :
292−// i := readline.New()
293−// i.WriteStdin([]byte("test"))
294−// _, _= i.Readline()
295−//
296−// gives
297−//
298−// > test[cursor]
299−func (i *Instance) WriteStdin(val []byte) (int, error) {
300− return i.Terminal.WriteStdin(val)
301−}
302−
303−func (i *Instance) SetConfig(cfg *Config) *Config {
304− if i.Config == cfg {
305− return cfg
306− }
307− old := i.Config
308− i.Config = cfg
309− i.Operation.SetConfig(cfg)
310− i.Terminal.SetConfig(cfg)
311− return old
312−}
313−
314−func (i *Instance) Refresh() {
315− i.Operation.Refresh()
316−}
317−
318−// HistoryDisable the save of the commands into the history
319−func (i *Instance) HistoryDisable() {
320− i.Operation.history.Disable()
321−}
322−
323−// HistoryEnable the save of the commands into the history (default on)
324−func (i *Instance) HistoryEnable() {
325− i.Operation.history.Enable()
326−}
vendor/github.com/chzyer/readline/remote.godeleted−475
@@ -1,475 +0,0 @@
1−package readline
2−
3−import (
4− "bufio"
5− "bytes"
6− "encoding/binary"
7− "fmt"
8− "io"
9− "net"
10− "os"
11− "sync"
12− "sync/atomic"
13−)
14−
15−type MsgType int16
16−
17−const (
18− T_DATA = MsgType(iota)
19− T_WIDTH
20− T_WIDTH_REPORT
21− T_ISTTY_REPORT
22− T_RAW
23− T_ERAW // exit raw
24− T_EOF
25−)
26−
27−type RemoteSvr struct {
28− eof int32
29− closed int32
30− width int32
31− reciveChan chan struct{}
32− writeChan chan *writeCtx
33− conn net.Conn
34− isTerminal bool
35− funcWidthChan func()
36− stopChan chan struct{}
37−
38− dataBufM sync.Mutex
39− dataBuf bytes.Buffer
40−}
41−
42−type writeReply struct {
43− n int
44− err error
45−}
46−
47−type writeCtx struct {
48− msg *Message
49− reply chan *writeReply
50−}
51−
52−func newWriteCtx(msg *Message) *writeCtx {
53− return &writeCtx{
54− msg: msg,
55− reply: make(chan *writeReply),
56− }
57−}
58−
59−func NewRemoteSvr(conn net.Conn) (*RemoteSvr, error) {
60− rs := &RemoteSvr{
61− width: -1,
62− conn: conn,
63− writeChan: make(chan *writeCtx),
64− reciveChan: make(chan struct{}),
65− stopChan: make(chan struct{}),
66− }
67− buf := bufio.NewReader(rs.conn)
68−
69− if err := rs.init(buf); err != nil {
70− return nil, err
71− }
72−
73− go rs.readLoop(buf)
74− go rs.writeLoop()
75− return rs, nil
76−}
77−
78−func (r *RemoteSvr) init(buf *bufio.Reader) error {
79− m, err := ReadMessage(buf)
80− if err != nil {
81− return err
82− }
83− // receive isTerminal
84− if m.Type != T_ISTTY_REPORT {
85− return fmt.Errorf("unexpected init message")
86− }
87− r.GotIsTerminal(m.Data)
88−
89− // receive width
90− m, err = ReadMessage(buf)
91− if err != nil {
92− return err
93− }
94− if m.Type != T_WIDTH_REPORT {
95− return fmt.Errorf("unexpected init message")
96− }
97− r.GotReportWidth(m.Data)
98−
99− return nil
100−}
101−
102−func (r *RemoteSvr) HandleConfig(cfg *Config) {
103− cfg.Stderr = r
104− cfg.Stdout = r
105− cfg.Stdin = r
106− cfg.FuncExitRaw = r.ExitRawMode
107− cfg.FuncIsTerminal = r.IsTerminal
108− cfg.FuncMakeRaw = r.EnterRawMode
109− cfg.FuncExitRaw = r.ExitRawMode
110− cfg.FuncGetWidth = r.GetWidth
111− cfg.FuncOnWidthChanged = func(f func()) {
112− r.funcWidthChan = f
113− }
114−}
115−
116−func (r *RemoteSvr) IsTerminal() bool {
117− return r.isTerminal
118−}
119−
120−func (r *RemoteSvr) checkEOF() error {
121− if atomic.LoadInt32(&r.eof) == 1 {
122− return io.EOF
123− }
124− return nil
125−}
126−
127−func (r *RemoteSvr) Read(b []byte) (int, error) {
128− r.dataBufM.Lock()
129− n, err := r.dataBuf.Read(b)
130− r.dataBufM.Unlock()
131− if n == 0 {
132− if err := r.checkEOF(); err != nil {
133− return 0, err
134− }
135− }
136−
137− if n == 0 && err == io.EOF {
138− <-r.reciveChan
139− r.dataBufM.Lock()
140− n, err = r.dataBuf.Read(b)
141− r.dataBufM.Unlock()
142− }
143− if n == 0 {
144− if err := r.checkEOF(); err != nil {
145− return 0, err
146− }
147− }
148−
149− return n, err
150−}
151−
152−func (r *RemoteSvr) writeMsg(m *Message) error {
153− ctx := newWriteCtx(m)
154− r.writeChan <- ctx
155− reply := <-ctx.reply
156− return reply.err
157−}
158−
159−func (r *RemoteSvr) Write(b []byte) (int, error) {
160− ctx := newWriteCtx(NewMessage(T_DATA, b))
161− r.writeChan <- ctx
162− reply := <-ctx.reply
163− return reply.n, reply.err
164−}
165−
166−func (r *RemoteSvr) EnterRawMode() error {
167− return r.writeMsg(NewMessage(T_RAW, nil))
168−}
169−
170−func (r *RemoteSvr) ExitRawMode() error {
171− return r.writeMsg(NewMessage(T_ERAW, nil))
172−}
173−
174−func (r *RemoteSvr) writeLoop() {
175− defer r.Close()
176−
177−loop:
178− for {
179− select {
180− case ctx, ok := <-r.writeChan:
181− if !ok {
182− break
183− }
184− n, err := ctx.msg.WriteTo(r.conn)
185− ctx.reply <- &writeReply{n, err}
186− case <-r.stopChan:
187− break loop
188− }
189− }
190−}
191−
192−func (r *RemoteSvr) Close() error {
193− if atomic.CompareAndSwapInt32(&r.closed, 0, 1) {
194− close(r.stopChan)
195− r.conn.Close()
196− }
197− return nil
198−}
199−
200−func (r *RemoteSvr) readLoop(buf *bufio.Reader) {
201− defer r.Close()
202− for {
203− m, err := ReadMessage(buf)
204− if err != nil {
205− break
206− }
207− switch m.Type {
208− case T_EOF:
209− atomic.StoreInt32(&r.eof, 1)
210− select {
211− case r.reciveChan <- struct{}{}:
212− default:
213− }
214− case T_DATA:
215− r.dataBufM.Lock()
216− r.dataBuf.Write(m.Data)
217− r.dataBufM.Unlock()
218− select {
219− case r.reciveChan <- struct{}{}:
220− default:
221− }
222− case T_WIDTH_REPORT:
223− r.GotReportWidth(m.Data)
224− case T_ISTTY_REPORT:
225− r.GotIsTerminal(m.Data)
226− }
227− }
228−}
229−
230−func (r *RemoteSvr) GotIsTerminal(data []byte) {
231− if binary.BigEndian.Uint16(data) == 0 {
232− r.isTerminal = false
233− } else {
234− r.isTerminal = true
235− }
236−}
237−
238−func (r *RemoteSvr) GotReportWidth(data []byte) {
239− atomic.StoreInt32(&r.width, int32(binary.BigEndian.Uint16(data)))
240− if r.funcWidthChan != nil {
241− r.funcWidthChan()
242− }
243−}
244−
245−func (r *RemoteSvr) GetWidth() int {
246− return int(atomic.LoadInt32(&r.width))
247−}
248−
249−// -----------------------------------------------------------------------------
250−
251−type Message struct {
252− Type MsgType
253− Data []byte
254−}
255−
256−func ReadMessage(r io.Reader) (*Message, error) {
257− m := new(Message)
258− var length int32
259− if err := binary.Read(r, binary.BigEndian, &length); err != nil {
260− return nil, err
261− }
262− if err := binary.Read(r, binary.BigEndian, &m.Type); err != nil {
263− return nil, err
264− }
265− m.Data = make([]byte, int(length)-2)
266− if _, err := io.ReadFull(r, m.Data); err != nil {
267− return nil, err
268− }
269− return m, nil
270−}
271−
272−func NewMessage(t MsgType, data []byte) *Message {
273− return &Message{t, data}
274−}
275−
276−func (m *Message) WriteTo(w io.Writer) (int, error) {
277− buf := bytes.NewBuffer(make([]byte, 0, len(m.Data)+2+4))
278− binary.Write(buf, binary.BigEndian, int32(len(m.Data)+2))
279− binary.Write(buf, binary.BigEndian, m.Type)
280− buf.Write(m.Data)
281− n, err := buf.WriteTo(w)
282− return int(n), err
283−}
284−
285−// -----------------------------------------------------------------------------
286−
287−type RemoteCli struct {
288− conn net.Conn
289− raw RawMode
290− receiveChan chan struct{}
291− inited int32
292− isTerminal *bool
293−
294− data bytes.Buffer
295− dataM sync.Mutex
296−}
297−
298−func NewRemoteCli(conn net.Conn) (*RemoteCli, error) {
299− r := &RemoteCli{
300− conn: conn,
301− receiveChan: make(chan struct{}),
302− }
303− return r, nil
304−}
305−
306−func (r *RemoteCli) MarkIsTerminal(is bool) {
307− r.isTerminal = &is
308−}
309−
310−func (r *RemoteCli) init() error {
311− if !atomic.CompareAndSwapInt32(&r.inited, 0, 1) {
312− return nil
313− }
314−
315− if err := r.reportIsTerminal(); err != nil {
316− return err
317− }
318−
319− if err := r.reportWidth(); err != nil {
320− return err
321− }
322−
323− // register sig for width changed
324− DefaultOnWidthChanged(func() {
325− r.reportWidth()
326− })
327− return nil
328−}
329−
330−func (r *RemoteCli) writeMsg(m *Message) error {
331− r.dataM.Lock()
332− _, err := m.WriteTo(r.conn)
333− r.dataM.Unlock()
334− return err
335−}
336−
337−func (r *RemoteCli) Write(b []byte) (int, error) {
338− m := NewMessage(T_DATA, b)
339− r.dataM.Lock()
340− _, err := m.WriteTo(r.conn)
341− r.dataM.Unlock()
342− return len(b), err
343−}
344−
345−func (r *RemoteCli) reportWidth() error {
346− screenWidth := GetScreenWidth()
347− data := make([]byte, 2)
348− binary.BigEndian.PutUint16(data, uint16(screenWidth))
349− msg := NewMessage(T_WIDTH_REPORT, data)
350−
351− if err := r.writeMsg(msg); err != nil {
352− return err
353− }
354− return nil
355−}
356−
357−func (r *RemoteCli) reportIsTerminal() error {
358− var isTerminal bool
359− if r.isTerminal != nil {
360− isTerminal = *r.isTerminal
361− } else {
362− isTerminal = DefaultIsTerminal()
363− }
364− data := make([]byte, 2)
365− if isTerminal {
366− binary.BigEndian.PutUint16(data, 1)
367− } else {
368− binary.BigEndian.PutUint16(data, 0)
369− }
370− msg := NewMessage(T_ISTTY_REPORT, data)
371− if err := r.writeMsg(msg); err != nil {
372− return err
373− }
374− return nil
375−}
376−
377−func (r *RemoteCli) readLoop() {
378− buf := bufio.NewReader(r.conn)
379− for {
380− msg, err := ReadMessage(buf)
381− if err != nil {
382− break
383− }
384− switch msg.Type {
385− case T_ERAW:
386− r.raw.Exit()
387− case T_RAW:
388− r.raw.Enter()
389− case T_DATA:
390− os.Stdout.Write(msg.Data)
391− }
392− }
393−}
394−
395−func (r *RemoteCli) ServeBy(source io.Reader) error {
396− if err := r.init(); err != nil {
397− return err
398− }
399−
400− go func() {
401− defer r.Close()
402− for {
403− n, _ := io.Copy(r, source)
404− if n == 0 {
405− break
406− }
407− }
408− }()
409− defer r.raw.Exit()
410− r.readLoop()
411− return nil
412−}
413−
414−func (r *RemoteCli) Close() {
415− r.writeMsg(NewMessage(T_EOF, nil))
416−}
417−
418−func (r *RemoteCli) Serve() error {
419− return r.ServeBy(os.Stdin)
420−}
421−
422−func ListenRemote(n, addr string, cfg *Config, h func(*Instance), onListen ...func(net.Listener) error) error {
423− ln, err := net.Listen(n, addr)
424− if err != nil {
425− return err
426− }
427− if len(onListen) > 0 {
428− if err := onListen[0](ln); err != nil {
429− return err
430− }
431− }
432− for {
433− conn, err := ln.Accept()
434− if err != nil {
435− break
436− }
437− go func() {
438− defer conn.Close()
439− rl, err := HandleConn(*cfg, conn)
440− if err != nil {
441− return
442− }
443− h(rl)
444− }()
445− }
446− return nil
447−}
448−
449−func HandleConn(cfg Config, conn net.Conn) (*Instance, error) {
450− r, err := NewRemoteSvr(conn)
451− if err != nil {
452− return nil, err
453− }
454− r.HandleConfig(&cfg)
455−
456− rl, err := NewEx(&cfg)
457− if err != nil {
458− return nil, err
459− }
460− return rl, nil
461−}
462−
463−func DialRemote(n, addr string) error {
464− conn, err := net.Dial(n, addr)
465− if err != nil {
466− return err
467− }
468− defer conn.Close()
469−
470− cli, err := NewRemoteCli(conn)
471− if err != nil {
472− return err
473− }
474− return cli.Serve()
475−}
vendor/github.com/chzyer/readline/runebuf.godeleted−629
@@ -1,629 +0,0 @@
1−package readline
2−
3−import (
4− "bufio"
5− "bytes"
6− "io"
7− "strconv"
8− "strings"
9− "sync"
10−)
11−
12−type runeBufferBck struct {
13− buf []rune
14− idx int
15−}
16−
17−type RuneBuffer struct {
18− buf []rune
19− idx int
20− prompt []rune
21− w io.Writer
22−
23− hadClean bool
24− interactive bool
25− cfg *Config
26−
27− width int
28−
29− bck *runeBufferBck
30−
31− offset string
32−
33− lastKill []rune
34−
35− sync.Mutex
36−}
37−
38−func (r* RuneBuffer) pushKill(text []rune) {
39− r.lastKill = append([]rune{}, text...)
40−}
41−
42−func (r *RuneBuffer) OnWidthChange(newWidth int) {
43− r.Lock()
44− r.width = newWidth
45− r.Unlock()
46−}
47−
48−func (r *RuneBuffer) Backup() {
49− r.Lock()
50− r.bck = &runeBufferBck{r.buf, r.idx}
51− r.Unlock()
52−}
53−
54−func (r *RuneBuffer) Restore() {
55− r.Refresh(func() {
56− if r.bck == nil {
57− return
58− }
59− r.buf = r.bck.buf
60− r.idx = r.bck.idx
61− })
62−}
63−
64−func NewRuneBuffer(w io.Writer, prompt string, cfg *Config, width int) *RuneBuffer {
65− rb := &RuneBuffer{
66− w: w,
67− interactive: cfg.useInteractive(),
68− cfg: cfg,
69− width: width,
70− }
71− rb.SetPrompt(prompt)
72− return rb
73−}
74−
75−func (r *RuneBuffer) SetConfig(cfg *Config) {
76− r.Lock()
77− r.cfg = cfg
78− r.interactive = cfg.useInteractive()
79− r.Unlock()
80−}
81−
82−func (r *RuneBuffer) SetMask(m rune) {
83− r.Lock()
84− r.cfg.MaskRune = m
85− r.Unlock()
86−}
87−
88−func (r *RuneBuffer) CurrentWidth(x int) int {
89− r.Lock()
90− defer r.Unlock()
91− return runes.WidthAll(r.buf[:x])
92−}
93−
94−func (r *RuneBuffer) PromptLen() int {
95− r.Lock()
96− width := r.promptLen()
97− r.Unlock()
98− return width
99−}
100−
101−func (r *RuneBuffer) promptLen() int {
102− return runes.WidthAll(runes.ColorFilter(r.prompt))
103−}
104−
105−func (r *RuneBuffer) RuneSlice(i int) []rune {
106− r.Lock()
107− defer r.Unlock()
108−
109− if i > 0 {
110− rs := make([]rune, i)
111− copy(rs, r.buf[r.idx:r.idx+i])
112− return rs
113− }
114− rs := make([]rune, -i)
115− copy(rs, r.buf[r.idx+i:r.idx])
116− return rs
117−}
118−
119−func (r *RuneBuffer) Runes() []rune {
120− r.Lock()
121− newr := make([]rune, len(r.buf))
122− copy(newr, r.buf)
123− r.Unlock()
124− return newr
125−}
126−
127−func (r *RuneBuffer) Pos() int {
128− r.Lock()
129− defer r.Unlock()
130− return r.idx
131−}
132−
133−func (r *RuneBuffer) Len() int {
134− r.Lock()
135− defer r.Unlock()
136− return len(r.buf)
137−}
138−
139−func (r *RuneBuffer) MoveToLineStart() {
140− r.Refresh(func() {
141− if r.idx == 0 {
142− return
143− }
144− r.idx = 0
145− })
146−}
147−
148−func (r *RuneBuffer) MoveBackward() {
149− r.Refresh(func() {
150− if r.idx == 0 {
151− return
152− }
153− r.idx--
154− })
155−}
156−
157−func (r *RuneBuffer) WriteString(s string) {
158− r.WriteRunes([]rune(s))
159−}
160−
161−func (r *RuneBuffer) WriteRune(s rune) {
162− r.WriteRunes([]rune{s})
163−}
164−
165−func (r *RuneBuffer) WriteRunes(s []rune) {
166− r.Refresh(func() {
167− tail := append(s, r.buf[r.idx:]...)
168− r.buf = append(r.buf[:r.idx], tail...)
169− r.idx += len(s)
170− })
171−}
172−
173−func (r *RuneBuffer) MoveForward() {
174− r.Refresh(func() {
175− if r.idx == len(r.buf) {
176− return
177− }
178− r.idx++
179− })
180−}
181−
182−func (r *RuneBuffer) IsCursorInEnd() bool {
183− r.Lock()
184− defer r.Unlock()
185− return r.idx == len(r.buf)
186−}
187−
188−func (r *RuneBuffer) Replace(ch rune) {
189− r.Refresh(func() {
190− r.buf[r.idx] = ch
191− })
192−}
193−
194−func (r *RuneBuffer) Erase() {
195− r.Refresh(func() {
196− r.idx = 0
197− r.pushKill(r.buf[:])
198− r.buf = r.buf[:0]
199− })
200−}
201−
202−func (r *RuneBuffer) Delete() (success bool) {
203− r.Refresh(func() {
204− if r.idx == len(r.buf) {
205− return
206− }
207− r.pushKill(r.buf[r.idx : r.idx+1])
208− r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
209− success = true
210− })
211− return
212−}
213−
214−func (r *RuneBuffer) DeleteWord() {
215− if r.idx == len(r.buf) {
216− return
217− }
218− init := r.idx
219− for init < len(r.buf) && IsWordBreak(r.buf[init]) {
220− init++
221− }
222− for i := init + 1; i < len(r.buf); i++ {
223− if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
224− r.pushKill(r.buf[r.idx:i-1])
225− r.Refresh(func() {
226− r.buf = append(r.buf[:r.idx], r.buf[i-1:]...)
227− })
228− return
229− }
230− }
231− r.Kill()
232−}
233−
234−func (r *RuneBuffer) MoveToPrevWord() (success bool) {
235− r.Refresh(func() {
236− if r.idx == 0 {
237− return
238− }
239−
240− for i := r.idx - 1; i > 0; i-- {
241− if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
242− r.idx = i
243− success = true
244− return
245− }
246− }
247− r.idx = 0
248− success = true
249− })
250− return
251−}
252−
253−func (r *RuneBuffer) KillFront() {
254− r.Refresh(func() {
255− if r.idx == 0 {
256− return
257− }
258−
259− length := len(r.buf) - r.idx
260− r.pushKill(r.buf[:r.idx])
261− copy(r.buf[:length], r.buf[r.idx:])
262− r.idx = 0
263− r.buf = r.buf[:length]
264− })
265−}
266−
267−func (r *RuneBuffer) Kill() {
268− r.Refresh(func() {
269− r.pushKill(r.buf[r.idx:])
270− r.buf = r.buf[:r.idx]
271− })
272−}
273−
274−func (r *RuneBuffer) Transpose() {
275− r.Refresh(func() {
276− if len(r.buf) == 1 {
277− r.idx++
278− }
279−
280− if len(r.buf) < 2 {
281− return
282− }
283−
284− if r.idx == 0 {
285− r.idx = 1
286− } else if r.idx >= len(r.buf) {
287− r.idx = len(r.buf) - 1
288− }
289− r.buf[r.idx], r.buf[r.idx-1] = r.buf[r.idx-1], r.buf[r.idx]
290− r.idx++
291− })
292−}
293−
294−func (r *RuneBuffer) MoveToNextWord() {
295− r.Refresh(func() {
296− for i := r.idx + 1; i < len(r.buf); i++ {
297− if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
298− r.idx = i
299− return
300− }
301− }
302−
303− r.idx = len(r.buf)
304− })
305−}
306−
307−func (r *RuneBuffer) MoveToEndWord() {
308− r.Refresh(func() {
309− // already at the end, so do nothing
310− if r.idx == len(r.buf) {
311− return
312− }
313− // if we are at the end of a word already, go to next
314− if !IsWordBreak(r.buf[r.idx]) && IsWordBreak(r.buf[r.idx+1]) {
315− r.idx++
316− }
317−
318− // keep going until at the end of a word
319− for i := r.idx + 1; i < len(r.buf); i++ {
320− if IsWordBreak(r.buf[i]) && !IsWordBreak(r.buf[i-1]) {
321− r.idx = i - 1
322− return
323− }
324− }
325− r.idx = len(r.buf)
326− })
327−}
328−
329−func (r *RuneBuffer) BackEscapeWord() {
330− r.Refresh(func() {
331− if r.idx == 0 {
332− return
333− }
334− for i := r.idx - 1; i > 0; i-- {
335− if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) {
336− r.pushKill(r.buf[i:r.idx])
337− r.buf = append(r.buf[:i], r.buf[r.idx:]...)
338− r.idx = i
339− return
340− }
341− }
342−
343− r.buf = r.buf[:0]
344− r.idx = 0
345− })
346−}
347−
348−func (r *RuneBuffer) Yank() {
349− if len(r.lastKill) == 0 {
350− return
351− }
352− r.Refresh(func() {
353− buf := make([]rune, 0, len(r.buf) + len(r.lastKill))
354− buf = append(buf, r.buf[:r.idx]...)
355− buf = append(buf, r.lastKill...)
356− buf = append(buf, r.buf[r.idx:]...)
357− r.buf = buf
358− r.idx += len(r.lastKill)
359− })
360−}
361−
362−func (r *RuneBuffer) Backspace() {
363− r.Refresh(func() {
364− if r.idx == 0 {
365− return
366− }
367−
368− r.idx--
369− r.buf = append(r.buf[:r.idx], r.buf[r.idx+1:]...)
370− })
371−}
372−
373−func (r *RuneBuffer) MoveToLineEnd() {
374− r.Refresh(func() {
375− if r.idx == len(r.buf) {
376− return
377− }
378−
379− r.idx = len(r.buf)
380− })
381−}
382−
383−func (r *RuneBuffer) LineCount(width int) int {
384− if width == -1 {
385− width = r.width
386− }
387− return LineCount(width,
388− runes.WidthAll(r.buf)+r.PromptLen())
389−}
390−
391−func (r *RuneBuffer) MoveTo(ch rune, prevChar, reverse bool) (success bool) {
392− r.Refresh(func() {
393− if reverse {
394− for i := r.idx - 1; i >= 0; i-- {
395− if r.buf[i] == ch {
396− r.idx = i
397− if prevChar {
398− r.idx++
399− }
400− success = true
401− return
402− }
403− }
404− return
405− }
406− for i := r.idx + 1; i < len(r.buf); i++ {
407− if r.buf[i] == ch {
408− r.idx = i
409− if prevChar {
410− r.idx--
411− }
412− success = true
413− return
414− }
415− }
416− })
417− return
418−}
419−
420−func (r *RuneBuffer) isInLineEdge() bool {
421− if isWindows {
422− return false
423− }
424− sp := r.getSplitByLine(r.buf)
425− return len(sp[len(sp)-1]) == 0
426−}
427−
428−func (r *RuneBuffer) getSplitByLine(rs []rune) []string {
429− return SplitByLine(r.promptLen(), r.width, rs)
430−}
431−
432−func (r *RuneBuffer) IdxLine(width int) int {
433− r.Lock()
434− defer r.Unlock()
435− return r.idxLine(width)
436−}
437−
438−func (r *RuneBuffer) idxLine(width int) int {
439− if width == 0 {
440− return 0
441− }
442− sp := r.getSplitByLine(r.buf[:r.idx])
443− return len(sp) - 1
444−}
445−
446−func (r *RuneBuffer) CursorLineCount() int {
447− return r.LineCount(r.width) - r.IdxLine(r.width)
448−}
449−
450−func (r *RuneBuffer) Refresh(f func()) {
451− r.Lock()
452− defer r.Unlock()
453−
454− if !r.interactive {
455− if f != nil {
456− f()
457− }
458− return
459− }
460−
461− r.clean()
462− if f != nil {
463− f()
464− }
465− r.print()
466−}
467−
468−func (r *RuneBuffer) SetOffset(offset string) {
469− r.Lock()
470− r.offset = offset
471− r.Unlock()
472−}
473−
474−func (r *RuneBuffer) print() {
475− r.w.Write(r.output())
476− r.hadClean = false
477−}
478−
479−func (r *RuneBuffer) output() []byte {
480− buf := bytes.NewBuffer(nil)
481− buf.WriteString(string(r.prompt))
482− if r.cfg.EnableMask && len(r.buf) > 0 {
483− buf.Write([]byte(strings.Repeat(string(r.cfg.MaskRune), len(r.buf)-1)))
484− if r.buf[len(r.buf)-1] == '\n' {
485− buf.Write([]byte{'\n'})
486− } else {
487− buf.Write([]byte(string(r.cfg.MaskRune)))
488− }
489− if len(r.buf) > r.idx {
490− buf.Write(r.getBackspaceSequence())
491− }
492−
493− } else {
494− for _, e := range r.cfg.Painter.Paint(r.buf, r.idx) {
495− if e == '\t' {
496− buf.WriteString(strings.Repeat(" ", TabWidth))
497− } else {
498− buf.WriteRune(e)
499− }
500− }
501− if r.isInLineEdge() {
502− buf.Write([]byte(" \b"))
503− }
504− }
505− // cursor position
506− if len(r.buf) > r.idx {
507− buf.Write(r.getBackspaceSequence())
508− }
509− return buf.Bytes()
510−}
511−
512−func (r *RuneBuffer) getBackspaceSequence() []byte {
513− var sep = map[int]bool{}
514−
515− var i int
516− for {
517− if i >= runes.WidthAll(r.buf) {
518− break
519− }
520−
521− if i == 0 {
522− i -= r.promptLen()
523− }
524− i += r.width
525−
526− sep[i] = true
527− }
528− var buf []byte
529− for i := len(r.buf); i > r.idx; i-- {
530− // move input to the left of one
531− buf = append(buf, '\b')
532− if sep[i] {
533− // up one line, go to the start of the line and move cursor right to the end (r.width)
534− buf = append(buf, "\033[A\r"+"\033["+strconv.Itoa(r.width)+"C"...)
535− }
536− }
537−
538− return buf
539−
540−}
541−
542−func (r *RuneBuffer) Reset() []rune {
543− ret := runes.Copy(r.buf)
544− r.buf = r.buf[:0]
545− r.idx = 0
546− return ret
547−}
548−
549−func (r *RuneBuffer) calWidth(m int) int {
550− if m > 0 {
551− return runes.WidthAll(r.buf[r.idx : r.idx+m])
552− }
553− return runes.WidthAll(r.buf[r.idx+m : r.idx])
554−}
555−
556−func (r *RuneBuffer) SetStyle(start, end int, style string) {
557− if end < start {
558− panic("end < start")
559− }
560−
561− // goto start
562− move := start - r.idx
563− if move > 0 {
564− r.w.Write([]byte(string(r.buf[r.idx : r.idx+move])))
565− } else {
566− r.w.Write(bytes.Repeat([]byte("\b"), r.calWidth(move)))
567− }
568− r.w.Write([]byte("\033[" + style + "m"))
569− r.w.Write([]byte(string(r.buf[start:end])))
570− r.w.Write([]byte("\033[0m"))
571− // TODO: move back
572−}
573−
574−func (r *RuneBuffer) SetWithIdx(idx int, buf []rune) {
575− r.Refresh(func() {
576− r.buf = buf
577− r.idx = idx
578− })
579−}
580−
581−func (r *RuneBuffer) Set(buf []rune) {
582− r.SetWithIdx(len(buf), buf)
583−}
584−
585−func (r *RuneBuffer) SetPrompt(prompt string) {
586− r.Lock()
587− r.prompt = []rune(prompt)
588− r.Unlock()
589−}
590−
591−func (r *RuneBuffer) cleanOutput(w io.Writer, idxLine int) {
592− buf := bufio.NewWriter(w)
593−
594− if r.width == 0 {
595− buf.WriteString(strings.Repeat("\r\b", len(r.buf)+r.promptLen()))
596− buf.Write([]byte("\033[J"))
597− } else {
598− buf.Write([]byte("\033[J")) // just like ^k :)
599− if idxLine == 0 {
600− buf.WriteString("\033[2K")
601− buf.WriteString("\r")
602− } else {
603− for i := 0; i < idxLine; i++ {
604− io.WriteString(buf, "\033[2K\r\033[A")
605− }
606− io.WriteString(buf, "\033[2K\r")
607− }
608− }
609− buf.Flush()
610− return
611−}
612−
613−func (r *RuneBuffer) Clean() {
614− r.Lock()
615− r.clean()
616− r.Unlock()
617−}
618−
619−func (r *RuneBuffer) clean() {
620− r.cleanWithIdxLine(r.idxLine(r.width))
621−}
622−
623−func (r *RuneBuffer) cleanWithIdxLine(idxLine int) {
624− if r.hadClean || !r.interactive {
625− return
626− }
627− r.hadClean = true
628− r.cleanOutput(r.w, idxLine)
629−}
vendor/github.com/chzyer/readline/runes.godeleted−223
@@ -1,223 +0,0 @@
1−package readline
2−
3−import (
4− "bytes"
5− "unicode"
6− "unicode/utf8"
7−)
8−
9−var runes = Runes{}
10−var TabWidth = 4
11−
12−type Runes struct{}
13−
14−func (Runes) EqualRune(a, b rune, fold bool) bool {
15− if a == b {
16− return true
17− }
18− if !fold {
19− return false
20− }
21− if a > b {
22− a, b = b, a
23− }
24− if b < utf8.RuneSelf && 'A' <= a && a <= 'Z' {
25− if b == a+'a'-'A' {
26− return true
27− }
28− }
29− return false
30−}
31−
32−func (r Runes) EqualRuneFold(a, b rune) bool {
33− return r.EqualRune(a, b, true)
34−}
35−
36−func (r Runes) EqualFold(a, b []rune) bool {
37− if len(a) != len(b) {
38− return false
39− }
40− for i := 0; i < len(a); i++ {
41− if r.EqualRuneFold(a[i], b[i]) {
42− continue
43− }
44− return false
45− }
46−
47− return true
48−}
49−
50−func (Runes) Equal(a, b []rune) bool {
51− if len(a) != len(b) {
52− return false
53− }
54− for i := 0; i < len(a); i++ {
55− if a[i] != b[i] {
56− return false
57− }
58− }
59− return true
60−}
61−
62−func (rs Runes) IndexAllBckEx(r, sub []rune, fold bool) int {
63− for i := len(r) - len(sub); i >= 0; i-- {
64− found := true
65− for j := 0; j < len(sub); j++ {
66− if !rs.EqualRune(r[i+j], sub[j], fold) {
67− found = false
68− break
69− }
70− }
71− if found {
72− return i
73− }
74− }
75− return -1
76−}
77−
78−// Search in runes from end to front
79−func (rs Runes) IndexAllBck(r, sub []rune) int {
80− return rs.IndexAllBckEx(r, sub, false)
81−}
82−
83−// Search in runes from front to end
84−func (rs Runes) IndexAll(r, sub []rune) int {
85− return rs.IndexAllEx(r, sub, false)
86−}
87−
88−func (rs Runes) IndexAllEx(r, sub []rune, fold bool) int {
89− for i := 0; i < len(r); i++ {
90− found := true
91− if len(r[i:]) < len(sub) {
92− return -1
93− }
94− for j := 0; j < len(sub); j++ {
95− if !rs.EqualRune(r[i+j], sub[j], fold) {
96− found = false
97− break
98− }
99− }
100− if found {
101− return i
102− }
103− }
104− return -1
105−}
106−
107−func (Runes) Index(r rune, rs []rune) int {
108− for i := 0; i < len(rs); i++ {
109− if rs[i] == r {
110− return i
111− }
112− }
113− return -1
114−}
115−
116−func (Runes) ColorFilter(r []rune) []rune {
117− newr := make([]rune, 0, len(r))
118− for pos := 0; pos < len(r); pos++ {
119− if r[pos] == '\033' && r[pos+1] == '[' {
120− idx := runes.Index('m', r[pos+2:])
121− if idx == -1 {
122− continue
123− }
124− pos += idx + 2
125− continue
126− }
127− newr = append(newr, r[pos])
128− }
129− return newr
130−}
131−
132−var zeroWidth = []*unicode.RangeTable{
133− unicode.Mn,
134− unicode.Me,
135− unicode.Cc,
136− unicode.Cf,
137−}
138−
139−var doubleWidth = []*unicode.RangeTable{
140− unicode.Han,
141− unicode.Hangul,
142− unicode.Hiragana,
143− unicode.Katakana,
144−}
145−
146−func (Runes) Width(r rune) int {
147− if r == '\t' {
148− return TabWidth
149− }
150− if unicode.IsOneOf(zeroWidth, r) {
151− return 0
152− }
153− if unicode.IsOneOf(doubleWidth, r) {
154− return 2
155− }
156− return 1
157−}
158−
159−func (Runes) WidthAll(r []rune) (length int) {
160− for i := 0; i < len(r); i++ {
161− length += runes.Width(r[i])
162− }
163− return
164−}
165−
166−func (Runes) Backspace(r []rune) []byte {
167− return bytes.Repeat([]byte{'\b'}, runes.WidthAll(r))
168−}
169−
170−func (Runes) Copy(r []rune) []rune {
171− n := make([]rune, len(r))
172− copy(n, r)
173− return n
174−}
175−
176−func (Runes) HasPrefixFold(r, prefix []rune) bool {
177− if len(r) < len(prefix) {
178− return false
179− }
180− return runes.EqualFold(r[:len(prefix)], prefix)
181−}
182−
183−func (Runes) HasPrefix(r, prefix []rune) bool {
184− if len(r) < len(prefix) {
185− return false
186− }
187− return runes.Equal(r[:len(prefix)], prefix)
188−}
189−
190−func (Runes) Aggregate(candicate [][]rune) (same []rune, size int) {
191− for i := 0; i < len(candicate[0]); i++ {
192− for j := 0; j < len(candicate)-1; j++ {
193− if i >= len(candicate[j]) || i >= len(candicate[j+1]) {
194− goto aggregate
195− }
196− if candicate[j][i] != candicate[j+1][i] {
197− goto aggregate
198− }
199− }
200− size = i + 1
201− }
202−aggregate:
203− if size > 0 {
204− same = runes.Copy(candicate[0][:size])
205− for i := 0; i < len(candicate); i++ {
206− n := runes.Copy(candicate[i])
207− copy(n, n[size:])
208− candicate[i] = n[:len(n)-size]
209− }
210− }
211− return
212−}
213−
214−func (Runes) TrimSpaceLeft(in []rune) []rune {
215− firstIndex := len(in)
216− for i, r := range in {
217− if unicode.IsSpace(r) == false {
218− firstIndex = i
219− break
220− }
221− }
222− return in[firstIndex:]
223−}
vendor/github.com/chzyer/readline/search.godeleted−164
@@ -1,164 +0,0 @@
1−package readline
2−
3−import (
4− "bytes"
5− "container/list"
6− "fmt"
7− "io"
8−)
9−
10−const (
11− S_STATE_FOUND = iota
12− S_STATE_FAILING
13−)
14−
15−const (
16− S_DIR_BCK = iota
17− S_DIR_FWD
18−)
19−
20−type opSearch struct {
21− inMode bool
22− state int
23− dir int
24− source *list.Element
25− w io.Writer
26− buf *RuneBuffer
27− data []rune
28− history *opHistory
29− cfg *Config
30− markStart int
31− markEnd int
32− width int
33−}
34−
35−func newOpSearch(w io.Writer, buf *RuneBuffer, history *opHistory, cfg *Config, width int) *opSearch {
36− return &opSearch{
37− w: w,
38− buf: buf,
39− cfg: cfg,
40− history: history,
41− width: width,
42− }
43−}
44−
45−func (o *opSearch) OnWidthChange(newWidth int) {
46− o.width = newWidth
47−}
48−
49−func (o *opSearch) IsSearchMode() bool {
50− return o.inMode
51−}
52−
53−func (o *opSearch) SearchBackspace() {
54− if len(o.data) > 0 {
55− o.data = o.data[:len(o.data)-1]
56− o.search(true)
57− }
58−}
59−
60−func (o *opSearch) findHistoryBy(isNewSearch bool) (int, *list.Element) {
61− if o.dir == S_DIR_BCK {
62− return o.history.FindBck(isNewSearch, o.data, o.buf.idx)
63− }
64− return o.history.FindFwd(isNewSearch, o.data, o.buf.idx)
65−}
66−
67−func (o *opSearch) search(isChange bool) bool {
68− if len(o.data) == 0 {
69− o.state = S_STATE_FOUND
70− o.SearchRefresh(-1)
71− return true
72− }
73− idx, elem := o.findHistoryBy(isChange)
74− if elem == nil {
75− o.SearchRefresh(-2)
76− return false
77− }
78− o.history.current = elem
79−
80− item := o.history.showItem(o.history.current.Value)
81− start, end := 0, 0
82− if o.dir == S_DIR_BCK {
83− start, end = idx, idx+len(o.data)
84− } else {
85− start, end = idx, idx+len(o.data)
86− idx += len(o.data)
87− }
88− o.buf.SetWithIdx(idx, item)
89− o.markStart, o.markEnd = start, end
90− o.SearchRefresh(idx)
91− return true
92−}
93−
94−func (o *opSearch) SearchChar(r rune) {
95− o.data = append(o.data, r)
96− o.search(true)
97−}
98−
99−func (o *opSearch) SearchMode(dir int) bool {
100− if o.width == 0 {
101− return false
102− }
103− alreadyInMode := o.inMode
104− o.inMode = true
105− o.dir = dir
106− o.source = o.history.current
107− if alreadyInMode {
108− o.search(false)
109− } else {
110− o.SearchRefresh(-1)
111− }
112− return true
113−}
114−
115−func (o *opSearch) ExitSearchMode(revert bool) {
116− if revert {
117− o.history.current = o.source
118− o.buf.Set(o.history.showItem(o.history.current.Value))
119− }
120− o.markStart, o.markEnd = 0, 0
121− o.state = S_STATE_FOUND
122− o.inMode = false
123− o.source = nil
124− o.data = nil
125−}
126−
127−func (o *opSearch) SearchRefresh(x int) {
128− if x == -2 {
129− o.state = S_STATE_FAILING
130− } else if x >= 0 {
131− o.state = S_STATE_FOUND
132− }
133− if x < 0 {
134− x = o.buf.idx
135− }
136− x = o.buf.CurrentWidth(x)
137− x += o.buf.PromptLen()
138− x = x % o.width
139−
140− if o.markStart > 0 {
141− o.buf.SetStyle(o.markStart, o.markEnd, "4")
142− }
143−
144− lineCnt := o.buf.CursorLineCount()
145− buf := bytes.NewBuffer(nil)
146− buf.Write(bytes.Repeat([]byte("\n"), lineCnt))
147− buf.WriteString("\033[J")
148− if o.state == S_STATE_FAILING {
149− buf.WriteString("failing ")
150− }
151− if o.dir == S_DIR_BCK {
152− buf.WriteString("bck")
153− } else if o.dir == S_DIR_FWD {
154− buf.WriteString("fwd")
155− }
156− buf.WriteString("-i-search: ")
157− buf.WriteString(string(o.data)) // keyword
158− buf.WriteString("\033[4m \033[0m") // _
159− fmt.Fprintf(buf, "\r\033[%dA", lineCnt) // move prev
160− if x > 0 {
161− fmt.Fprintf(buf, "\033[%dC", x) // move forward
162− }
163− o.w.Write(buf.Bytes())
164−}
vendor/github.com/chzyer/readline/std.godeleted−197
@@ -1,197 +0,0 @@
1−package readline
2−
3−import (
4− "io"
5− "os"
6− "sync"
7− "sync/atomic"
8−)
9−
10−var (
11− Stdin io.ReadCloser = os.Stdin
12− Stdout io.WriteCloser = os.Stdout
13− Stderr io.WriteCloser = os.Stderr
14−)
15−
16−var (
17− std *Instance
18− stdOnce sync.Once
19−)
20−
21−// global instance will not submit history automatic
22−func getInstance() *Instance {
23− stdOnce.Do(func() {
24− std, _ = NewEx(&Config{
25− DisableAutoSaveHistory: true,
26− })
27− })
28− return std
29−}
30−
31−// let readline load history from filepath
32−// and try to persist history into disk
33−// set fp to "" to prevent readline persisting history to disk
34−// so the `AddHistory` will return nil error forever.
35−func SetHistoryPath(fp string) {
36− ins := getInstance()
37− cfg := ins.Config.Clone()
38− cfg.HistoryFile = fp
39− ins.SetConfig(cfg)
40−}
41−
42−// set auto completer to global instance
43−func SetAutoComplete(completer AutoCompleter) {
44− ins := getInstance()
45− cfg := ins.Config.Clone()
46− cfg.AutoComplete = completer
47− ins.SetConfig(cfg)
48−}
49−
50−// add history to global instance manually
51−// raise error only if `SetHistoryPath` is set with a non-empty path
52−func AddHistory(content string) error {
53− ins := getInstance()
54− return ins.SaveHistory(content)
55−}
56−
57−func Password(prompt string) ([]byte, error) {
58− ins := getInstance()
59− return ins.ReadPassword(prompt)
60−}
61−
62−// readline with global configs
63−func Line(prompt string) (string, error) {
64− ins := getInstance()
65− ins.SetPrompt(prompt)
66− return ins.Readline()
67−}
68−
69−type CancelableStdin struct {
70− r io.Reader
71− mutex sync.Mutex
72− stop chan struct{}
73− closed int32
74− notify chan struct{}
75− data []byte
76− read int
77− err error
78−}
79−
80−func NewCancelableStdin(r io.Reader) *CancelableStdin {
81− c := &CancelableStdin{
82− r: r,
83− notify: make(chan struct{}),
84− stop: make(chan struct{}),
85− }
86− go c.ioloop()
87− return c
88−}
89−
90−func (c *CancelableStdin) ioloop() {
91−loop:
92− for {
93− select {
94− case <-c.notify:
95− c.read, c.err = c.r.Read(c.data)
96− select {
97− case c.notify <- struct{}{}:
98− case <-c.stop:
99− break loop
100− }
101− case <-c.stop:
102− break loop
103− }
104− }
105−}
106−
107−func (c *CancelableStdin) Read(b []byte) (n int, err error) {
108− c.mutex.Lock()
109− defer c.mutex.Unlock()
110− if atomic.LoadInt32(&c.closed) == 1 {
111− return 0, io.EOF
112− }
113−
114− c.data = b
115− select {
116− case c.notify <- struct{}{}:
117− case <-c.stop:
118− return 0, io.EOF
119− }
120− select {
121− case <-c.notify:
122− return c.read, c.err
123− case <-c.stop:
124− return 0, io.EOF
125− }
126−}
127−
128−func (c *CancelableStdin) Close() error {
129− if atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
130− close(c.stop)
131− }
132− return nil
133−}
134−
135−// FillableStdin is a stdin reader which can prepend some data before
136−// reading into the real stdin
137−type FillableStdin struct {
138− sync.Mutex
139− stdin io.Reader
140− stdinBuffer io.ReadCloser
141− buf []byte
142− bufErr error
143−}
144−
145−// NewFillableStdin gives you FillableStdin
146−func NewFillableStdin(stdin io.Reader) (io.ReadCloser, io.Writer) {
147− r, w := io.Pipe()
148− s := &FillableStdin{
149− stdinBuffer: r,
150− stdin: stdin,
151− }
152− s.ioloop()
153− return s, w
154−}
155−
156−func (s *FillableStdin) ioloop() {
157− go func() {
158− for {
159− bufR := make([]byte, 100)
160− var n int
161− n, s.bufErr = s.stdinBuffer.Read(bufR)
162− if s.bufErr != nil {
163− if s.bufErr == io.ErrClosedPipe {
164− break
165− }
166− }
167− s.Lock()
168− s.buf = append(s.buf, bufR[:n]...)
169− s.Unlock()
170− }
171− }()
172−}
173−
174−// Read will read from the local buffer and if no data, read from stdin
175−func (s *FillableStdin) Read(p []byte) (n int, err error) {
176− s.Lock()
177− i := len(s.buf)
178− if len(p) < i {
179− i = len(p)
180− }
181− if i > 0 {
182− n := copy(p, s.buf)
183− s.buf = s.buf[:0]
184− cerr := s.bufErr
185− s.bufErr = nil
186− s.Unlock()
187− return n, cerr
188− }
189− s.Unlock()
190− n, err = s.stdin.Read(p)
191− return n, err
192−}
193−
194−func (s *FillableStdin) Close() error {
195− s.stdinBuffer.Close()
196− return nil
197−}
vendor/github.com/chzyer/readline/std_windows.godeleted−9
@@ -1,9 +0,0 @@
1−// +build windows
2−
3−package readline
4−
5−func init() {
6− Stdin = NewRawReader()
7− Stdout = NewANSIWriter(Stdout)
8− Stderr = NewANSIWriter(Stderr)
9−}
vendor/github.com/chzyer/readline/term.godeleted−123
@@ -1,123 +0,0 @@
1−// Copyright 2011 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris
6−
7−// Package terminal provides support functions for dealing with terminals, as
8−// commonly found on UNIX systems.
9−//
10−// Putting a terminal into raw mode is the most common requirement:
11−//
12−// oldState, err := terminal.MakeRaw(0)
13−// if err != nil {
14−// panic(err)
15−// }
16−// defer terminal.Restore(0, oldState)
17−package readline
18−
19−import (
20− "io"
21− "syscall"
22−)
23−
24−// State contains the state of a terminal.
25−type State struct {
26− termios Termios
27−}
28−
29−// IsTerminal returns true if the given file descriptor is a terminal.
30−func IsTerminal(fd int) bool {
31− _, err := getTermios(fd)
32− return err == nil
33−}
34−
35−// MakeRaw put the terminal connected to the given file descriptor into raw
36−// mode and returns the previous state of the terminal so that it can be
37−// restored.
38−func MakeRaw(fd int) (*State, error) {
39− var oldState State
40−
41− if termios, err := getTermios(fd); err != nil {
42− return nil, err
43− } else {
44− oldState.termios = *termios
45− }
46−
47− newState := oldState.termios
48− // This attempts to replicate the behaviour documented for cfmakeraw in
49− // the termios(3) manpage.
50− newState.Iflag &^= syscall.IGNBRK | syscall.BRKINT | syscall.PARMRK | syscall.ISTRIP | syscall.INLCR | syscall.IGNCR | syscall.ICRNL | syscall.IXON
51− // newState.Oflag &^= syscall.OPOST
52− newState.Lflag &^= syscall.ECHO | syscall.ECHONL | syscall.ICANON | syscall.ISIG | syscall.IEXTEN
53− newState.Cflag &^= syscall.CSIZE | syscall.PARENB
54− newState.Cflag |= syscall.CS8
55−
56− newState.Cc[syscall.VMIN] = 1
57− newState.Cc[syscall.VTIME] = 0
58−
59− return &oldState, setTermios(fd, &newState)
60−}
61−
62−// GetState returns the current state of a terminal which may be useful to
63−// restore the terminal after a signal.
64−func GetState(fd int) (*State, error) {
65− termios, err := getTermios(fd)
66− if err != nil {
67− return nil, err
68− }
69−
70− return &State{termios: *termios}, nil
71−}
72−
73−// Restore restores the terminal connected to the given file descriptor to a
74−// previous state.
75−func restoreTerm(fd int, state *State) error {
76− return setTermios(fd, &state.termios)
77−}
78−
79−// ReadPassword reads a line of input from a terminal without local echo. This
80−// is commonly used for inputting passwords and other sensitive data. The slice
81−// returned does not include the \n.
82−func ReadPassword(fd int) ([]byte, error) {
83− oldState, err := getTermios(fd)
84− if err != nil {
85− return nil, err
86− }
87−
88− newState := oldState
89− newState.Lflag &^= syscall.ECHO
90− newState.Lflag |= syscall.ICANON | syscall.ISIG
91− newState.Iflag |= syscall.ICRNL
92− if err := setTermios(fd, newState); err != nil {
93− return nil, err
94− }
95−
96− defer func() {
97− setTermios(fd, oldState)
98− }()
99−
100− var buf [16]byte
101− var ret []byte
102− for {
103− n, err := syscall.Read(fd, buf[:])
104− if err != nil {
105− return nil, err
106− }
107− if n == 0 {
108− if len(ret) == 0 {
109− return nil, io.EOF
110− }
111− break
112− }
113− if buf[n-1] == '\n' {
114− n--
115− }
116− ret = append(ret, buf[:n]...)
117− if n < len(buf) {
118− break
119− }
120− }
121−
122− return ret, nil
123−}
vendor/github.com/chzyer/readline/term_bsd.godeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2013 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build darwin dragonfly freebsd netbsd openbsd
6−
7−package readline
8−
9−import (
10− "syscall"
11− "unsafe"
12−)
13−
14−func getTermios(fd int) (*Termios, error) {
15− termios := new(Termios)
16− _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCGETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
17− if err != 0 {
18− return nil, err
19− }
20− return termios, nil
21−}
22−
23−func setTermios(fd int, termios *Termios) error {
24− _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), syscall.TIOCSETA, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
25− if err != 0 {
26− return err
27− }
28− return nil
29−}
vendor/github.com/chzyer/readline/term_linux.godeleted−33
@@ -1,33 +0,0 @@
1−// Copyright 2013 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−package readline
6−
7−import (
8− "syscall"
9− "unsafe"
10−)
11−
12−// These constants are declared here, rather than importing
13−// them from the syscall package as some syscall packages, even
14−// on linux, for example gccgo, do not declare them.
15−const ioctlReadTermios = 0x5401 // syscall.TCGETS
16−const ioctlWriteTermios = 0x5402 // syscall.TCSETS
17−
18−func getTermios(fd int) (*Termios, error) {
19− termios := new(Termios)
20− _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
21− if err != 0 {
22− return nil, err
23− }
24− return termios, nil
25−}
26−
27−func setTermios(fd int, termios *Termios) error {
28− _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlWriteTermios, uintptr(unsafe.Pointer(termios)), 0, 0, 0)
29− if err != 0 {
30− return err
31− }
32− return nil
33−}
vendor/github.com/chzyer/readline/term_solaris.godeleted−32
@@ -1,32 +0,0 @@
1−// Copyright 2013 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build solaris
6−
7−package readline
8−
9−import "golang.org/x/sys/unix"
10−
11−// GetSize returns the dimensions of the given terminal.
12−func GetSize(fd int) (int, int, error) {
13− ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
14− if err != nil {
15− return 0, 0, err
16− }
17− return int(ws.Col), int(ws.Row), nil
18−}
19−
20−type Termios unix.Termios
21−
22−func getTermios(fd int) (*Termios, error) {
23− termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
24− if err != nil {
25− return nil, err
26− }
27− return (*Termios)(termios), nil
28−}
29−
30−func setTermios(fd int, termios *Termios) error {
31− return unix.IoctlSetTermios(fd, unix.TCSETSF, (*unix.Termios)(termios))
32−}
vendor/github.com/chzyer/readline/term_unix.godeleted−24
@@ -1,24 +0,0 @@
1−// Copyright 2011 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
6−
7−package readline
8−
9−import (
10− "syscall"
11− "unsafe"
12−)
13−
14−type Termios syscall.Termios
15−
16−// GetSize returns the dimensions of the given terminal.
17−func GetSize(fd int) (int, int, error) {
18− var dimensions [4]uint16
19− _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&dimensions)), 0, 0, 0)
20− if err != 0 {
21− return 0, 0, err
22− }
23− return int(dimensions[1]), int(dimensions[0]), nil
24−}
vendor/github.com/chzyer/readline/term_windows.godeleted−171
@@ -1,171 +0,0 @@
1−// Copyright 2011 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build windows
6−
7−// Package terminal provides support functions for dealing with terminals, as
8−// commonly found on UNIX systems.
9−//
10−// Putting a terminal into raw mode is the most common requirement:
11−//
12−// oldState, err := terminal.MakeRaw(0)
13−// if err != nil {
14−// panic(err)
15−// }
16−// defer terminal.Restore(0, oldState)
17−package readline
18−
19−import (
20− "io"
21− "syscall"
22− "unsafe"
23−)
24−
25−const (
26− enableLineInput = 2
27− enableEchoInput = 4
28− enableProcessedInput = 1
29− enableWindowInput = 8
30− enableMouseInput = 16
31− enableInsertMode = 32
32− enableQuickEditMode = 64
33− enableExtendedFlags = 128
34− enableAutoPosition = 256
35− enableProcessedOutput = 1
36− enableWrapAtEolOutput = 2
37−)
38−
39−var kernel32 = syscall.NewLazyDLL("kernel32.dll")
40−
41−var (
42− procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
43− procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
44− procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
45−)
46−
47−type (
48− coord struct {
49− x short
50− y short
51− }
52− smallRect struct {
53− left short
54− top short
55− right short
56− bottom short
57− }
58− consoleScreenBufferInfo struct {
59− size coord
60− cursorPosition coord
61− attributes word
62− window smallRect
63− maximumWindowSize coord
64− }
65−)
66−
67−type State struct {
68− mode uint32
69−}
70−
71−// IsTerminal returns true if the given file descriptor is a terminal.
72−func IsTerminal(fd int) bool {
73− var st uint32
74− r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
75− return r != 0 && e == 0
76−}
77−
78−// MakeRaw put the terminal connected to the given file descriptor into raw
79−// mode and returns the previous state of the terminal so that it can be
80−// restored.
81−func MakeRaw(fd int) (*State, error) {
82− var st uint32
83− _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
84− if e != 0 {
85− return nil, error(e)
86− }
87− raw := st &^ (enableEchoInput | enableProcessedInput | enableLineInput | enableProcessedOutput)
88− _, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(raw), 0)
89− if e != 0 {
90− return nil, error(e)
91− }
92− return &State{st}, nil
93−}
94−
95−// GetState returns the current state of a terminal which may be useful to
96−// restore the terminal after a signal.
97−func GetState(fd int) (*State, error) {
98− var st uint32
99− _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
100− if e != 0 {
101− return nil, error(e)
102− }
103− return &State{st}, nil
104−}
105−
106−// Restore restores the terminal connected to the given file descriptor to a
107−// previous state.
108−func restoreTerm(fd int, state *State) error {
109− _, _, err := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(state.mode), 0)
110− return err
111−}
112−
113−// GetSize returns the dimensions of the given terminal.
114−func GetSize(fd int) (width, height int, err error) {
115− var info consoleScreenBufferInfo
116− _, _, e := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&info)), 0)
117− if e != 0 {
118− return 0, 0, error(e)
119− }
120− return int(info.size.x), int(info.size.y), nil
121−}
122−
123−// ReadPassword reads a line of input from a terminal without local echo. This
124−// is commonly used for inputting passwords and other sensitive data. The slice
125−// returned does not include the \n.
126−func ReadPassword(fd int) ([]byte, error) {
127− var st uint32
128− _, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
129− if e != 0 {
130− return nil, error(e)
131− }
132− old := st
133−
134− st &^= (enableEchoInput)
135− st |= (enableProcessedInput | enableLineInput | enableProcessedOutput)
136− _, _, e = syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(st), 0)
137− if e != 0 {
138− return nil, error(e)
139− }
140−
141− defer func() {
142− syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(fd), uintptr(old), 0)
143− }()
144−
145− var buf [16]byte
146− var ret []byte
147− for {
148− n, err := syscall.Read(syscall.Handle(fd), buf[:])
149− if err != nil {
150− return nil, err
151− }
152− if n == 0 {
153− if len(ret) == 0 {
154− return nil, io.EOF
155− }
156− break
157− }
158− if buf[n-1] == '\n' {
159− n--
160− }
161− if n > 0 && buf[n-1] == '\r' {
162− n--
163− }
164− ret = append(ret, buf[:n]...)
165− if n < len(buf) {
166− break
167− }
168− }
169−
170− return ret, nil
171−}
vendor/github.com/chzyer/readline/terminal.godeleted−238
@@ -1,238 +0,0 @@
1−package readline
2−
3−import (
4− "bufio"
5− "fmt"
6− "io"
7− "strings"
8− "sync"
9− "sync/atomic"
10−)
11−
12−type Terminal struct {
13− m sync.Mutex
14− cfg *Config
15− outchan chan rune
16− closed int32
17− stopChan chan struct{}
18− kickChan chan struct{}
19− wg sync.WaitGroup
20− isReading int32
21− sleeping int32
22−
23− sizeChan chan string
24−}
25−
26−func NewTerminal(cfg *Config) (*Terminal, error) {
27− if err := cfg.Init(); err != nil {
28− return nil, err
29− }
30− t := &Terminal{
31− cfg: cfg,
32− kickChan: make(chan struct{}, 1),
33− outchan: make(chan rune),
34− stopChan: make(chan struct{}, 1),
35− sizeChan: make(chan string, 1),
36− }
37−
38− go t.ioloop()
39− return t, nil
40−}
41−
42−// SleepToResume will sleep myself, and return only if I'm resumed.
43−func (t *Terminal) SleepToResume() {
44− if !atomic.CompareAndSwapInt32(&t.sleeping, 0, 1) {
45− return
46− }
47− defer atomic.StoreInt32(&t.sleeping, 0)
48−
49− t.ExitRawMode()
50− ch := WaitForResume()
51− SuspendMe()
52− <-ch
53− t.EnterRawMode()
54−}
55−
56−func (t *Terminal) EnterRawMode() (err error) {
57− return t.cfg.FuncMakeRaw()
58−}
59−
60−func (t *Terminal) ExitRawMode() (err error) {
61− return t.cfg.FuncExitRaw()
62−}
63−
64−func (t *Terminal) Write(b []byte) (int, error) {
65− return t.cfg.Stdout.Write(b)
66−}
67−
68−// WriteStdin prefill the next Stdin fetch
69−// Next time you call ReadLine() this value will be writen before the user input
70−func (t *Terminal) WriteStdin(b []byte) (int, error) {
71− return t.cfg.StdinWriter.Write(b)
72−}
73−
74−type termSize struct {
75− left int
76− top int
77−}
78−
79−func (t *Terminal) GetOffset(f func(offset string)) {
80− go func() {
81− f(<-t.sizeChan)
82− }()
83− t.Write([]byte("\033[6n"))
84−}
85−
86−func (t *Terminal) Print(s string) {
87− fmt.Fprintf(t.cfg.Stdout, "%s", s)
88−}
89−
90−func (t *Terminal) PrintRune(r rune) {
91− fmt.Fprintf(t.cfg.Stdout, "%c", r)
92−}
93−
94−func (t *Terminal) Readline() *Operation {
95− return NewOperation(t, t.cfg)
96−}
97−
98−// return rune(0) if meet EOF
99−func (t *Terminal) ReadRune() rune {
100− ch, ok := <-t.outchan
101− if !ok {
102− return rune(0)
103− }
104− return ch
105−}
106−
107−func (t *Terminal) IsReading() bool {
108− return atomic.LoadInt32(&t.isReading) == 1
109−}
110−
111−func (t *Terminal) KickRead() {
112− select {
113− case t.kickChan <- struct{}{}:
114− default:
115− }
116−}
117−
118−func (t *Terminal) ioloop() {
119− t.wg.Add(1)
120− defer func() {
121− t.wg.Done()
122− close(t.outchan)
123− }()
124−
125− var (
126− isEscape bool
127− isEscapeEx bool
128− expectNextChar bool
129− )
130−
131− buf := bufio.NewReader(t.getStdin())
132− for {
133− if !expectNextChar {
134− atomic.StoreInt32(&t.isReading, 0)
135− select {
136− case <-t.kickChan:
137− atomic.StoreInt32(&t.isReading, 1)
138− case <-t.stopChan:
139− return
140− }
141− }
142− expectNextChar = false
143− r, _, err := buf.ReadRune()
144− if err != nil {
145− if strings.Contains(err.Error(), "interrupted system call") {
146− expectNextChar = true
147− continue
148− }
149− break
150− }
151−
152− if isEscape {
153− isEscape = false
154− if r == CharEscapeEx {
155− expectNextChar = true
156− isEscapeEx = true
157− continue
158− }
159− r = escapeKey(r, buf)
160− } else if isEscapeEx {
161− isEscapeEx = false
162− if key := readEscKey(r, buf); key != nil {
163− r = escapeExKey(key)
164− // offset
165− if key.typ == 'R' {
166− if _, _, ok := key.Get2(); ok {
167− select {
168− case t.sizeChan <- key.attr:
169− default:
170− }
171− }
172− expectNextChar = true
173− continue
174− }
175− }
176− if r == 0 {
177− expectNextChar = true
178− continue
179− }
180− }
181−
182− expectNextChar = true
183− switch r {
184− case CharEsc:
185− if t.cfg.VimMode {
186− t.outchan <- r
187− break
188− }
189− isEscape = true
190− case CharInterrupt, CharEnter, CharCtrlJ, CharDelete:
191− expectNextChar = false
192− fallthrough
193− default:
194− t.outchan <- r
195− }
196− }
197−
198−}
199−
200−func (t *Terminal) Bell() {
201− fmt.Fprintf(t, "%c", CharBell)
202−}
203−
204−func (t *Terminal) Close() error {
205− if atomic.SwapInt32(&t.closed, 1) != 0 {
206− return nil
207− }
208− if closer, ok := t.cfg.Stdin.(io.Closer); ok {
209− closer.Close()
210− }
211− close(t.stopChan)
212− t.wg.Wait()
213− return t.ExitRawMode()
214−}
215−
216−func (t *Terminal) GetConfig() *Config {
217− t.m.Lock()
218− cfg := *t.cfg
219− t.m.Unlock()
220− return &cfg
221−}
222−
223−func (t *Terminal) getStdin() io.Reader {
224− t.m.Lock()
225− r := t.cfg.Stdin
226− t.m.Unlock()
227− return r
228−}
229−
230−func (t *Terminal) SetConfig(c *Config) error {
231− if err := c.Init(); err != nil {
232− return err
233− }
234− t.m.Lock()
235− t.cfg = c
236− t.m.Unlock()
237− return nil
238−}
vendor/github.com/chzyer/readline/utils.godeleted−277
@@ -1,277 +0,0 @@
1−package readline
2−
3−import (
4− "bufio"
5− "bytes"
6− "container/list"
7− "fmt"
8− "os"
9− "strconv"
10− "strings"
11− "sync"
12− "time"
13− "unicode"
14−)
15−
16−var (
17− isWindows = false
18−)
19−
20−const (
21− CharLineStart = 1
22− CharBackward = 2
23− CharInterrupt = 3
24− CharDelete = 4
25− CharLineEnd = 5
26− CharForward = 6
27− CharBell = 7
28− CharCtrlH = 8
29− CharTab = 9
30− CharCtrlJ = 10
31− CharKill = 11
32− CharCtrlL = 12
33− CharEnter = 13
34− CharNext = 14
35− CharPrev = 16
36− CharBckSearch = 18
37− CharFwdSearch = 19
38− CharTranspose = 20
39− CharCtrlU = 21
40− CharCtrlW = 23
41− CharCtrlY = 25
42− CharCtrlZ = 26
43− CharEsc = 27
44− CharEscapeEx = 91
45− CharBackspace = 127
46−)
47−
48−const (
49− MetaBackward rune = -iota - 1
50− MetaForward
51− MetaDelete
52− MetaBackspace
53− MetaTranspose
54−)
55−
56−// WaitForResume need to call before current process got suspend.
57−// It will run a ticker until a long duration is occurs,
58−// which means this process is resumed.
59−func WaitForResume() chan struct{} {
60− ch := make(chan struct{})
61− var wg sync.WaitGroup
62− wg.Add(1)
63− go func() {
64− ticker := time.NewTicker(10 * time.Millisecond)
65− t := time.Now()
66− wg.Done()
67− for {
68− now := <-ticker.C
69− if now.Sub(t) > 100*time.Millisecond {
70− break
71− }
72− t = now
73− }
74− ticker.Stop()
75− ch <- struct{}{}
76− }()
77− wg.Wait()
78− return ch
79−}
80−
81−func Restore(fd int, state *State) error {
82− err := restoreTerm(fd, state)
83− if err != nil {
84− // errno 0 means everything is ok :)
85− if err.Error() == "errno 0" {
86− return nil
87− } else {
88− return err
89− }
90− }
91− return nil
92−}
93−
94−func IsPrintable(key rune) bool {
95− isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
96− return key >= 32 && !isInSurrogateArea
97−}
98−
99−// translate Esc[X
100−func escapeExKey(key *escapeKeyPair) rune {
101− var r rune
102− switch key.typ {
103− case 'D':
104− r = CharBackward
105− case 'C':
106− r = CharForward
107− case 'A':
108− r = CharPrev
109− case 'B':
110− r = CharNext
111− case 'H':
112− r = CharLineStart
113− case 'F':
114− r = CharLineEnd
115− case '~':
116− if key.attr == "3" {
117− r = CharDelete
118− }
119− default:
120− }
121− return r
122−}
123−
124−type escapeKeyPair struct {
125− attr string
126− typ rune
127−}
128−
129−func (e *escapeKeyPair) Get2() (int, int, bool) {
130− sp := strings.Split(e.attr, ";")
131− if len(sp) < 2 {
132− return -1, -1, false
133− }
134− s1, err := strconv.Atoi(sp[0])
135− if err != nil {
136− return -1, -1, false
137− }
138− s2, err := strconv.Atoi(sp[1])
139− if err != nil {
140− return -1, -1, false
141− }
142− return s1, s2, true
143−}
144−
145−func readEscKey(r rune, reader *bufio.Reader) *escapeKeyPair {
146− p := escapeKeyPair{}
147− buf := bytes.NewBuffer(nil)
148− for {
149− if r == ';' {
150− } else if unicode.IsNumber(r) {
151− } else {
152− p.typ = r
153− break
154− }
155− buf.WriteRune(r)
156− r, _, _ = reader.ReadRune()
157− }
158− p.attr = buf.String()
159− return &p
160−}
161−
162−// translate EscX to Meta+X
163−func escapeKey(r rune, reader *bufio.Reader) rune {
164− switch r {
165− case 'b':
166− r = MetaBackward
167− case 'f':
168− r = MetaForward
169− case 'd':
170− r = MetaDelete
171− case CharTranspose:
172− r = MetaTranspose
173− case CharBackspace:
174− r = MetaBackspace
175− case 'O':
176− d, _, _ := reader.ReadRune()
177− switch d {
178− case 'H':
179− r = CharLineStart
180− case 'F':
181− r = CharLineEnd
182− default:
183− reader.UnreadRune()
184− }
185− case CharEsc:
186−
187− }
188− return r
189−}
190−
191−func SplitByLine(start, screenWidth int, rs []rune) []string {
192− var ret []string
193− buf := bytes.NewBuffer(nil)
194− currentWidth := start
195− for _, r := range rs {
196− w := runes.Width(r)
197− currentWidth += w
198− buf.WriteRune(r)
199− if currentWidth >= screenWidth {
200− ret = append(ret, buf.String())
201− buf.Reset()
202− currentWidth = 0
203− }
204− }
205− ret = append(ret, buf.String())
206− return ret
207−}
208−
209−// calculate how many lines for N character
210−func LineCount(screenWidth, w int) int {
211− r := w / screenWidth
212− if w%screenWidth != 0 {
213− r++
214− }
215− return r
216−}
217−
218−func IsWordBreak(i rune) bool {
219− switch {
220− case i >= 'a' && i <= 'z':
221− case i >= 'A' && i <= 'Z':
222− case i >= '0' && i <= '9':
223− default:
224− return true
225− }
226− return false
227−}
228−
229−func GetInt(s []string, def int) int {
230− if len(s) == 0 {
231− return def
232− }
233− c, err := strconv.Atoi(s[0])
234− if err != nil {
235− return def
236− }
237− return c
238−}
239−
240−type RawMode struct {
241− state *State
242−}
243−
244−func (r *RawMode) Enter() (err error) {
245− r.state, err = MakeRaw(GetStdin())
246− return err
247−}
248−
249−func (r *RawMode) Exit() error {
250− if r.state == nil {
251− return nil
252− }
253− return Restore(GetStdin(), r.state)
254−}
255−
256−// -----------------------------------------------------------------------------
257−
258−func sleep(n int) {
259− Debug(n)
260− time.Sleep(2000 * time.Millisecond)
261−}
262−
263−// print a linked list to Debug()
264−func debugList(l *list.List) {
265− idx := 0
266− for e := l.Front(); e != nil; e = e.Next() {
267− Debug(idx, fmt.Sprintf("%+v", e.Value))
268− idx++
269− }
270−}
271−
272−// append log info to another file
273−func Debug(o ...interface{}) {
274− f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
275− fmt.Fprintln(f, o...)
276− f.Close()
277−}
vendor/github.com/chzyer/readline/utils_unix.godeleted−83
@@ -1,83 +0,0 @@
1−// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris
2−
3−package readline
4−
5−import (
6− "io"
7− "os"
8− "os/signal"
9− "sync"
10− "syscall"
11−)
12−
13−type winsize struct {
14− Row uint16
15− Col uint16
16− Xpixel uint16
17− Ypixel uint16
18−}
19−
20−// SuspendMe use to send suspend signal to myself, when we in the raw mode.
21−// For OSX it need to send to parent's pid
22−// For Linux it need to send to myself
23−func SuspendMe() {
24− p, _ := os.FindProcess(os.Getppid())
25− p.Signal(syscall.SIGTSTP)
26− p, _ = os.FindProcess(os.Getpid())
27− p.Signal(syscall.SIGTSTP)
28−}
29−
30−// get width of the terminal
31−func getWidth(stdoutFd int) int {
32− cols, _, err := GetSize(stdoutFd)
33− if err != nil {
34− return -1
35− }
36− return cols
37−}
38−
39−func GetScreenWidth() int {
40− w := getWidth(syscall.Stdout)
41− if w < 0 {
42− w = getWidth(syscall.Stderr)
43− }
44− return w
45−}
46−
47−// ClearScreen clears the console screen
48−func ClearScreen(w io.Writer) (int, error) {
49− return w.Write([]byte("\033[H"))
50−}
51−
52−func DefaultIsTerminal() bool {
53− return IsTerminal(syscall.Stdin) && (IsTerminal(syscall.Stdout) || IsTerminal(syscall.Stderr))
54−}
55−
56−func GetStdin() int {
57− return syscall.Stdin
58−}
59−
60−// -----------------------------------------------------------------------------
61−
62−var (
63− widthChange sync.Once
64− widthChangeCallback func()
65−)
66−
67−func DefaultOnWidthChanged(f func()) {
68− widthChangeCallback = f
69− widthChange.Do(func() {
70− ch := make(chan os.Signal, 1)
71− signal.Notify(ch, syscall.SIGWINCH)
72−
73− go func() {
74− for {
75− _, ok := <-ch
76− if !ok {
77− break
78− }
79− widthChangeCallback()
80− }
81− }()
82− })
83−}
vendor/github.com/chzyer/readline/utils_windows.godeleted−41
@@ -1,41 +0,0 @@
1−// +build windows
2−
3−package readline
4−
5−import (
6− "io"
7− "syscall"
8−)
9−
10−func SuspendMe() {
11−}
12−
13−func GetStdin() int {
14− return int(syscall.Stdin)
15−}
16−
17−func init() {
18− isWindows = true
19−}
20−
21−// get width of the terminal
22−func GetScreenWidth() int {
23− info, _ := GetConsoleScreenBufferInfo()
24− if info == nil {
25− return -1
26− }
27− return int(info.dwSize.x)
28−}
29−
30−// ClearScreen clears the console screen
31−func ClearScreen(_ io.Writer) error {
32− return SetConsoleCursorPosition(&_COORD{0, 0})
33−}
34−
35−func DefaultIsTerminal() bool {
36− return true
37−}
38−
39−func DefaultOnWidthChanged(func()) {
40−
41−}
vendor/github.com/chzyer/readline/vim.godeleted−176
@@ -1,176 +0,0 @@
1−package readline
2−
3−const (
4− VIM_NORMAL = iota
5− VIM_INSERT
6− VIM_VISUAL
7−)
8−
9−type opVim struct {
10− cfg *Config
11− op *Operation
12− vimMode int
13−}
14−
15−func newVimMode(op *Operation) *opVim {
16− ov := &opVim{
17− cfg: op.cfg,
18− op: op,
19− }
20− ov.SetVimMode(ov.cfg.VimMode)
21− return ov
22−}
23−
24−func (o *opVim) SetVimMode(on bool) {
25− if o.cfg.VimMode && !on { // turn off
26− o.ExitVimMode()
27− }
28− o.cfg.VimMode = on
29− o.vimMode = VIM_INSERT
30−}
31−
32−func (o *opVim) ExitVimMode() {
33− o.vimMode = VIM_INSERT
34−}
35−
36−func (o *opVim) IsEnableVimMode() bool {
37− return o.cfg.VimMode
38−}
39−
40−func (o *opVim) handleVimNormalMovement(r rune, readNext func() rune) (t rune, handled bool) {
41− rb := o.op.buf
42− handled = true
43− switch r {
44− case 'h':
45− t = CharBackward
46− case 'j':
47− t = CharNext
48− case 'k':
49− t = CharPrev
50− case 'l':
51− t = CharForward
52− case '0', '^':
53− rb.MoveToLineStart()
54− case '$':
55− rb.MoveToLineEnd()
56− case 'x':
57− rb.Delete()
58− if rb.IsCursorInEnd() {
59− rb.MoveBackward()
60− }
61− case 'r':
62− rb.Replace(readNext())
63− case 'd':
64− next := readNext()
65− switch next {
66− case 'd':
67− rb.Erase()
68− case 'w':
69− rb.DeleteWord()
70− case 'h':
71− rb.Backspace()
72− case 'l':
73− rb.Delete()
74− }
75− case 'p':
76− rb.Yank()
77− case 'b', 'B':
78− rb.MoveToPrevWord()
79− case 'w', 'W':
80− rb.MoveToNextWord()
81− case 'e', 'E':
82− rb.MoveToEndWord()
83− case 'f', 'F', 't', 'T':
84− next := readNext()
85− prevChar := r == 't' || r == 'T'
86− reverse := r == 'F' || r == 'T'
87− switch next {
88− case CharEsc:
89− default:
90− rb.MoveTo(next, prevChar, reverse)
91− }
92− default:
93− return r, false
94− }
95− return t, true
96−}
97−
98−func (o *opVim) handleVimNormalEnterInsert(r rune, readNext func() rune) (t rune, handled bool) {
99− rb := o.op.buf
100− handled = true
101− switch r {
102− case 'i':
103− case 'I':
104− rb.MoveToLineStart()
105− case 'a':
106− rb.MoveForward()
107− case 'A':
108− rb.MoveToLineEnd()
109− case 's':
110− rb.Delete()
111− case 'S':
112− rb.Erase()
113− case 'c':
114− next := readNext()
115− switch next {
116− case 'c':
117− rb.Erase()
118− case 'w':
119− rb.DeleteWord()
120− case 'h':
121− rb.Backspace()
122− case 'l':
123− rb.Delete()
124− }
125− default:
126− return r, false
127− }
128−
129− o.EnterVimInsertMode()
130− return
131−}
132−
133−func (o *opVim) HandleVimNormal(r rune, readNext func() rune) (t rune) {
134− switch r {
135− case CharEnter, CharInterrupt:
136− o.ExitVimMode()
137− return r
138− }
139−
140− if r, handled := o.handleVimNormalMovement(r, readNext); handled {
141− return r
142− }
143−
144− if r, handled := o.handleVimNormalEnterInsert(r, readNext); handled {
145− return r
146− }
147−
148− // invalid operation
149− o.op.t.Bell()
150− return 0
151−}
152−
153−func (o *opVim) EnterVimInsertMode() {
154− o.vimMode = VIM_INSERT
155−}
156−
157−func (o *opVim) ExitVimInsertMode() {
158− o.vimMode = VIM_NORMAL
159−}
160−
161−func (o *opVim) HandleVim(r rune, readNext func() rune) rune {
162− if o.vimMode == VIM_NORMAL {
163− return o.HandleVimNormal(r, readNext)
164− }
165− if r == CharEsc {
166− o.ExitVimInsertMode()
167− return 0
168− }
169−
170− switch o.vimMode {
171− case VIM_INSERT:
172− return r
173− case VIM_VISUAL:
174− }
175− return r
176−}
vendor/github.com/chzyer/readline/windows_api.godeleted−152
@@ -1,152 +0,0 @@
1−// +build windows
2−
3−package readline
4−
5−import (
6− "reflect"
7− "syscall"
8− "unsafe"
9−)
10−
11−var (
12− kernel = NewKernel()
13− stdout = uintptr(syscall.Stdout)
14− stdin = uintptr(syscall.Stdin)
15−)
16−
17−type Kernel struct {
18− SetConsoleCursorPosition,
19− SetConsoleTextAttribute,
20− FillConsoleOutputCharacterW,
21− FillConsoleOutputAttribute,
22− ReadConsoleInputW,
23− GetConsoleScreenBufferInfo,
24− GetConsoleCursorInfo,
25− GetStdHandle CallFunc
26−}
27−
28−type short int16
29−type word uint16
30−type dword uint32
31−type wchar uint16
32−
33−type _COORD struct {
34− x short
35− y short
36−}
37−
38−func (c *_COORD) ptr() uintptr {
39− return uintptr(*(*int32)(unsafe.Pointer(c)))
40−}
41−
42−const (
43− EVENT_KEY = 0x0001
44− EVENT_MOUSE = 0x0002
45− EVENT_WINDOW_BUFFER_SIZE = 0x0004
46− EVENT_MENU = 0x0008
47− EVENT_FOCUS = 0x0010
48−)
49−
50−type _KEY_EVENT_RECORD struct {
51− bKeyDown int32
52− wRepeatCount word
53− wVirtualKeyCode word
54− wVirtualScanCode word
55− unicodeChar wchar
56− dwControlKeyState dword
57−}
58−
59−// KEY_EVENT_RECORD KeyEvent;
60−// MOUSE_EVENT_RECORD MouseEvent;
61−// WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
62−// MENU_EVENT_RECORD MenuEvent;
63−// FOCUS_EVENT_RECORD FocusEvent;
64−type _INPUT_RECORD struct {
65− EventType word
66− Padding uint16
67− Event [16]byte
68−}
69−
70−type _CONSOLE_SCREEN_BUFFER_INFO struct {
71− dwSize _COORD
72− dwCursorPosition _COORD
73− wAttributes word
74− srWindow _SMALL_RECT
75− dwMaximumWindowSize _COORD
76−}
77−
78−type _SMALL_RECT struct {
79− left short
80− top short
81− right short
82− bottom short
83−}
84−
85−type _CONSOLE_CURSOR_INFO struct {
86− dwSize dword
87− bVisible bool
88−}
89−
90−type CallFunc func(u ...uintptr) error
91−
92−func NewKernel() *Kernel {
93− k := &Kernel{}
94− kernel32 := syscall.NewLazyDLL("kernel32.dll")
95− v := reflect.ValueOf(k).Elem()
96− t := v.Type()
97− for i := 0; i < t.NumField(); i++ {
98− name := t.Field(i).Name
99− f := kernel32.NewProc(name)
100− v.Field(i).Set(reflect.ValueOf(k.Wrap(f)))
101− }
102− return k
103−}
104−
105−func (k *Kernel) Wrap(p *syscall.LazyProc) CallFunc {
106− return func(args ...uintptr) error {
107− var r0 uintptr
108− var e1 syscall.Errno
109− size := uintptr(len(args))
110− if len(args) <= 3 {
111− buf := make([]uintptr, 3)
112− copy(buf, args)
113− r0, _, e1 = syscall.Syscall(p.Addr(), size,
114− buf[0], buf[1], buf[2])
115− } else {
116− buf := make([]uintptr, 6)
117− copy(buf, args)
118− r0, _, e1 = syscall.Syscall6(p.Addr(), size,
119− buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
120− )
121− }
122−
123− if int(r0) == 0 {
124− if e1 != 0 {
125− return error(e1)
126− } else {
127− return syscall.EINVAL
128− }
129− }
130− return nil
131− }
132−
133−}
134−
135−func GetConsoleScreenBufferInfo() (*_CONSOLE_SCREEN_BUFFER_INFO, error) {
136− t := new(_CONSOLE_SCREEN_BUFFER_INFO)
137− err := kernel.GetConsoleScreenBufferInfo(
138− stdout,
139− uintptr(unsafe.Pointer(t)),
140− )
141− return t, err
142−}
143−
144−func GetConsoleCursorInfo() (*_CONSOLE_CURSOR_INFO, error) {
145− t := new(_CONSOLE_CURSOR_INFO)
146− err := kernel.GetConsoleCursorInfo(stdout, uintptr(unsafe.Pointer(t)))
147− return t, err
148−}
149−
150−func SetConsoleCursorPosition(c *_COORD) error {
151− return kernel.SetConsoleCursorPosition(stdout, c.ptr())
152−}
vendor/golang.org/x/sys/AUTHORSdeleted−3
@@ -1,3 +0,0 @@
1−# This source code refers to The Go Authors for copyright purposes.
2−# The master list of authors is in the main Go distribution,
3−# visible at http://tip.golang.org/AUTHORS.
vendor/golang.org/x/sys/CONTRIBUTORSdeleted−3
@@ -1,3 +0,0 @@
1−# This source code was written by the Go contributors.
2−# The master list of contributors is in the main Go distribution,
3−# visible at http://tip.golang.org/CONTRIBUTORS.
vendor/golang.org/x/sys/LICENSEdeleted−27
@@ -1,27 +0,0 @@
1−Copyright (c) 2009 The Go Authors. All rights reserved.
2−
3−Redistribution and use in source and binary forms, with or without
4−modification, are permitted provided that the following conditions are
5−met:
6−
7− * Redistributions of source code must retain the above copyright
8−notice, this list of conditions and the following disclaimer.
9− * Redistributions in binary form must reproduce the above
10−copyright notice, this list of conditions and the following disclaimer
11−in the documentation and/or other materials provided with the
12−distribution.
13− * Neither the name of Google Inc. nor the names of its
14−contributors may be used to endorse or promote products derived from
15−this software without specific prior written permission.
16−
17−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vendor/golang.org/x/sys/PATENTSdeleted−22
@@ -1,22 +0,0 @@
1−Additional IP Rights Grant (Patents)
2−
3−"This implementation" means the copyrightable works distributed by
4−Google as part of the Go project.
5−
6−Google hereby grants to You a perpetual, worldwide, non-exclusive,
7−no-charge, royalty-free, irrevocable (except as stated in this section)
8−patent license to make, have made, use, offer to sell, sell, import,
9−transfer and otherwise run, modify and propagate the contents of this
10−implementation of Go, where such license applies only to those patent
11−claims, both currently owned or controlled by Google and acquired in
12−the future, licensable by Google that are necessarily infringed by this
13−implementation of Go. This grant does not include claims that would be
14−infringed only as a consequence of further modification of this
15−implementation. If you or your agent or exclusive licensee institute or
16−order or agree to the institution of patent litigation against any
17−entity (including a cross-claim or counterclaim in a lawsuit) alleging
18−that this implementation of Go or any code incorporated within this
19−implementation of Go constitutes direct or contributory patent
20−infringement, or inducement of patent infringement, then any patent
21−rights granted to you under this License for this implementation of Go
22−shall terminate as of the date such litigation is filed.
vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.godeleted−30
@@ -1,30 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Package unsafeheader contains header declarations for the Go runtime's
6−// slice and string implementations.
7−//
8−// This package allows x/sys to use types equivalent to
9−// reflect.SliceHeader and reflect.StringHeader without introducing
10−// a dependency on the (relatively heavy) "reflect" package.
11−package unsafeheader
12−
13−import (
14− "unsafe"
15−)
16−
17−// Slice is the runtime representation of a slice.
18−// It cannot be used safely or portably and its representation may change in a later release.
19−type Slice struct {
20− Data unsafe.Pointer
21− Len int
22− Cap int
23−}
24−
25−// String is the runtime representation of a string.
26−// It cannot be used safely or portably and its representation may change in a later release.
27−type String struct {
28− Data unsafe.Pointer
29− Len int
30−}
vendor/golang.org/x/sys/unix/.gitignoredeleted−2
@@ -1,2 +0,0 @@
1−_obj/
2−unix.test
vendor/golang.org/x/sys/unix/README.mddeleted−184
@@ -1,184 +0,0 @@
1−# Building `sys/unix`
2−
3−The sys/unix package provides access to the raw system call interface of the
4−underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
5−
6−Porting Go to a new architecture/OS combination or adding syscalls, types, or
7−constants to an existing architecture/OS pair requires some manual effort;
8−however, there are tools that automate much of the process.
9−
10−## Build Systems
11−
12−There are currently two ways we generate the necessary files. We are currently
13−migrating the build system to use containers so the builds are reproducible.
14−This is being done on an OS-by-OS basis. Please update this documentation as
15−components of the build system change.
16−
17−### Old Build System (currently for `GOOS != "linux"`)
18−
19−The old build system generates the Go files based on the C header files
20−present on your system. This means that files
21−for a given GOOS/GOARCH pair must be generated on a system with that OS and
22−architecture. This also means that the generated code can differ from system
23−to system, based on differences in the header files.
24−
25−To avoid this, if you are using the old build system, only generate the Go
26−files on an installation with unmodified header files. It is also important to
27−keep track of which version of the OS the files were generated from (ex.
28−Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
29−and have each OS upgrade correspond to a single change.
30−
31−To build the files for your current OS and architecture, make sure GOOS and
32−GOARCH are set correctly and run `mkall.sh`. This will generate the files for
33−your specific system. Running `mkall.sh -n` shows the commands that will be run.
34−
35−Requirements: bash, go
36−
37−### New Build System (currently for `GOOS == "linux"`)
38−
39−The new build system uses a Docker container to generate the go files directly
40−from source checkouts of the kernel and various system libraries. This means
41−that on any platform that supports Docker, all the files using the new build
42−system can be generated at once, and generated files will not change based on
43−what the person running the scripts has installed on their computer.
44−
45−The OS specific files for the new build system are located in the `${GOOS}`
46−directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
47−the kernel or system library updates, modify the Dockerfile at
48−`${GOOS}/Dockerfile` to checkout the new release of the source.
49−
50−To build all the files under the new build system, you must be on an amd64/Linux
51−system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
52−then generate all of the files for all of the GOOS/GOARCH pairs in the new build
53−system. Running `mkall.sh -n` shows the commands that will be run.
54−
55−Requirements: bash, go, docker
56−
57−## Component files
58−
59−This section describes the various files used in the code generation process.
60−It also contains instructions on how to modify these files to add a new
61−architecture/OS or to add additional syscalls, types, or constants. Note that
62−if you are using the new build system, the scripts/programs cannot be called normally.
63−They must be called from within the docker container.
64−
65−### asm files
66−
67−The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
68−call dispatch. There are three entry points:
69−```
70− func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
71− func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
72− func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
73−```
74−The first and second are the standard ones; they differ only in how many
75−arguments can be passed to the kernel. The third is for low-level use by the
76−ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
77−let it know that a system call is running.
78−
79−When porting Go to an new architecture/OS, this file must be implemented for
80−each GOOS/GOARCH pair.
81−
82−### mksysnum
83−
84−Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
85−for the old system). This program takes in a list of header files containing the
86−syscall number declarations and parses them to produce the corresponding list of
87−Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
88−constants.
89−
90−Adding new syscall numbers is mostly done by running the build on a sufficiently
91−new installation of the target OS (or updating the source checkouts for the
92−new build system). However, depending on the OS, you may need to update the
93−parsing in mksysnum.
94−
95−### mksyscall.go
96−
97−The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
98−hand-written Go files which implement system calls (for unix, the specific OS,
99−or the specific OS/Architecture pair respectively) that need special handling
100−and list `//sys` comments giving prototypes for ones that can be generated.
101−
102−The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts
103−them into syscalls. This requires the name of the prototype in the comment to
104−match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
105−prototype can be exported (capitalized) or not.
106−
107−Adding a new syscall often just requires adding a new `//sys` function prototype
108−with the desired arguments and a capitalized name so it is exported. However, if
109−you want the interface to the syscall to be different, often one will make an
110−unexported `//sys` prototype, an then write a custom wrapper in
111−`syscall_${GOOS}.go`.
112−
113−### types files
114−
115−For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
116−`types_${GOOS}.go` on the old system). This file includes standard C headers and
117−creates Go type aliases to the corresponding C types. The file is then fed
118−through godef to get the Go compatible definitions. Finally, the generated code
119−is fed though mkpost.go to format the code correctly and remove any hidden or
120−private identifiers. This cleaned-up code is written to
121−`ztypes_${GOOS}_${GOARCH}.go`.
122−
123−The hardest part about preparing this file is figuring out which headers to
124−include and which symbols need to be `#define`d to get the actual data
125−structures that pass through to the kernel system calls. Some C libraries
126−preset alternate versions for binary compatibility and translate them on the
127−way in and out of system calls, but there is almost always a `#define` that can
128−get the real ones.
129−See `types_darwin.go` and `linux/types.go` for examples.
130−
131−To add a new type, add in the necessary include statement at the top of the
132−file (if it is not already there) and add in a type alias line. Note that if
133−your type is significantly different on different architectures, you may need
134−some `#if/#elif` macros in your include statements.
135−
136−### mkerrors.sh
137−
138−This script is used to generate the system's various constants. This doesn't
139−just include the error numbers and error strings, but also the signal numbers
140−an a wide variety of miscellaneous constants. The constants come from the list
141−of include files in the `includes_${uname}` variable. A regex then picks out
142−the desired `#define` statements, and generates the corresponding Go constants.
143−The error numbers and strings are generated from `#include <errno.h>`, and the
144−signal numbers and strings are generated from `#include <signal.h>`. All of
145−these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
146−`_errors.c`, which prints out all the constants.
147−
148−To add a constant, add the header that includes it to the appropriate variable.
149−Then, edit the regex (if necessary) to match the desired constant. Avoid making
150−the regex too broad to avoid matching unintended constants.
151−
152−### mkmerge.go
153−
154−This program is used to extract duplicate const, func, and type declarations
155−from the generated architecture-specific files listed below, and merge these
156−into a common file for each OS.
157−
158−The merge is performed in the following steps:
159−1. Construct the set of common code that is idential in all architecture-specific files.
160−2. Write this common code to the merged file.
161−3. Remove the common code from all architecture-specific files.
162−
163−
164−## Generated files
165−
166−### `zerrors_${GOOS}_${GOARCH}.go`
167−
168−A file containing all of the system's generated error numbers, error strings,
169−signal numbers, and constants. Generated by `mkerrors.sh` (see above).
170−
171−### `zsyscall_${GOOS}_${GOARCH}.go`
172−
173−A file containing all the generated syscalls for a specific GOOS and GOARCH.
174−Generated by `mksyscall.go` (see above).
175−
176−### `zsysnum_${GOOS}_${GOARCH}.go`
177−
178−A list of numeric constants for all the syscall number of the specific GOOS
179−and GOARCH. Generated by mksysnum (see above).
180−
181−### `ztypes_${GOOS}_${GOARCH}.go`
182−
183−A file containing Go types for passing into (or returning from) syscalls.
184−Generated by godefs and the types file (see above).
vendor/golang.org/x/sys/unix/affinity_linux.godeleted−86
@@ -1,86 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// CPU affinity functions
6−
7−package unix
8−
9−import (
10− "math/bits"
11− "unsafe"
12−)
13−
14−const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
15−
16−// CPUSet represents a CPU affinity mask.
17−type CPUSet [cpuSetSize]cpuMask
18−
19−func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
20− _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
21− if e != 0 {
22− return errnoErr(e)
23− }
24− return nil
25−}
26−
27−// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
28−// If pid is 0 the calling thread is used.
29−func SchedGetaffinity(pid int, set *CPUSet) error {
30− return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
31−}
32−
33−// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
34−// If pid is 0 the calling thread is used.
35−func SchedSetaffinity(pid int, set *CPUSet) error {
36− return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
37−}
38−
39−// Zero clears the set s, so that it contains no CPUs.
40−func (s *CPUSet) Zero() {
41− for i := range s {
42− s[i] = 0
43− }
44−}
45−
46−func cpuBitsIndex(cpu int) int {
47− return cpu / _NCPUBITS
48−}
49−
50−func cpuBitsMask(cpu int) cpuMask {
51− return cpuMask(1 << (uint(cpu) % _NCPUBITS))
52−}
53−
54−// Set adds cpu to the set s.
55−func (s *CPUSet) Set(cpu int) {
56− i := cpuBitsIndex(cpu)
57− if i < len(s) {
58− s[i] |= cpuBitsMask(cpu)
59− }
60−}
61−
62−// Clear removes cpu from the set s.
63−func (s *CPUSet) Clear(cpu int) {
64− i := cpuBitsIndex(cpu)
65− if i < len(s) {
66− s[i] &^= cpuBitsMask(cpu)
67− }
68−}
69−
70−// IsSet reports whether cpu is in the set s.
71−func (s *CPUSet) IsSet(cpu int) bool {
72− i := cpuBitsIndex(cpu)
73− if i < len(s) {
74− return s[i]&cpuBitsMask(cpu) != 0
75− }
76− return false
77−}
78−
79−// Count returns the number of CPUs in the set s.
80−func (s *CPUSet) Count() int {
81− c := 0
82− for _, b := range s {
83− c += bits.OnesCount64(uint64(b))
84− }
85− return c
86−}
vendor/golang.org/x/sys/unix/aliases.godeleted−15
@@ -1,15 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
7−// +build go1.9
8−
9−package unix
10−
11−import "syscall"
12−
13−type Signal = syscall.Signal
14−type Errno = syscall.Errno
15−type SysProcAttr = syscall.SysProcAttr
vendor/golang.org/x/sys/unix/asm_aix_ppc64.sdeleted−17
@@ -1,17 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gc
6−
7−#include "textflag.h"
8−
9−//
10−// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go
11−//
12−
13−TEXT ·syscall6(SB),NOSPLIT,$0-88
14− JMP syscall·syscall6(SB)
15−
16−TEXT ·rawSyscall6(SB),NOSPLIT,$0-88
17− JMP syscall·rawSyscall6(SB)
vendor/golang.org/x/sys/unix/asm_bsd_386.sdeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2021 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (darwin || freebsd || netbsd || openbsd) && gc
6−// +build darwin freebsd netbsd openbsd
7−// +build gc
8−
9−#include "textflag.h"
10−
11−// System call support for 386 BSD
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-28
17− JMP syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-40
20− JMP syscall·Syscall6(SB)
21−
22−TEXT ·Syscall9(SB),NOSPLIT,$0-52
23− JMP syscall·Syscall9(SB)
24−
25−TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26− JMP syscall·RawSyscall(SB)
27−
28−TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29− JMP syscall·RawSyscall6(SB)
vendor/golang.org/x/sys/unix/asm_bsd_amd64.sdeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2021 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
6−// +build darwin dragonfly freebsd netbsd openbsd
7−// +build gc
8−
9−#include "textflag.h"
10−
11−// System call support for AMD64 BSD
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-56
17− JMP syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-80
20− JMP syscall·Syscall6(SB)
21−
22−TEXT ·Syscall9(SB),NOSPLIT,$0-104
23− JMP syscall·Syscall9(SB)
24−
25−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26− JMP syscall·RawSyscall(SB)
27−
28−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29− JMP syscall·RawSyscall6(SB)
vendor/golang.org/x/sys/unix/asm_bsd_arm.sdeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2021 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (darwin || freebsd || netbsd || openbsd) && gc
6−// +build darwin freebsd netbsd openbsd
7−// +build gc
8−
9−#include "textflag.h"
10−
11−// System call support for ARM BSD
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-28
17− B syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-40
20− B syscall·Syscall6(SB)
21−
22−TEXT ·Syscall9(SB),NOSPLIT,$0-52
23− B syscall·Syscall9(SB)
24−
25−TEXT ·RawSyscall(SB),NOSPLIT,$0-28
26− B syscall·RawSyscall(SB)
27−
28−TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
29− B syscall·RawSyscall6(SB)
vendor/golang.org/x/sys/unix/asm_bsd_arm64.sdeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2021 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (darwin || freebsd || netbsd || openbsd) && gc
6−// +build darwin freebsd netbsd openbsd
7−// +build gc
8−
9−#include "textflag.h"
10−
11−// System call support for ARM64 BSD
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-56
17− JMP syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-80
20− JMP syscall·Syscall6(SB)
21−
22−TEXT ·Syscall9(SB),NOSPLIT,$0-104
23− JMP syscall·Syscall9(SB)
24−
25−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26− JMP syscall·RawSyscall(SB)
27−
28−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29− JMP syscall·RawSyscall6(SB)
vendor/golang.org/x/sys/unix/asm_linux_386.sdeleted−65
@@ -1,65 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gc
6−
7−#include "textflag.h"
8−
9−//
10−// System calls for 386, Linux
11−//
12−
13−// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
14−// instead of the glibc-specific "CALL 0x10(GS)".
15−#define INVOKE_SYSCALL INT $0x80
16−
17−// Just jump to package syscall's implementation for all these functions.
18−// The runtime may know about them.
19−
20−TEXT ·Syscall(SB),NOSPLIT,$0-28
21− JMP syscall·Syscall(SB)
22−
23−TEXT ·Syscall6(SB),NOSPLIT,$0-40
24− JMP syscall·Syscall6(SB)
25−
26−TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
27− CALL runtime·entersyscall(SB)
28− MOVL trap+0(FP), AX // syscall entry
29− MOVL a1+4(FP), BX
30− MOVL a2+8(FP), CX
31− MOVL a3+12(FP), DX
32− MOVL $0, SI
33− MOVL $0, DI
34− INVOKE_SYSCALL
35− MOVL AX, r1+16(FP)
36− MOVL DX, r2+20(FP)
37− CALL runtime·exitsyscall(SB)
38− RET
39−
40−TEXT ·RawSyscall(SB),NOSPLIT,$0-28
41− JMP syscall·RawSyscall(SB)
42−
43−TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
44− JMP syscall·RawSyscall6(SB)
45−
46−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
47− MOVL trap+0(FP), AX // syscall entry
48− MOVL a1+4(FP), BX
49− MOVL a2+8(FP), CX
50− MOVL a3+12(FP), DX
51− MOVL $0, SI
52− MOVL $0, DI
53− INVOKE_SYSCALL
54− MOVL AX, r1+16(FP)
55− MOVL DX, r2+20(FP)
56− RET
57−
58−TEXT ·socketcall(SB),NOSPLIT,$0-36
59− JMP syscall·socketcall(SB)
60−
61−TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
62− JMP syscall·rawsocketcall(SB)
63−
64−TEXT ·seek(SB),NOSPLIT,$0-28
65− JMP syscall·seek(SB)
vendor/golang.org/x/sys/unix/asm_linux_amd64.sdeleted−57
@@ -1,57 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gc
6−
7−#include "textflag.h"
8−
9−//
10−// System calls for AMD64, Linux
11−//
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-56
17− JMP syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-80
20− JMP syscall·Syscall6(SB)
21−
22−TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
23− CALL runtime·entersyscall(SB)
24− MOVQ a1+8(FP), DI
25− MOVQ a2+16(FP), SI
26− MOVQ a3+24(FP), DX
27− MOVQ $0, R10
28− MOVQ $0, R8
29− MOVQ $0, R9
30− MOVQ trap+0(FP), AX // syscall entry
31− SYSCALL
32− MOVQ AX, r1+32(FP)
33− MOVQ DX, r2+40(FP)
34− CALL runtime·exitsyscall(SB)
35− RET
36−
37−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
38− JMP syscall·RawSyscall(SB)
39−
40−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
41− JMP syscall·RawSyscall6(SB)
42−
43−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
44− MOVQ a1+8(FP), DI
45− MOVQ a2+16(FP), SI
46− MOVQ a3+24(FP), DX
47− MOVQ $0, R10
48− MOVQ $0, R8
49− MOVQ $0, R9
50− MOVQ trap+0(FP), AX // syscall entry
51− SYSCALL
52− MOVQ AX, r1+32(FP)
53− MOVQ DX, r2+40(FP)
54− RET
55−
56−TEXT ·gettimeofday(SB),NOSPLIT,$0-16
57− JMP syscall·gettimeofday(SB)
vendor/golang.org/x/sys/unix/asm_linux_arm.sdeleted−56
@@ -1,56 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gc
6−
7−#include "textflag.h"
8−
9−//
10−// System calls for arm, Linux
11−//
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-28
17− B syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-40
20− B syscall·Syscall6(SB)
21−
22−TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
23− BL runtime·entersyscall(SB)
24− MOVW trap+0(FP), R7
25− MOVW a1+4(FP), R0
26− MOVW a2+8(FP), R1
27− MOVW a3+12(FP), R2
28− MOVW $0, R3
29− MOVW $0, R4
30− MOVW $0, R5
31− SWI $0
32− MOVW R0, r1+16(FP)
33− MOVW $0, R0
34− MOVW R0, r2+20(FP)
35− BL runtime·exitsyscall(SB)
36− RET
37−
38−TEXT ·RawSyscall(SB),NOSPLIT,$0-28
39− B syscall·RawSyscall(SB)
40−
41−TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
42− B syscall·RawSyscall6(SB)
43−
44−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
45− MOVW trap+0(FP), R7 // syscall entry
46− MOVW a1+4(FP), R0
47− MOVW a2+8(FP), R1
48− MOVW a3+12(FP), R2
49− SWI $0
50− MOVW R0, r1+16(FP)
51− MOVW $0, R0
52− MOVW R0, r2+20(FP)
53− RET
54−
55−TEXT ·seek(SB),NOSPLIT,$0-28
56− B syscall·seek(SB)
vendor/golang.org/x/sys/unix/asm_linux_arm64.sdeleted−52
@@ -1,52 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build linux
6−// +build arm64
7−// +build gc
8−
9−#include "textflag.h"
10−
11−// Just jump to package syscall's implementation for all these functions.
12−// The runtime may know about them.
13−
14−TEXT ·Syscall(SB),NOSPLIT,$0-56
15− B syscall·Syscall(SB)
16−
17−TEXT ·Syscall6(SB),NOSPLIT,$0-80
18− B syscall·Syscall6(SB)
19−
20−TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
21− BL runtime·entersyscall(SB)
22− MOVD a1+8(FP), R0
23− MOVD a2+16(FP), R1
24− MOVD a3+24(FP), R2
25− MOVD $0, R3
26− MOVD $0, R4
27− MOVD $0, R5
28− MOVD trap+0(FP), R8 // syscall entry
29− SVC
30− MOVD R0, r1+32(FP) // r1
31− MOVD R1, r2+40(FP) // r2
32− BL runtime·exitsyscall(SB)
33− RET
34−
35−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
36− B syscall·RawSyscall(SB)
37−
38−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
39− B syscall·RawSyscall6(SB)
40−
41−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
42− MOVD a1+8(FP), R0
43− MOVD a2+16(FP), R1
44− MOVD a3+24(FP), R2
45− MOVD $0, R3
46− MOVD $0, R4
47− MOVD $0, R5
48− MOVD trap+0(FP), R8 // syscall entry
49− SVC
50− MOVD R0, r1+32(FP)
51− MOVD R1, r2+40(FP)
52− RET
vendor/golang.org/x/sys/unix/asm_linux_mips64x.sdeleted−56
@@ -1,56 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build linux
6−// +build mips64 mips64le
7−// +build gc
8−
9−#include "textflag.h"
10−
11−//
12−// System calls for mips64, Linux
13−//
14−
15−// Just jump to package syscall's implementation for all these functions.
16−// The runtime may know about them.
17−
18−TEXT ·Syscall(SB),NOSPLIT,$0-56
19− JMP syscall·Syscall(SB)
20−
21−TEXT ·Syscall6(SB),NOSPLIT,$0-80
22− JMP syscall·Syscall6(SB)
23−
24−TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
25− JAL runtime·entersyscall(SB)
26− MOVV a1+8(FP), R4
27− MOVV a2+16(FP), R5
28− MOVV a3+24(FP), R6
29− MOVV R0, R7
30− MOVV R0, R8
31− MOVV R0, R9
32− MOVV trap+0(FP), R2 // syscall entry
33− SYSCALL
34− MOVV R2, r1+32(FP)
35− MOVV R3, r2+40(FP)
36− JAL runtime·exitsyscall(SB)
37− RET
38−
39−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
40− JMP syscall·RawSyscall(SB)
41−
42−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
43− JMP syscall·RawSyscall6(SB)
44−
45−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
46− MOVV a1+8(FP), R4
47− MOVV a2+16(FP), R5
48− MOVV a3+24(FP), R6
49− MOVV R0, R7
50− MOVV R0, R8
51− MOVV R0, R9
52− MOVV trap+0(FP), R2 // syscall entry
53− SYSCALL
54− MOVV R2, r1+32(FP)
55− MOVV R3, r2+40(FP)
56− RET
vendor/golang.org/x/sys/unix/asm_linux_mipsx.sdeleted−54
@@ -1,54 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build linux
6−// +build mips mipsle
7−// +build gc
8−
9−#include "textflag.h"
10−
11−//
12−// System calls for mips, Linux
13−//
14−
15−// Just jump to package syscall's implementation for all these functions.
16−// The runtime may know about them.
17−
18−TEXT ·Syscall(SB),NOSPLIT,$0-28
19− JMP syscall·Syscall(SB)
20−
21−TEXT ·Syscall6(SB),NOSPLIT,$0-40
22− JMP syscall·Syscall6(SB)
23−
24−TEXT ·Syscall9(SB),NOSPLIT,$0-52
25− JMP syscall·Syscall9(SB)
26−
27−TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
28− JAL runtime·entersyscall(SB)
29− MOVW a1+4(FP), R4
30− MOVW a2+8(FP), R5
31− MOVW a3+12(FP), R6
32− MOVW R0, R7
33− MOVW trap+0(FP), R2 // syscall entry
34− SYSCALL
35− MOVW R2, r1+16(FP) // r1
36− MOVW R3, r2+20(FP) // r2
37− JAL runtime·exitsyscall(SB)
38− RET
39−
40−TEXT ·RawSyscall(SB),NOSPLIT,$0-28
41− JMP syscall·RawSyscall(SB)
42−
43−TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
44− JMP syscall·RawSyscall6(SB)
45−
46−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
47− MOVW a1+4(FP), R4
48− MOVW a2+8(FP), R5
49− MOVW a3+12(FP), R6
50− MOVW trap+0(FP), R2 // syscall entry
51− SYSCALL
52− MOVW R2, r1+16(FP)
53− MOVW R3, r2+20(FP)
54− RET
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.sdeleted−44
@@ -1,44 +0,0 @@
1−// Copyright 2014 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build linux
6−// +build ppc64 ppc64le
7−// +build gc
8−
9−#include "textflag.h"
10−
11−//
12−// System calls for ppc64, Linux
13−//
14−
15−// Just jump to package syscall's implementation for all these functions.
16−// The runtime may know about them.
17−
18−TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
19− BL runtime·entersyscall(SB)
20− MOVD a1+8(FP), R3
21− MOVD a2+16(FP), R4
22− MOVD a3+24(FP), R5
23− MOVD R0, R6
24− MOVD R0, R7
25− MOVD R0, R8
26− MOVD trap+0(FP), R9 // syscall entry
27− SYSCALL R9
28− MOVD R3, r1+32(FP)
29− MOVD R4, r2+40(FP)
30− BL runtime·exitsyscall(SB)
31− RET
32−
33−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
34− MOVD a1+8(FP), R3
35− MOVD a2+16(FP), R4
36− MOVD a3+24(FP), R5
37− MOVD R0, R6
38− MOVD R0, R7
39− MOVD R0, R8
40− MOVD trap+0(FP), R9 // syscall entry
41− SYSCALL R9
42− MOVD R3, r1+32(FP)
43− MOVD R4, r2+40(FP)
44− RET
vendor/golang.org/x/sys/unix/asm_linux_riscv64.sdeleted−47
@@ -1,47 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build riscv64,gc
6−
7−#include "textflag.h"
8−
9−//
10−// System calls for linux/riscv64.
11−//
12−// Where available, just jump to package syscall's implementation of
13−// these functions.
14−
15−TEXT ·Syscall(SB),NOSPLIT,$0-56
16− JMP syscall·Syscall(SB)
17−
18−TEXT ·Syscall6(SB),NOSPLIT,$0-80
19− JMP syscall·Syscall6(SB)
20−
21−TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
22− CALL runtime·entersyscall(SB)
23− MOV a1+8(FP), A0
24− MOV a2+16(FP), A1
25− MOV a3+24(FP), A2
26− MOV trap+0(FP), A7 // syscall entry
27− ECALL
28− MOV A0, r1+32(FP) // r1
29− MOV A1, r2+40(FP) // r2
30− CALL runtime·exitsyscall(SB)
31− RET
32−
33−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
34− JMP syscall·RawSyscall(SB)
35−
36−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
37− JMP syscall·RawSyscall6(SB)
38−
39−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
40− MOV a1+8(FP), A0
41− MOV a2+16(FP), A1
42− MOV a3+24(FP), A2
43− MOV trap+0(FP), A7 // syscall entry
44− ECALL
45− MOV A0, r1+32(FP)
46− MOV A1, r2+40(FP)
47− RET
vendor/golang.org/x/sys/unix/asm_linux_s390x.sdeleted−56
@@ -1,56 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build s390x
6−// +build linux
7−// +build gc
8−
9−#include "textflag.h"
10−
11−//
12−// System calls for s390x, Linux
13−//
14−
15−// Just jump to package syscall's implementation for all these functions.
16−// The runtime may know about them.
17−
18−TEXT ·Syscall(SB),NOSPLIT,$0-56
19− BR syscall·Syscall(SB)
20−
21−TEXT ·Syscall6(SB),NOSPLIT,$0-80
22− BR syscall·Syscall6(SB)
23−
24−TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
25− BL runtime·entersyscall(SB)
26− MOVD a1+8(FP), R2
27− MOVD a2+16(FP), R3
28− MOVD a3+24(FP), R4
29− MOVD $0, R5
30− MOVD $0, R6
31− MOVD $0, R7
32− MOVD trap+0(FP), R1 // syscall entry
33− SYSCALL
34− MOVD R2, r1+32(FP)
35− MOVD R3, r2+40(FP)
36− BL runtime·exitsyscall(SB)
37− RET
38−
39−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
40− BR syscall·RawSyscall(SB)
41−
42−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
43− BR syscall·RawSyscall6(SB)
44−
45−TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
46− MOVD a1+8(FP), R2
47− MOVD a2+16(FP), R3
48− MOVD a3+24(FP), R4
49− MOVD $0, R5
50− MOVD $0, R6
51− MOVD $0, R7
52− MOVD trap+0(FP), R1 // syscall entry
53− SYSCALL
54− MOVD R2, r1+32(FP)
55− MOVD R3, r2+40(FP)
56− RET
vendor/golang.org/x/sys/unix/asm_openbsd_mips64.sdeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gc
6−
7−#include "textflag.h"
8−
9−//
10−// System call support for mips64, OpenBSD
11−//
12−
13−// Just jump to package syscall's implementation for all these functions.
14−// The runtime may know about them.
15−
16−TEXT ·Syscall(SB),NOSPLIT,$0-56
17− JMP syscall·Syscall(SB)
18−
19−TEXT ·Syscall6(SB),NOSPLIT,$0-80
20− JMP syscall·Syscall6(SB)
21−
22−TEXT ·Syscall9(SB),NOSPLIT,$0-104
23− JMP syscall·Syscall9(SB)
24−
25−TEXT ·RawSyscall(SB),NOSPLIT,$0-56
26− JMP syscall·RawSyscall(SB)
27−
28−TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
29− JMP syscall·RawSyscall6(SB)
vendor/golang.org/x/sys/unix/asm_solaris_amd64.sdeleted−17
@@ -1,17 +0,0 @@
1−// Copyright 2014 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gc
6−
7−#include "textflag.h"
8−
9−//
10−// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
11−//
12−
13−TEXT ·sysvicall6(SB),NOSPLIT,$0-88
14− JMP syscall·sysvicall6(SB)
15−
16−TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
17− JMP syscall·rawSysvicall6(SB)
vendor/golang.org/x/sys/unix/asm_zos_s390x.sdeleted−426
@@ -1,426 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build zos && s390x && gc
6−// +build zos
7−// +build s390x
8−// +build gc
9−
10−#include "textflag.h"
11−
12−#define PSALAA 1208(R0)
13−#define GTAB64(x) 80(x)
14−#define LCA64(x) 88(x)
15−#define CAA(x) 8(x)
16−#define EDCHPXV(x) 1016(x) // in the CAA
17−#define SAVSTACK_ASYNC(x) 336(x) // in the LCA
18−
19−// SS_*, where x=SAVSTACK_ASYNC
20−#define SS_LE(x) 0(x)
21−#define SS_GO(x) 8(x)
22−#define SS_ERRNO(x) 16(x)
23−#define SS_ERRNOJR(x) 20(x)
24−
25−#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6
26−
27−TEXT ·clearErrno(SB),NOSPLIT,$0-0
28− BL addrerrno<>(SB)
29− MOVD $0, 0(R3)
30− RET
31−
32−// Returns the address of errno in R3.
33−TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0
34− // Get library control area (LCA).
35− MOVW PSALAA, R8
36− MOVD LCA64(R8), R8
37−
38− // Get __errno FuncDesc.
39− MOVD CAA(R8), R9
40− MOVD EDCHPXV(R9), R9
41− ADD $(0x156*16), R9
42− LMG 0(R9), R5, R6
43−
44− // Switch to saved LE stack.
45− MOVD SAVSTACK_ASYNC(R8), R9
46− MOVD 0(R9), R4
47− MOVD $0, 0(R9)
48−
49− // Call __errno function.
50− LE_CALL
51− NOPH
52−
53− // Switch back to Go stack.
54− XOR R0, R0 // Restore R0 to $0.
55− MOVD R4, 0(R9) // Save stack pointer.
56− RET
57−
58−TEXT ·syscall_syscall(SB),NOSPLIT,$0-56
59− BL runtime·entersyscall(SB)
60− MOVD a1+8(FP), R1
61− MOVD a2+16(FP), R2
62− MOVD a3+24(FP), R3
63−
64− // Get library control area (LCA).
65− MOVW PSALAA, R8
66− MOVD LCA64(R8), R8
67−
68− // Get function.
69− MOVD CAA(R8), R9
70− MOVD EDCHPXV(R9), R9
71− MOVD trap+0(FP), R5
72− SLD $4, R5
73− ADD R5, R9
74− LMG 0(R9), R5, R6
75−
76− // Restore LE stack.
77− MOVD SAVSTACK_ASYNC(R8), R9
78− MOVD 0(R9), R4
79− MOVD $0, 0(R9)
80−
81− // Call function.
82− LE_CALL
83− NOPH
84− XOR R0, R0 // Restore R0 to $0.
85− MOVD R4, 0(R9) // Save stack pointer.
86−
87− MOVD R3, r1+32(FP)
88− MOVD R0, r2+40(FP)
89− MOVD R0, err+48(FP)
90− MOVW R3, R4
91− CMP R4, $-1
92− BNE done
93− BL addrerrno<>(SB)
94− MOVWZ 0(R3), R3
95− MOVD R3, err+48(FP)
96−done:
97− BL runtime·exitsyscall(SB)
98− RET
99−
100−TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56
101− MOVD a1+8(FP), R1
102− MOVD a2+16(FP), R2
103− MOVD a3+24(FP), R3
104−
105− // Get library control area (LCA).
106− MOVW PSALAA, R8
107− MOVD LCA64(R8), R8
108−
109− // Get function.
110− MOVD CAA(R8), R9
111− MOVD EDCHPXV(R9), R9
112− MOVD trap+0(FP), R5
113− SLD $4, R5
114− ADD R5, R9
115− LMG 0(R9), R5, R6
116−
117− // Restore LE stack.
118− MOVD SAVSTACK_ASYNC(R8), R9
119− MOVD 0(R9), R4
120− MOVD $0, 0(R9)
121−
122− // Call function.
123− LE_CALL
124− NOPH
125− XOR R0, R0 // Restore R0 to $0.
126− MOVD R4, 0(R9) // Save stack pointer.
127−
128− MOVD R3, r1+32(FP)
129− MOVD R0, r2+40(FP)
130− MOVD R0, err+48(FP)
131− MOVW R3, R4
132− CMP R4, $-1
133− BNE done
134− BL addrerrno<>(SB)
135− MOVWZ 0(R3), R3
136− MOVD R3, err+48(FP)
137−done:
138− RET
139−
140−TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80
141− BL runtime·entersyscall(SB)
142− MOVD a1+8(FP), R1
143− MOVD a2+16(FP), R2
144− MOVD a3+24(FP), R3
145−
146− // Get library control area (LCA).
147− MOVW PSALAA, R8
148− MOVD LCA64(R8), R8
149−
150− // Get function.
151− MOVD CAA(R8), R9
152− MOVD EDCHPXV(R9), R9
153− MOVD trap+0(FP), R5
154− SLD $4, R5
155− ADD R5, R9
156− LMG 0(R9), R5, R6
157−
158− // Restore LE stack.
159− MOVD SAVSTACK_ASYNC(R8), R9
160− MOVD 0(R9), R4
161− MOVD $0, 0(R9)
162−
163− // Fill in parameter list.
164− MOVD a4+32(FP), R12
165− MOVD R12, (2176+24)(R4)
166− MOVD a5+40(FP), R12
167− MOVD R12, (2176+32)(R4)
168− MOVD a6+48(FP), R12
169− MOVD R12, (2176+40)(R4)
170−
171− // Call function.
172− LE_CALL
173− NOPH
174− XOR R0, R0 // Restore R0 to $0.
175− MOVD R4, 0(R9) // Save stack pointer.
176−
177− MOVD R3, r1+56(FP)
178− MOVD R0, r2+64(FP)
179− MOVD R0, err+72(FP)
180− MOVW R3, R4
181− CMP R4, $-1
182− BNE done
183− BL addrerrno<>(SB)
184− MOVWZ 0(R3), R3
185− MOVD R3, err+72(FP)
186−done:
187− BL runtime·exitsyscall(SB)
188− RET
189−
190−TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80
191− MOVD a1+8(FP), R1
192− MOVD a2+16(FP), R2
193− MOVD a3+24(FP), R3
194−
195− // Get library control area (LCA).
196− MOVW PSALAA, R8
197− MOVD LCA64(R8), R8
198−
199− // Get function.
200− MOVD CAA(R8), R9
201− MOVD EDCHPXV(R9), R9
202− MOVD trap+0(FP), R5
203− SLD $4, R5
204− ADD R5, R9
205− LMG 0(R9), R5, R6
206−
207− // Restore LE stack.
208− MOVD SAVSTACK_ASYNC(R8), R9
209− MOVD 0(R9), R4
210− MOVD $0, 0(R9)
211−
212− // Fill in parameter list.
213− MOVD a4+32(FP), R12
214− MOVD R12, (2176+24)(R4)
215− MOVD a5+40(FP), R12
216− MOVD R12, (2176+32)(R4)
217− MOVD a6+48(FP), R12
218− MOVD R12, (2176+40)(R4)
219−
220− // Call function.
221− LE_CALL
222− NOPH
223− XOR R0, R0 // Restore R0 to $0.
224− MOVD R4, 0(R9) // Save stack pointer.
225−
226− MOVD R3, r1+56(FP)
227− MOVD R0, r2+64(FP)
228− MOVD R0, err+72(FP)
229− MOVW R3, R4
230− CMP R4, $-1
231− BNE done
232− BL ·rrno<>(SB)
233− MOVWZ 0(R3), R3
234− MOVD R3, err+72(FP)
235−done:
236− RET
237−
238−TEXT ·syscall_syscall9(SB),NOSPLIT,$0
239− BL runtime·entersyscall(SB)
240− MOVD a1+8(FP), R1
241− MOVD a2+16(FP), R2
242− MOVD a3+24(FP), R3
243−
244− // Get library control area (LCA).
245− MOVW PSALAA, R8
246− MOVD LCA64(R8), R8
247−
248− // Get function.
249− MOVD CAA(R8), R9
250− MOVD EDCHPXV(R9), R9
251− MOVD trap+0(FP), R5
252− SLD $4, R5
253− ADD R5, R9
254− LMG 0(R9), R5, R6
255−
256− // Restore LE stack.
257− MOVD SAVSTACK_ASYNC(R8), R9
258− MOVD 0(R9), R4
259− MOVD $0, 0(R9)
260−
261− // Fill in parameter list.
262− MOVD a4+32(FP), R12
263− MOVD R12, (2176+24)(R4)
264− MOVD a5+40(FP), R12
265− MOVD R12, (2176+32)(R4)
266− MOVD a6+48(FP), R12
267− MOVD R12, (2176+40)(R4)
268− MOVD a7+56(FP), R12
269− MOVD R12, (2176+48)(R4)
270− MOVD a8+64(FP), R12
271− MOVD R12, (2176+56)(R4)
272− MOVD a9+72(FP), R12
273− MOVD R12, (2176+64)(R4)
274−
275− // Call function.
276− LE_CALL
277− NOPH
278− XOR R0, R0 // Restore R0 to $0.
279− MOVD R4, 0(R9) // Save stack pointer.
280−
281− MOVD R3, r1+80(FP)
282− MOVD R0, r2+88(FP)
283− MOVD R0, err+96(FP)
284− MOVW R3, R4
285− CMP R4, $-1
286− BNE done
287− BL addrerrno<>(SB)
288− MOVWZ 0(R3), R3
289− MOVD R3, err+96(FP)
290−done:
291− BL runtime·exitsyscall(SB)
292− RET
293−
294−TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0
295− MOVD a1+8(FP), R1
296− MOVD a2+16(FP), R2
297− MOVD a3+24(FP), R3
298−
299− // Get library control area (LCA).
300− MOVW PSALAA, R8
301− MOVD LCA64(R8), R8
302−
303− // Get function.
304− MOVD CAA(R8), R9
305− MOVD EDCHPXV(R9), R9
306− MOVD trap+0(FP), R5
307− SLD $4, R5
308− ADD R5, R9
309− LMG 0(R9), R5, R6
310−
311− // Restore LE stack.
312− MOVD SAVSTACK_ASYNC(R8), R9
313− MOVD 0(R9), R4
314− MOVD $0, 0(R9)
315−
316− // Fill in parameter list.
317− MOVD a4+32(FP), R12
318− MOVD R12, (2176+24)(R4)
319− MOVD a5+40(FP), R12
320− MOVD R12, (2176+32)(R4)
321− MOVD a6+48(FP), R12
322− MOVD R12, (2176+40)(R4)
323− MOVD a7+56(FP), R12
324− MOVD R12, (2176+48)(R4)
325− MOVD a8+64(FP), R12
326− MOVD R12, (2176+56)(R4)
327− MOVD a9+72(FP), R12
328− MOVD R12, (2176+64)(R4)
329−
330− // Call function.
331− LE_CALL
332− NOPH
333− XOR R0, R0 // Restore R0 to $0.
334− MOVD R4, 0(R9) // Save stack pointer.
335−
336− MOVD R3, r1+80(FP)
337− MOVD R0, r2+88(FP)
338− MOVD R0, err+96(FP)
339− MOVW R3, R4
340− CMP R4, $-1
341− BNE done
342− BL addrerrno<>(SB)
343− MOVWZ 0(R3), R3
344− MOVD R3, err+96(FP)
345−done:
346− RET
347−
348−// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64)
349−TEXT ·svcCall(SB),NOSPLIT,$0
350− BL runtime·save_g(SB) // Save g and stack pointer
351− MOVW PSALAA, R8
352− MOVD LCA64(R8), R8
353− MOVD SAVSTACK_ASYNC(R8), R9
354− MOVD R15, 0(R9)
355−
356− MOVD argv+8(FP), R1 // Move function arguments into registers
357− MOVD dsa+16(FP), g
358− MOVD fnptr+0(FP), R15
359−
360− BYTE $0x0D // Branch to function
361− BYTE $0xEF
362−
363− BL runtime·load_g(SB) // Restore g and stack pointer
364− MOVW PSALAA, R8
365− MOVD LCA64(R8), R8
366− MOVD SAVSTACK_ASYNC(R8), R9
367− MOVD 0(R9), R15
368−
369− RET
370−
371−// func svcLoad(name *byte) unsafe.Pointer
372−TEXT ·svcLoad(SB),NOSPLIT,$0
373− MOVD R15, R2 // Save go stack pointer
374− MOVD name+0(FP), R0 // Move SVC args into registers
375− MOVD $0x80000000, R1
376− MOVD $0, R15
377− BYTE $0x0A // SVC 08 LOAD
378− BYTE $0x08
379− MOVW R15, R3 // Save return code from SVC
380− MOVD R2, R15 // Restore go stack pointer
381− CMP R3, $0 // Check SVC return code
382− BNE error
383−
384− MOVD $-2, R3 // Reset last bit of entry point to zero
385− AND R0, R3
386− MOVD R3, addr+8(FP) // Return entry point returned by SVC
387− CMP R0, R3 // Check if last bit of entry point was set
388− BNE done
389−
390− MOVD R15, R2 // Save go stack pointer
391− MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08)
392− BYTE $0x0A // SVC 09 DELETE
393− BYTE $0x09
394− MOVD R2, R15 // Restore go stack pointer
395−
396−error:
397− MOVD $0, addr+8(FP) // Return 0 on failure
398−done:
399− XOR R0, R0 // Reset r0 to 0
400− RET
401−
402−// func svcUnload(name *byte, fnptr unsafe.Pointer) int64
403−TEXT ·svcUnload(SB),NOSPLIT,$0
404− MOVD R15, R2 // Save go stack pointer
405− MOVD name+0(FP), R0 // Move SVC args into registers
406− MOVD addr+8(FP), R15
407− BYTE $0x0A // SVC 09
408− BYTE $0x09
409− XOR R0, R0 // Reset r0 to 0
410− MOVD R15, R1 // Save SVC return code
411− MOVD R2, R15 // Restore go stack pointer
412− MOVD R1, rc+0(FP) // Return SVC return code
413− RET
414−
415−// func gettid() uint64
416−TEXT ·gettid(SB), NOSPLIT, $0
417− // Get library control area (LCA).
418− MOVW PSALAA, R8
419− MOVD LCA64(R8), R8
420−
421− // Get CEECAATHDID
422− MOVD CAA(R8), R9
423− MOVD 0x3D0(R9), R9
424− MOVD R9, ret+0(FP)
425−
426− RET
vendor/golang.org/x/sys/unix/bluetooth_linux.godeleted−36
@@ -1,36 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Bluetooth sockets and messages
6−
7−package unix
8−
9−// Bluetooth Protocols
10−const (
11− BTPROTO_L2CAP = 0
12− BTPROTO_HCI = 1
13− BTPROTO_SCO = 2
14− BTPROTO_RFCOMM = 3
15− BTPROTO_BNEP = 4
16− BTPROTO_CMTP = 5
17− BTPROTO_HIDP = 6
18− BTPROTO_AVDTP = 7
19−)
20−
21−const (
22− HCI_CHANNEL_RAW = 0
23− HCI_CHANNEL_USER = 1
24− HCI_CHANNEL_MONITOR = 2
25− HCI_CHANNEL_CONTROL = 3
26− HCI_CHANNEL_LOGGING = 4
27−)
28−
29−// Socketoption Level
30−const (
31− SOL_BLUETOOTH = 0x112
32− SOL_HCI = 0x0
33− SOL_L2CAP = 0x6
34− SOL_RFCOMM = 0x12
35− SOL_SCO = 0x11
36−)
vendor/golang.org/x/sys/unix/cap_freebsd.godeleted−196
@@ -1,196 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build freebsd
6−// +build freebsd
7−
8−package unix
9−
10−import (
11− "errors"
12− "fmt"
13−)
14−
15−// Go implementation of C mostly found in /usr/src/sys/kern/subr_capability.c
16−
17−const (
18− // This is the version of CapRights this package understands. See C implementation for parallels.
19− capRightsGoVersion = CAP_RIGHTS_VERSION_00
20− capArSizeMin = CAP_RIGHTS_VERSION_00 + 2
21− capArSizeMax = capRightsGoVersion + 2
22−)
23−
24−var (
25− bit2idx = []int{
26− -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1,
27− 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
28− }
29−)
30−
31−func capidxbit(right uint64) int {
32− return int((right >> 57) & 0x1f)
33−}
34−
35−func rightToIndex(right uint64) (int, error) {
36− idx := capidxbit(right)
37− if idx < 0 || idx >= len(bit2idx) {
38− return -2, fmt.Errorf("index for right 0x%x out of range", right)
39− }
40− return bit2idx[idx], nil
41−}
42−
43−func caprver(right uint64) int {
44− return int(right >> 62)
45−}
46−
47−func capver(rights *CapRights) int {
48− return caprver(rights.Rights[0])
49−}
50−
51−func caparsize(rights *CapRights) int {
52− return capver(rights) + 2
53−}
54−
55−// CapRightsSet sets the permissions in setrights in rights.
56−func CapRightsSet(rights *CapRights, setrights []uint64) error {
57− // This is essentially a copy of cap_rights_vset()
58− if capver(rights) != CAP_RIGHTS_VERSION_00 {
59− return fmt.Errorf("bad rights version %d", capver(rights))
60− }
61−
62− n := caparsize(rights)
63− if n < capArSizeMin || n > capArSizeMax {
64− return errors.New("bad rights size")
65− }
66−
67− for _, right := range setrights {
68− if caprver(right) != CAP_RIGHTS_VERSION_00 {
69− return errors.New("bad right version")
70− }
71− i, err := rightToIndex(right)
72− if err != nil {
73− return err
74− }
75− if i >= n {
76− return errors.New("index overflow")
77− }
78− if capidxbit(rights.Rights[i]) != capidxbit(right) {
79− return errors.New("index mismatch")
80− }
81− rights.Rights[i] |= right
82− if capidxbit(rights.Rights[i]) != capidxbit(right) {
83− return errors.New("index mismatch (after assign)")
84− }
85− }
86−
87− return nil
88−}
89−
90−// CapRightsClear clears the permissions in clearrights from rights.
91−func CapRightsClear(rights *CapRights, clearrights []uint64) error {
92− // This is essentially a copy of cap_rights_vclear()
93− if capver(rights) != CAP_RIGHTS_VERSION_00 {
94− return fmt.Errorf("bad rights version %d", capver(rights))
95− }
96−
97− n := caparsize(rights)
98− if n < capArSizeMin || n > capArSizeMax {
99− return errors.New("bad rights size")
100− }
101−
102− for _, right := range clearrights {
103− if caprver(right) != CAP_RIGHTS_VERSION_00 {
104− return errors.New("bad right version")
105− }
106− i, err := rightToIndex(right)
107− if err != nil {
108− return err
109− }
110− if i >= n {
111− return errors.New("index overflow")
112− }
113− if capidxbit(rights.Rights[i]) != capidxbit(right) {
114− return errors.New("index mismatch")
115− }
116− rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF)
117− if capidxbit(rights.Rights[i]) != capidxbit(right) {
118− return errors.New("index mismatch (after assign)")
119− }
120− }
121−
122− return nil
123−}
124−
125−// CapRightsIsSet checks whether all the permissions in setrights are present in rights.
126−func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) {
127− // This is essentially a copy of cap_rights_is_vset()
128− if capver(rights) != CAP_RIGHTS_VERSION_00 {
129− return false, fmt.Errorf("bad rights version %d", capver(rights))
130− }
131−
132− n := caparsize(rights)
133− if n < capArSizeMin || n > capArSizeMax {
134− return false, errors.New("bad rights size")
135− }
136−
137− for _, right := range setrights {
138− if caprver(right) != CAP_RIGHTS_VERSION_00 {
139− return false, errors.New("bad right version")
140− }
141− i, err := rightToIndex(right)
142− if err != nil {
143− return false, err
144− }
145− if i >= n {
146− return false, errors.New("index overflow")
147− }
148− if capidxbit(rights.Rights[i]) != capidxbit(right) {
149− return false, errors.New("index mismatch")
150− }
151− if (rights.Rights[i] & right) != right {
152− return false, nil
153− }
154− }
155−
156− return true, nil
157−}
158−
159−func capright(idx uint64, bit uint64) uint64 {
160− return ((1 << (57 + idx)) | bit)
161−}
162−
163−// CapRightsInit returns a pointer to an initialised CapRights structure filled with rights.
164−// See man cap_rights_init(3) and rights(4).
165−func CapRightsInit(rights []uint64) (*CapRights, error) {
166− var r CapRights
167− r.Rights[0] = (capRightsGoVersion << 62) | capright(0, 0)
168− r.Rights[1] = capright(1, 0)
169−
170− err := CapRightsSet(&r, rights)
171− if err != nil {
172− return nil, err
173− }
174− return &r, nil
175−}
176−
177−// CapRightsLimit reduces the operations permitted on fd to at most those contained in rights.
178−// The capability rights on fd can never be increased by CapRightsLimit.
179−// See man cap_rights_limit(2) and rights(4).
180−func CapRightsLimit(fd uintptr, rights *CapRights) error {
181− return capRightsLimit(int(fd), rights)
182−}
183−
184−// CapRightsGet returns a CapRights structure containing the operations permitted on fd.
185−// See man cap_rights_get(3) and rights(4).
186−func CapRightsGet(fd uintptr) (*CapRights, error) {
187− r, err := CapRightsInit(nil)
188− if err != nil {
189− return nil, err
190− }
191− err = capRightsGet(capRightsGoVersion, int(fd), r)
192− if err != nil {
193− return nil, err
194− }
195− return r, nil
196−}
vendor/golang.org/x/sys/unix/constants.godeleted−14
@@ -1,14 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
7−
8−package unix
9−
10−const (
11− R_OK = 0x4
12− W_OK = 0x2
13− X_OK = 0x1
14−)
vendor/golang.org/x/sys/unix/dev_aix_ppc.godeleted−27
@@ -1,27 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix && ppc
6−// +build aix,ppc
7−
8−// Functions to access/create device major and minor numbers matching the
9−// encoding used by AIX.
10−
11−package unix
12−
13−// Major returns the major component of a Linux device number.
14−func Major(dev uint64) uint32 {
15− return uint32((dev >> 16) & 0xffff)
16−}
17−
18−// Minor returns the minor component of a Linux device number.
19−func Minor(dev uint64) uint32 {
20− return uint32(dev & 0xffff)
21−}
22−
23−// Mkdev returns a Linux device number generated from the given major and minor
24−// components.
25−func Mkdev(major, minor uint32) uint64 {
26− return uint64(((major) << 16) | (minor))
27−}
vendor/golang.org/x/sys/unix/dev_aix_ppc64.godeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix && ppc64
6−// +build aix,ppc64
7−
8−// Functions to access/create device major and minor numbers matching the
9−// encoding used AIX.
10−
11−package unix
12−
13−// Major returns the major component of a Linux device number.
14−func Major(dev uint64) uint32 {
15− return uint32((dev & 0x3fffffff00000000) >> 32)
16−}
17−
18−// Minor returns the minor component of a Linux device number.
19−func Minor(dev uint64) uint32 {
20− return uint32((dev & 0x00000000ffffffff) >> 0)
21−}
22−
23−// Mkdev returns a Linux device number generated from the given major and minor
24−// components.
25−func Mkdev(major, minor uint32) uint64 {
26− var DEVNO64 uint64
27− DEVNO64 = 0x8000000000000000
28− return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64)
29−}
vendor/golang.org/x/sys/unix/dev_darwin.godeleted−24
@@ -1,24 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Functions to access/create device major and minor numbers matching the
6−// encoding used in Darwin's sys/types.h header.
7−
8−package unix
9−
10−// Major returns the major component of a Darwin device number.
11−func Major(dev uint64) uint32 {
12− return uint32((dev >> 24) & 0xff)
13−}
14−
15−// Minor returns the minor component of a Darwin device number.
16−func Minor(dev uint64) uint32 {
17− return uint32(dev & 0xffffff)
18−}
19−
20−// Mkdev returns a Darwin device number generated from the given major and minor
21−// components.
22−func Mkdev(major, minor uint32) uint64 {
23− return (uint64(major) << 24) | uint64(minor)
24−}
vendor/golang.org/x/sys/unix/dev_dragonfly.godeleted−30
@@ -1,30 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Functions to access/create device major and minor numbers matching the
6−// encoding used in Dragonfly's sys/types.h header.
7−//
8−// The information below is extracted and adapted from sys/types.h:
9−//
10−// Minor gives a cookie instead of an index since in order to avoid changing the
11−// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
12−// devices that don't use them.
13−
14−package unix
15−
16−// Major returns the major component of a DragonFlyBSD device number.
17−func Major(dev uint64) uint32 {
18− return uint32((dev >> 8) & 0xff)
19−}
20−
21−// Minor returns the minor component of a DragonFlyBSD device number.
22−func Minor(dev uint64) uint32 {
23− return uint32(dev & 0xffff00ff)
24−}
25−
26−// Mkdev returns a DragonFlyBSD device number generated from the given major and
27−// minor components.
28−func Mkdev(major, minor uint32) uint64 {
29− return (uint64(major) << 8) | uint64(minor)
30−}
vendor/golang.org/x/sys/unix/dev_freebsd.godeleted−30
@@ -1,30 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Functions to access/create device major and minor numbers matching the
6−// encoding used in FreeBSD's sys/types.h header.
7−//
8−// The information below is extracted and adapted from sys/types.h:
9−//
10−// Minor gives a cookie instead of an index since in order to avoid changing the
11−// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
12−// devices that don't use them.
13−
14−package unix
15−
16−// Major returns the major component of a FreeBSD device number.
17−func Major(dev uint64) uint32 {
18− return uint32((dev >> 8) & 0xff)
19−}
20−
21−// Minor returns the minor component of a FreeBSD device number.
22−func Minor(dev uint64) uint32 {
23− return uint32(dev & 0xffff00ff)
24−}
25−
26−// Mkdev returns a FreeBSD device number generated from the given major and
27−// minor components.
28−func Mkdev(major, minor uint32) uint64 {
29− return (uint64(major) << 8) | uint64(minor)
30−}
vendor/golang.org/x/sys/unix/dev_linux.godeleted−42
@@ -1,42 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Functions to access/create device major and minor numbers matching the
6−// encoding used by the Linux kernel and glibc.
7−//
8−// The information below is extracted and adapted from bits/sysmacros.h in the
9−// glibc sources:
10−//
11−// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
12−// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
13−// number and m is a hex digit of the minor number. This is backward compatible
14−// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
15−// backward compatible with the Linux kernel, which for some architectures uses
16−// 32-bit dev_t, encoded as mmmM MMmm.
17−
18−package unix
19−
20−// Major returns the major component of a Linux device number.
21−func Major(dev uint64) uint32 {
22− major := uint32((dev & 0x00000000000fff00) >> 8)
23− major |= uint32((dev & 0xfffff00000000000) >> 32)
24− return major
25−}
26−
27−// Minor returns the minor component of a Linux device number.
28−func Minor(dev uint64) uint32 {
29− minor := uint32((dev & 0x00000000000000ff) >> 0)
30− minor |= uint32((dev & 0x00000ffffff00000) >> 12)
31− return minor
32−}
33−
34−// Mkdev returns a Linux device number generated from the given major and minor
35−// components.
36−func Mkdev(major, minor uint32) uint64 {
37− dev := (uint64(major) & 0x00000fff) << 8
38− dev |= (uint64(major) & 0xfffff000) << 32
39− dev |= (uint64(minor) & 0x000000ff) << 0
40− dev |= (uint64(minor) & 0xffffff00) << 12
41− return dev
42−}
vendor/golang.org/x/sys/unix/dev_netbsd.godeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Functions to access/create device major and minor numbers matching the
6−// encoding used in NetBSD's sys/types.h header.
7−
8−package unix
9−
10−// Major returns the major component of a NetBSD device number.
11−func Major(dev uint64) uint32 {
12− return uint32((dev & 0x000fff00) >> 8)
13−}
14−
15−// Minor returns the minor component of a NetBSD device number.
16−func Minor(dev uint64) uint32 {
17− minor := uint32((dev & 0x000000ff) >> 0)
18− minor |= uint32((dev & 0xfff00000) >> 12)
19− return minor
20−}
21−
22−// Mkdev returns a NetBSD device number generated from the given major and minor
23−// components.
24−func Mkdev(major, minor uint32) uint64 {
25− dev := (uint64(major) << 8) & 0x000fff00
26− dev |= (uint64(minor) << 12) & 0xfff00000
27− dev |= (uint64(minor) << 0) & 0x000000ff
28− return dev
29−}
vendor/golang.org/x/sys/unix/dev_openbsd.godeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Functions to access/create device major and minor numbers matching the
6−// encoding used in OpenBSD's sys/types.h header.
7−
8−package unix
9−
10−// Major returns the major component of an OpenBSD device number.
11−func Major(dev uint64) uint32 {
12− return uint32((dev & 0x0000ff00) >> 8)
13−}
14−
15−// Minor returns the minor component of an OpenBSD device number.
16−func Minor(dev uint64) uint32 {
17− minor := uint32((dev & 0x000000ff) >> 0)
18− minor |= uint32((dev & 0xffff0000) >> 8)
19− return minor
20−}
21−
22−// Mkdev returns an OpenBSD device number generated from the given major and minor
23−// components.
24−func Mkdev(major, minor uint32) uint64 {
25− dev := (uint64(major) << 8) & 0x0000ff00
26− dev |= (uint64(minor) << 8) & 0xffff0000
27− dev |= (uint64(minor) << 0) & 0x000000ff
28− return dev
29−}
vendor/golang.org/x/sys/unix/dev_zos.godeleted−29
@@ -1,29 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build zos && s390x
6−// +build zos,s390x
7−
8−// Functions to access/create device major and minor numbers matching the
9−// encoding used by z/OS.
10−//
11−// The information below is extracted and adapted from <sys/stat.h> macros.
12−
13−package unix
14−
15−// Major returns the major component of a z/OS device number.
16−func Major(dev uint64) uint32 {
17− return uint32((dev >> 16) & 0x0000FFFF)
18−}
19−
20−// Minor returns the minor component of a z/OS device number.
21−func Minor(dev uint64) uint32 {
22− return uint32(dev & 0x0000FFFF)
23−}
24−
25−// Mkdev returns a z/OS device number generated from the given major and minor
26−// components.
27−func Mkdev(major, minor uint32) uint64 {
28− return (uint64(major) << 16) | uint64(minor)
29−}
vendor/golang.org/x/sys/unix/dirent.godeleted−103
@@ -1,103 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
7−
8−package unix
9−
10−import "unsafe"
11−
12−// readInt returns the size-bytes unsigned integer in native byte order at offset off.
13−func readInt(b []byte, off, size uintptr) (u uint64, ok bool) {
14− if len(b) < int(off+size) {
15− return 0, false
16− }
17− if isBigEndian {
18− return readIntBE(b[off:], size), true
19− }
20− return readIntLE(b[off:], size), true
21−}
22−
23−func readIntBE(b []byte, size uintptr) uint64 {
24− switch size {
25− case 1:
26− return uint64(b[0])
27− case 2:
28− _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
29− return uint64(b[1]) | uint64(b[0])<<8
30− case 4:
31− _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
32− return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24
33− case 8:
34− _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
35− return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
36− uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
37− default:
38− panic("syscall: readInt with unsupported size")
39− }
40−}
41−
42−func readIntLE(b []byte, size uintptr) uint64 {
43− switch size {
44− case 1:
45− return uint64(b[0])
46− case 2:
47− _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
48− return uint64(b[0]) | uint64(b[1])<<8
49− case 4:
50− _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
51− return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24
52− case 8:
53− _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
54− return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
55− uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
56− default:
57− panic("syscall: readInt with unsupported size")
58− }
59−}
60−
61−// ParseDirent parses up to max directory entries in buf,
62−// appending the names to names. It returns the number of
63−// bytes consumed from buf, the number of entries added
64−// to names, and the new names slice.
65−func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
66− origlen := len(buf)
67− count = 0
68− for max != 0 && len(buf) > 0 {
69− reclen, ok := direntReclen(buf)
70− if !ok || reclen > uint64(len(buf)) {
71− return origlen, count, names
72− }
73− rec := buf[:reclen]
74− buf = buf[reclen:]
75− ino, ok := direntIno(rec)
76− if !ok {
77− break
78− }
79− if ino == 0 { // File absent in directory.
80− continue
81− }
82− const namoff = uint64(unsafe.Offsetof(Dirent{}.Name))
83− namlen, ok := direntNamlen(rec)
84− if !ok || namoff+namlen > uint64(len(rec)) {
85− break
86− }
87− name := rec[namoff : namoff+namlen]
88− for i, c := range name {
89− if c == 0 {
90− name = name[:i]
91− break
92− }
93− }
94− // Check for useless names before allocating a string.
95− if string(name) == "." || string(name) == ".." {
96− continue
97− }
98− max--
99− count++
100− names = append(names, string(name))
101− }
102− return origlen - len(buf), count, names
103−}
vendor/golang.org/x/sys/unix/endian_big.godeleted−10
@@ -1,10 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−//
5−//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
6−// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
7−
8−package unix
9−
10−const isBigEndian = true
vendor/golang.org/x/sys/unix/endian_little.godeleted−10
@@ -1,10 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−//
5−//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
6−// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
7−
8−package unix
9−
10−const isBigEndian = false
vendor/golang.org/x/sys/unix/env_unix.godeleted−32
@@ -1,32 +0,0 @@
1−// Copyright 2010 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
7−
8−// Unix environment variables.
9−
10−package unix
11−
12−import "syscall"
13−
14−func Getenv(key string) (value string, found bool) {
15− return syscall.Getenv(key)
16−}
17−
18−func Setenv(key, value string) error {
19− return syscall.Setenv(key, value)
20−}
21−
22−func Clearenv() {
23− syscall.Clearenv()
24−}
25−
26−func Environ() []string {
27− return syscall.Environ()
28−}
29−
30−func Unsetenv(key string) error {
31− return syscall.Unsetenv(key)
32−}
vendor/golang.org/x/sys/unix/epoll_zos.godeleted−221
@@ -1,221 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build zos && s390x
6−// +build zos,s390x
7−
8−package unix
9−
10−import (
11− "sync"
12−)
13−
14−// This file simulates epoll on z/OS using poll.
15−
16−// Analogous to epoll_event on Linux.
17−// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove?
18−type EpollEvent struct {
19− Events uint32
20− Fd int32
21− Pad int32
22−}
23−
24−const (
25− EPOLLERR = 0x8
26− EPOLLHUP = 0x10
27− EPOLLIN = 0x1
28− EPOLLMSG = 0x400
29− EPOLLOUT = 0x4
30− EPOLLPRI = 0x2
31− EPOLLRDBAND = 0x80
32− EPOLLRDNORM = 0x40
33− EPOLLWRBAND = 0x200
34− EPOLLWRNORM = 0x100
35− EPOLL_CTL_ADD = 0x1
36− EPOLL_CTL_DEL = 0x2
37− EPOLL_CTL_MOD = 0x3
38− // The following constants are part of the epoll API, but represent
39− // currently unsupported functionality on z/OS.
40− // EPOLL_CLOEXEC = 0x80000
41− // EPOLLET = 0x80000000
42− // EPOLLONESHOT = 0x40000000
43− // EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis
44− // EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode
45− // EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability
46−)
47−
48−// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL
49−// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16).
50−
51−// epToPollEvt converts epoll event field to poll equivalent.
52−// In epoll, Events is a 32-bit field, while poll uses 16 bits.
53−func epToPollEvt(events uint32) int16 {
54− var ep2p = map[uint32]int16{
55− EPOLLIN: POLLIN,
56− EPOLLOUT: POLLOUT,
57− EPOLLHUP: POLLHUP,
58− EPOLLPRI: POLLPRI,
59− EPOLLERR: POLLERR,
60− }
61−
62− var pollEvts int16 = 0
63− for epEvt, pEvt := range ep2p {
64− if (events & epEvt) != 0 {
65− pollEvts |= pEvt
66− }
67− }
68−
69− return pollEvts
70−}
71−
72−// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields.
73−func pToEpollEvt(revents int16) uint32 {
74− var p2ep = map[int16]uint32{
75− POLLIN: EPOLLIN,
76− POLLOUT: EPOLLOUT,
77− POLLHUP: EPOLLHUP,
78− POLLPRI: EPOLLPRI,
79− POLLERR: EPOLLERR,
80− }
81−
82− var epollEvts uint32 = 0
83− for pEvt, epEvt := range p2ep {
84− if (revents & pEvt) != 0 {
85− epollEvts |= epEvt
86− }
87− }
88−
89− return epollEvts
90−}
91−
92−// Per-process epoll implementation.
93−type epollImpl struct {
94− mu sync.Mutex
95− epfd2ep map[int]*eventPoll
96− nextEpfd int
97−}
98−
99−// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances.
100−// On Linux, this is an in-kernel data structure accessed through a fd.
101−type eventPoll struct {
102− mu sync.Mutex
103− fds map[int]*EpollEvent
104−}
105−
106−// epoll impl for this process.
107−var impl epollImpl = epollImpl{
108− epfd2ep: make(map[int]*eventPoll),
109− nextEpfd: 0,
110−}
111−
112−func (e *epollImpl) epollcreate(size int) (epfd int, err error) {
113− e.mu.Lock()
114− defer e.mu.Unlock()
115− epfd = e.nextEpfd
116− e.nextEpfd++
117−
118− e.epfd2ep[epfd] = &eventPoll{
119− fds: make(map[int]*EpollEvent),
120− }
121− return epfd, nil
122−}
123−
124−func (e *epollImpl) epollcreate1(flag int) (fd int, err error) {
125− return e.epollcreate(4)
126−}
127−
128−func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) {
129− e.mu.Lock()
130− defer e.mu.Unlock()
131−
132− ep, ok := e.epfd2ep[epfd]
133− if !ok {
134−
135− return EBADF
136− }
137−
138− switch op {
139− case EPOLL_CTL_ADD:
140− // TODO(neeilan): When we make epfds and fds disjoint, detect epoll
141− // loops here (instances watching each other) and return ELOOP.
142− if _, ok := ep.fds[fd]; ok {
143− return EEXIST
144− }
145− ep.fds[fd] = event
146− case EPOLL_CTL_MOD:
147− if _, ok := ep.fds[fd]; !ok {
148− return ENOENT
149− }
150− ep.fds[fd] = event
151− case EPOLL_CTL_DEL:
152− if _, ok := ep.fds[fd]; !ok {
153− return ENOENT
154− }
155− delete(ep.fds, fd)
156−
157− }
158− return nil
159−}
160−
161−// Must be called while holding ep.mu
162−func (ep *eventPoll) getFds() []int {
163− fds := make([]int, len(ep.fds))
164− for fd := range ep.fds {
165− fds = append(fds, fd)
166− }
167− return fds
168−}
169−
170−func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) {
171− e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait
172− ep, ok := e.epfd2ep[epfd]
173−
174− if !ok {
175− e.mu.Unlock()
176− return 0, EBADF
177− }
178−
179− pollfds := make([]PollFd, 4)
180− for fd, epollevt := range ep.fds {
181− pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)})
182− }
183− e.mu.Unlock()
184−
185− n, err = Poll(pollfds, msec)
186− if err != nil {
187− return n, err
188− }
189−
190− i := 0
191− for _, pFd := range pollfds {
192− if pFd.Revents != 0 {
193− events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)}
194− i++
195− }
196−
197− if i == n {
198− break
199− }
200− }
201−
202− return n, nil
203−}
204−
205−func EpollCreate(size int) (fd int, err error) {
206− return impl.epollcreate(size)
207−}
208−
209−func EpollCreate1(flag int) (fd int, err error) {
210− return impl.epollcreate1(flag)
211−}
212−
213−func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
214− return impl.epollctl(epfd, op, fd, event)
215−}
216−
217−// Because EpollWait mutates events, the caller is expected to coordinate
218−// concurrent access if calling with the same epfd from multiple goroutines.
219−func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
220− return impl.epollwait(epfd, events, msec)
221−}
vendor/golang.org/x/sys/unix/errors_freebsd_386.godeleted−233
@@ -1,233 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
6−// them here for backwards compatibility.
7−
8−package unix
9−
10−const (
11− DLT_HHDLC = 0x79
12− IFF_SMART = 0x20
13− IFT_1822 = 0x2
14− IFT_A12MPPSWITCH = 0x82
15− IFT_AAL2 = 0xbb
16− IFT_AAL5 = 0x31
17− IFT_ADSL = 0x5e
18− IFT_AFLANE8023 = 0x3b
19− IFT_AFLANE8025 = 0x3c
20− IFT_ARAP = 0x58
21− IFT_ARCNET = 0x23
22− IFT_ARCNETPLUS = 0x24
23− IFT_ASYNC = 0x54
24− IFT_ATM = 0x25
25− IFT_ATMDXI = 0x69
26− IFT_ATMFUNI = 0x6a
27− IFT_ATMIMA = 0x6b
28− IFT_ATMLOGICAL = 0x50
29− IFT_ATMRADIO = 0xbd
30− IFT_ATMSUBINTERFACE = 0x86
31− IFT_ATMVCIENDPT = 0xc2
32− IFT_ATMVIRTUAL = 0x95
33− IFT_BGPPOLICYACCOUNTING = 0xa2
34− IFT_BSC = 0x53
35− IFT_CCTEMUL = 0x3d
36− IFT_CEPT = 0x13
37− IFT_CES = 0x85
38− IFT_CHANNEL = 0x46
39− IFT_CNR = 0x55
40− IFT_COFFEE = 0x84
41− IFT_COMPOSITELINK = 0x9b
42− IFT_DCN = 0x8d
43− IFT_DIGITALPOWERLINE = 0x8a
44− IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
45− IFT_DLSW = 0x4a
46− IFT_DOCSCABLEDOWNSTREAM = 0x80
47− IFT_DOCSCABLEMACLAYER = 0x7f
48− IFT_DOCSCABLEUPSTREAM = 0x81
49− IFT_DS0 = 0x51
50− IFT_DS0BUNDLE = 0x52
51− IFT_DS1FDL = 0xaa
52− IFT_DS3 = 0x1e
53− IFT_DTM = 0x8c
54− IFT_DVBASILN = 0xac
55− IFT_DVBASIOUT = 0xad
56− IFT_DVBRCCDOWNSTREAM = 0x93
57− IFT_DVBRCCMACLAYER = 0x92
58− IFT_DVBRCCUPSTREAM = 0x94
59− IFT_ENC = 0xf4
60− IFT_EON = 0x19
61− IFT_EPLRS = 0x57
62− IFT_ESCON = 0x49
63− IFT_ETHER = 0x6
64− IFT_FAITH = 0xf2
65− IFT_FAST = 0x7d
66− IFT_FASTETHER = 0x3e
67− IFT_FASTETHERFX = 0x45
68− IFT_FDDI = 0xf
69− IFT_FIBRECHANNEL = 0x38
70− IFT_FRAMERELAYINTERCONNECT = 0x3a
71− IFT_FRAMERELAYMPI = 0x5c
72− IFT_FRDLCIENDPT = 0xc1
73− IFT_FRELAY = 0x20
74− IFT_FRELAYDCE = 0x2c
75− IFT_FRF16MFRBUNDLE = 0xa3
76− IFT_FRFORWARD = 0x9e
77− IFT_G703AT2MB = 0x43
78− IFT_G703AT64K = 0x42
79− IFT_GIF = 0xf0
80− IFT_GIGABITETHERNET = 0x75
81− IFT_GR303IDT = 0xb2
82− IFT_GR303RDT = 0xb1
83− IFT_H323GATEKEEPER = 0xa4
84− IFT_H323PROXY = 0xa5
85− IFT_HDH1822 = 0x3
86− IFT_HDLC = 0x76
87− IFT_HDSL2 = 0xa8
88− IFT_HIPERLAN2 = 0xb7
89− IFT_HIPPI = 0x2f
90− IFT_HIPPIINTERFACE = 0x39
91− IFT_HOSTPAD = 0x5a
92− IFT_HSSI = 0x2e
93− IFT_HY = 0xe
94− IFT_IBM370PARCHAN = 0x48
95− IFT_IDSL = 0x9a
96− IFT_IEEE80211 = 0x47
97− IFT_IEEE80212 = 0x37
98− IFT_IEEE8023ADLAG = 0xa1
99− IFT_IFGSN = 0x91
100− IFT_IMT = 0xbe
101− IFT_INTERLEAVE = 0x7c
102− IFT_IP = 0x7e
103− IFT_IPFORWARD = 0x8e
104− IFT_IPOVERATM = 0x72
105− IFT_IPOVERCDLC = 0x6d
106− IFT_IPOVERCLAW = 0x6e
107− IFT_IPSWITCH = 0x4e
108− IFT_IPXIP = 0xf9
109− IFT_ISDN = 0x3f
110− IFT_ISDNBASIC = 0x14
111− IFT_ISDNPRIMARY = 0x15
112− IFT_ISDNS = 0x4b
113− IFT_ISDNU = 0x4c
114− IFT_ISO88022LLC = 0x29
115− IFT_ISO88023 = 0x7
116− IFT_ISO88024 = 0x8
117− IFT_ISO88025 = 0x9
118− IFT_ISO88025CRFPINT = 0x62
119− IFT_ISO88025DTR = 0x56
120− IFT_ISO88025FIBER = 0x73
121− IFT_ISO88026 = 0xa
122− IFT_ISUP = 0xb3
123− IFT_L3IPXVLAN = 0x89
124− IFT_LAPB = 0x10
125− IFT_LAPD = 0x4d
126− IFT_LAPF = 0x77
127− IFT_LOCALTALK = 0x2a
128− IFT_LOOP = 0x18
129− IFT_MEDIAMAILOVERIP = 0x8b
130− IFT_MFSIGLINK = 0xa7
131− IFT_MIOX25 = 0x26
132− IFT_MODEM = 0x30
133− IFT_MPC = 0x71
134− IFT_MPLS = 0xa6
135− IFT_MPLSTUNNEL = 0x96
136− IFT_MSDSL = 0x8f
137− IFT_MVL = 0xbf
138− IFT_MYRINET = 0x63
139− IFT_NFAS = 0xaf
140− IFT_NSIP = 0x1b
141− IFT_OPTICALCHANNEL = 0xc3
142− IFT_OPTICALTRANSPORT = 0xc4
143− IFT_OTHER = 0x1
144− IFT_P10 = 0xc
145− IFT_P80 = 0xd
146− IFT_PARA = 0x22
147− IFT_PFLOG = 0xf6
148− IFT_PFSYNC = 0xf7
149− IFT_PLC = 0xae
150− IFT_POS = 0xab
151− IFT_PPPMULTILINKBUNDLE = 0x6c
152− IFT_PROPBWAP2MP = 0xb8
153− IFT_PROPCNLS = 0x59
154− IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
155− IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
156− IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
157− IFT_PROPMUX = 0x36
158− IFT_PROPWIRELESSP2P = 0x9d
159− IFT_PTPSERIAL = 0x16
160− IFT_PVC = 0xf1
161− IFT_QLLC = 0x44
162− IFT_RADIOMAC = 0xbc
163− IFT_RADSL = 0x5f
164− IFT_REACHDSL = 0xc0
165− IFT_RFC1483 = 0x9f
166− IFT_RS232 = 0x21
167− IFT_RSRB = 0x4f
168− IFT_SDLC = 0x11
169− IFT_SDSL = 0x60
170− IFT_SHDSL = 0xa9
171− IFT_SIP = 0x1f
172− IFT_SLIP = 0x1c
173− IFT_SMDSDXI = 0x2b
174− IFT_SMDSICIP = 0x34
175− IFT_SONET = 0x27
176− IFT_SONETOVERHEADCHANNEL = 0xb9
177− IFT_SONETPATH = 0x32
178− IFT_SONETVT = 0x33
179− IFT_SRP = 0x97
180− IFT_SS7SIGLINK = 0x9c
181− IFT_STACKTOSTACK = 0x6f
182− IFT_STARLAN = 0xb
183− IFT_STF = 0xd7
184− IFT_T1 = 0x12
185− IFT_TDLC = 0x74
186− IFT_TERMPAD = 0x5b
187− IFT_TR008 = 0xb0
188− IFT_TRANSPHDLC = 0x7b
189− IFT_TUNNEL = 0x83
190− IFT_ULTRA = 0x1d
191− IFT_USB = 0xa0
192− IFT_V11 = 0x40
193− IFT_V35 = 0x2d
194− IFT_V36 = 0x41
195− IFT_V37 = 0x78
196− IFT_VDSL = 0x61
197− IFT_VIRTUALIPADDRESS = 0x70
198− IFT_VOICEEM = 0x64
199− IFT_VOICEENCAP = 0x67
200− IFT_VOICEFXO = 0x65
201− IFT_VOICEFXS = 0x66
202− IFT_VOICEOVERATM = 0x98
203− IFT_VOICEOVERFRAMERELAY = 0x99
204− IFT_VOICEOVERIP = 0x68
205− IFT_X213 = 0x5d
206− IFT_X25 = 0x5
207− IFT_X25DDN = 0x4
208− IFT_X25HUNTGROUP = 0x7a
209− IFT_X25MLP = 0x79
210− IFT_X25PLE = 0x28
211− IFT_XETHER = 0x1a
212− IPPROTO_MAXID = 0x34
213− IPV6_FAITH = 0x1d
214− IPV6_MIN_MEMBERSHIPS = 0x1f
215− IP_FAITH = 0x16
216− IP_MAX_SOURCE_FILTER = 0x400
217− IP_MIN_MEMBERSHIPS = 0x1f
218− MAP_NORESERVE = 0x40
219− MAP_RENAME = 0x20
220− NET_RT_MAXID = 0x6
221− RTF_PRCLONING = 0x10000
222− RTM_OLDADD = 0x9
223− RTM_OLDDEL = 0xa
224− RT_CACHING_CONTEXT = 0x1
225− RT_NORTREF = 0x2
226− SIOCADDRT = 0x8030720a
227− SIOCALIFADDR = 0x8118691b
228− SIOCDELRT = 0x8030720b
229− SIOCDLIFADDR = 0x8118691d
230− SIOCGLIFADDR = 0xc118691c
231− SIOCGLIFPHYADDR = 0xc118694b
232− SIOCSLIFPHYADDR = 0x8118694a
233−)
vendor/golang.org/x/sys/unix/errors_freebsd_amd64.godeleted−233
@@ -1,233 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
6−// them here for backwards compatibility.
7−
8−package unix
9−
10−const (
11− DLT_HHDLC = 0x79
12− IFF_SMART = 0x20
13− IFT_1822 = 0x2
14− IFT_A12MPPSWITCH = 0x82
15− IFT_AAL2 = 0xbb
16− IFT_AAL5 = 0x31
17− IFT_ADSL = 0x5e
18− IFT_AFLANE8023 = 0x3b
19− IFT_AFLANE8025 = 0x3c
20− IFT_ARAP = 0x58
21− IFT_ARCNET = 0x23
22− IFT_ARCNETPLUS = 0x24
23− IFT_ASYNC = 0x54
24− IFT_ATM = 0x25
25− IFT_ATMDXI = 0x69
26− IFT_ATMFUNI = 0x6a
27− IFT_ATMIMA = 0x6b
28− IFT_ATMLOGICAL = 0x50
29− IFT_ATMRADIO = 0xbd
30− IFT_ATMSUBINTERFACE = 0x86
31− IFT_ATMVCIENDPT = 0xc2
32− IFT_ATMVIRTUAL = 0x95
33− IFT_BGPPOLICYACCOUNTING = 0xa2
34− IFT_BSC = 0x53
35− IFT_CCTEMUL = 0x3d
36− IFT_CEPT = 0x13
37− IFT_CES = 0x85
38− IFT_CHANNEL = 0x46
39− IFT_CNR = 0x55
40− IFT_COFFEE = 0x84
41− IFT_COMPOSITELINK = 0x9b
42− IFT_DCN = 0x8d
43− IFT_DIGITALPOWERLINE = 0x8a
44− IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
45− IFT_DLSW = 0x4a
46− IFT_DOCSCABLEDOWNSTREAM = 0x80
47− IFT_DOCSCABLEMACLAYER = 0x7f
48− IFT_DOCSCABLEUPSTREAM = 0x81
49− IFT_DS0 = 0x51
50− IFT_DS0BUNDLE = 0x52
51− IFT_DS1FDL = 0xaa
52− IFT_DS3 = 0x1e
53− IFT_DTM = 0x8c
54− IFT_DVBASILN = 0xac
55− IFT_DVBASIOUT = 0xad
56− IFT_DVBRCCDOWNSTREAM = 0x93
57− IFT_DVBRCCMACLAYER = 0x92
58− IFT_DVBRCCUPSTREAM = 0x94
59− IFT_ENC = 0xf4
60− IFT_EON = 0x19
61− IFT_EPLRS = 0x57
62− IFT_ESCON = 0x49
63− IFT_ETHER = 0x6
64− IFT_FAITH = 0xf2
65− IFT_FAST = 0x7d
66− IFT_FASTETHER = 0x3e
67− IFT_FASTETHERFX = 0x45
68− IFT_FDDI = 0xf
69− IFT_FIBRECHANNEL = 0x38
70− IFT_FRAMERELAYINTERCONNECT = 0x3a
71− IFT_FRAMERELAYMPI = 0x5c
72− IFT_FRDLCIENDPT = 0xc1
73− IFT_FRELAY = 0x20
74− IFT_FRELAYDCE = 0x2c
75− IFT_FRF16MFRBUNDLE = 0xa3
76− IFT_FRFORWARD = 0x9e
77− IFT_G703AT2MB = 0x43
78− IFT_G703AT64K = 0x42
79− IFT_GIF = 0xf0
80− IFT_GIGABITETHERNET = 0x75
81− IFT_GR303IDT = 0xb2
82− IFT_GR303RDT = 0xb1
83− IFT_H323GATEKEEPER = 0xa4
84− IFT_H323PROXY = 0xa5
85− IFT_HDH1822 = 0x3
86− IFT_HDLC = 0x76
87− IFT_HDSL2 = 0xa8
88− IFT_HIPERLAN2 = 0xb7
89− IFT_HIPPI = 0x2f
90− IFT_HIPPIINTERFACE = 0x39
91− IFT_HOSTPAD = 0x5a
92− IFT_HSSI = 0x2e
93− IFT_HY = 0xe
94− IFT_IBM370PARCHAN = 0x48
95− IFT_IDSL = 0x9a
96− IFT_IEEE80211 = 0x47
97− IFT_IEEE80212 = 0x37
98− IFT_IEEE8023ADLAG = 0xa1
99− IFT_IFGSN = 0x91
100− IFT_IMT = 0xbe
101− IFT_INTERLEAVE = 0x7c
102− IFT_IP = 0x7e
103− IFT_IPFORWARD = 0x8e
104− IFT_IPOVERATM = 0x72
105− IFT_IPOVERCDLC = 0x6d
106− IFT_IPOVERCLAW = 0x6e
107− IFT_IPSWITCH = 0x4e
108− IFT_IPXIP = 0xf9
109− IFT_ISDN = 0x3f
110− IFT_ISDNBASIC = 0x14
111− IFT_ISDNPRIMARY = 0x15
112− IFT_ISDNS = 0x4b
113− IFT_ISDNU = 0x4c
114− IFT_ISO88022LLC = 0x29
115− IFT_ISO88023 = 0x7
116− IFT_ISO88024 = 0x8
117− IFT_ISO88025 = 0x9
118− IFT_ISO88025CRFPINT = 0x62
119− IFT_ISO88025DTR = 0x56
120− IFT_ISO88025FIBER = 0x73
121− IFT_ISO88026 = 0xa
122− IFT_ISUP = 0xb3
123− IFT_L3IPXVLAN = 0x89
124− IFT_LAPB = 0x10
125− IFT_LAPD = 0x4d
126− IFT_LAPF = 0x77
127− IFT_LOCALTALK = 0x2a
128− IFT_LOOP = 0x18
129− IFT_MEDIAMAILOVERIP = 0x8b
130− IFT_MFSIGLINK = 0xa7
131− IFT_MIOX25 = 0x26
132− IFT_MODEM = 0x30
133− IFT_MPC = 0x71
134− IFT_MPLS = 0xa6
135− IFT_MPLSTUNNEL = 0x96
136− IFT_MSDSL = 0x8f
137− IFT_MVL = 0xbf
138− IFT_MYRINET = 0x63
139− IFT_NFAS = 0xaf
140− IFT_NSIP = 0x1b
141− IFT_OPTICALCHANNEL = 0xc3
142− IFT_OPTICALTRANSPORT = 0xc4
143− IFT_OTHER = 0x1
144− IFT_P10 = 0xc
145− IFT_P80 = 0xd
146− IFT_PARA = 0x22
147− IFT_PFLOG = 0xf6
148− IFT_PFSYNC = 0xf7
149− IFT_PLC = 0xae
150− IFT_POS = 0xab
151− IFT_PPPMULTILINKBUNDLE = 0x6c
152− IFT_PROPBWAP2MP = 0xb8
153− IFT_PROPCNLS = 0x59
154− IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
155− IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
156− IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
157− IFT_PROPMUX = 0x36
158− IFT_PROPWIRELESSP2P = 0x9d
159− IFT_PTPSERIAL = 0x16
160− IFT_PVC = 0xf1
161− IFT_QLLC = 0x44
162− IFT_RADIOMAC = 0xbc
163− IFT_RADSL = 0x5f
164− IFT_REACHDSL = 0xc0
165− IFT_RFC1483 = 0x9f
166− IFT_RS232 = 0x21
167− IFT_RSRB = 0x4f
168− IFT_SDLC = 0x11
169− IFT_SDSL = 0x60
170− IFT_SHDSL = 0xa9
171− IFT_SIP = 0x1f
172− IFT_SLIP = 0x1c
173− IFT_SMDSDXI = 0x2b
174− IFT_SMDSICIP = 0x34
175− IFT_SONET = 0x27
176− IFT_SONETOVERHEADCHANNEL = 0xb9
177− IFT_SONETPATH = 0x32
178− IFT_SONETVT = 0x33
179− IFT_SRP = 0x97
180− IFT_SS7SIGLINK = 0x9c
181− IFT_STACKTOSTACK = 0x6f
182− IFT_STARLAN = 0xb
183− IFT_STF = 0xd7
184− IFT_T1 = 0x12
185− IFT_TDLC = 0x74
186− IFT_TERMPAD = 0x5b
187− IFT_TR008 = 0xb0
188− IFT_TRANSPHDLC = 0x7b
189− IFT_TUNNEL = 0x83
190− IFT_ULTRA = 0x1d
191− IFT_USB = 0xa0
192− IFT_V11 = 0x40
193− IFT_V35 = 0x2d
194− IFT_V36 = 0x41
195− IFT_V37 = 0x78
196− IFT_VDSL = 0x61
197− IFT_VIRTUALIPADDRESS = 0x70
198− IFT_VOICEEM = 0x64
199− IFT_VOICEENCAP = 0x67
200− IFT_VOICEFXO = 0x65
201− IFT_VOICEFXS = 0x66
202− IFT_VOICEOVERATM = 0x98
203− IFT_VOICEOVERFRAMERELAY = 0x99
204− IFT_VOICEOVERIP = 0x68
205− IFT_X213 = 0x5d
206− IFT_X25 = 0x5
207− IFT_X25DDN = 0x4
208− IFT_X25HUNTGROUP = 0x7a
209− IFT_X25MLP = 0x79
210− IFT_X25PLE = 0x28
211− IFT_XETHER = 0x1a
212− IPPROTO_MAXID = 0x34
213− IPV6_FAITH = 0x1d
214− IPV6_MIN_MEMBERSHIPS = 0x1f
215− IP_FAITH = 0x16
216− IP_MAX_SOURCE_FILTER = 0x400
217− IP_MIN_MEMBERSHIPS = 0x1f
218− MAP_NORESERVE = 0x40
219− MAP_RENAME = 0x20
220− NET_RT_MAXID = 0x6
221− RTF_PRCLONING = 0x10000
222− RTM_OLDADD = 0x9
223− RTM_OLDDEL = 0xa
224− RT_CACHING_CONTEXT = 0x1
225− RT_NORTREF = 0x2
226− SIOCADDRT = 0x8040720a
227− SIOCALIFADDR = 0x8118691b
228− SIOCDELRT = 0x8040720b
229− SIOCDLIFADDR = 0x8118691d
230− SIOCGLIFADDR = 0xc118691c
231− SIOCGLIFPHYADDR = 0xc118694b
232− SIOCSLIFPHYADDR = 0x8118694a
233−)
vendor/golang.org/x/sys/unix/errors_freebsd_arm.godeleted−226
@@ -1,226 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−package unix
6−
7−const (
8− IFT_1822 = 0x2
9− IFT_A12MPPSWITCH = 0x82
10− IFT_AAL2 = 0xbb
11− IFT_AAL5 = 0x31
12− IFT_ADSL = 0x5e
13− IFT_AFLANE8023 = 0x3b
14− IFT_AFLANE8025 = 0x3c
15− IFT_ARAP = 0x58
16− IFT_ARCNET = 0x23
17− IFT_ARCNETPLUS = 0x24
18− IFT_ASYNC = 0x54
19− IFT_ATM = 0x25
20− IFT_ATMDXI = 0x69
21− IFT_ATMFUNI = 0x6a
22− IFT_ATMIMA = 0x6b
23− IFT_ATMLOGICAL = 0x50
24− IFT_ATMRADIO = 0xbd
25− IFT_ATMSUBINTERFACE = 0x86
26− IFT_ATMVCIENDPT = 0xc2
27− IFT_ATMVIRTUAL = 0x95
28− IFT_BGPPOLICYACCOUNTING = 0xa2
29− IFT_BSC = 0x53
30− IFT_CCTEMUL = 0x3d
31− IFT_CEPT = 0x13
32− IFT_CES = 0x85
33− IFT_CHANNEL = 0x46
34− IFT_CNR = 0x55
35− IFT_COFFEE = 0x84
36− IFT_COMPOSITELINK = 0x9b
37− IFT_DCN = 0x8d
38− IFT_DIGITALPOWERLINE = 0x8a
39− IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
40− IFT_DLSW = 0x4a
41− IFT_DOCSCABLEDOWNSTREAM = 0x80
42− IFT_DOCSCABLEMACLAYER = 0x7f
43− IFT_DOCSCABLEUPSTREAM = 0x81
44− IFT_DS0 = 0x51
45− IFT_DS0BUNDLE = 0x52
46− IFT_DS1FDL = 0xaa
47− IFT_DS3 = 0x1e
48− IFT_DTM = 0x8c
49− IFT_DVBASILN = 0xac
50− IFT_DVBASIOUT = 0xad
51− IFT_DVBRCCDOWNSTREAM = 0x93
52− IFT_DVBRCCMACLAYER = 0x92
53− IFT_DVBRCCUPSTREAM = 0x94
54− IFT_ENC = 0xf4
55− IFT_EON = 0x19
56− IFT_EPLRS = 0x57
57− IFT_ESCON = 0x49
58− IFT_ETHER = 0x6
59− IFT_FAST = 0x7d
60− IFT_FASTETHER = 0x3e
61− IFT_FASTETHERFX = 0x45
62− IFT_FDDI = 0xf
63− IFT_FIBRECHANNEL = 0x38
64− IFT_FRAMERELAYINTERCONNECT = 0x3a
65− IFT_FRAMERELAYMPI = 0x5c
66− IFT_FRDLCIENDPT = 0xc1
67− IFT_FRELAY = 0x20
68− IFT_FRELAYDCE = 0x2c
69− IFT_FRF16MFRBUNDLE = 0xa3
70− IFT_FRFORWARD = 0x9e
71− IFT_G703AT2MB = 0x43
72− IFT_G703AT64K = 0x42
73− IFT_GIF = 0xf0
74− IFT_GIGABITETHERNET = 0x75
75− IFT_GR303IDT = 0xb2
76− IFT_GR303RDT = 0xb1
77− IFT_H323GATEKEEPER = 0xa4
78− IFT_H323PROXY = 0xa5
79− IFT_HDH1822 = 0x3
80− IFT_HDLC = 0x76
81− IFT_HDSL2 = 0xa8
82− IFT_HIPERLAN2 = 0xb7
83− IFT_HIPPI = 0x2f
84− IFT_HIPPIINTERFACE = 0x39
85− IFT_HOSTPAD = 0x5a
86− IFT_HSSI = 0x2e
87− IFT_HY = 0xe
88− IFT_IBM370PARCHAN = 0x48
89− IFT_IDSL = 0x9a
90− IFT_IEEE80211 = 0x47
91− IFT_IEEE80212 = 0x37
92− IFT_IEEE8023ADLAG = 0xa1
93− IFT_IFGSN = 0x91
94− IFT_IMT = 0xbe
95− IFT_INTERLEAVE = 0x7c
96− IFT_IP = 0x7e
97− IFT_IPFORWARD = 0x8e
98− IFT_IPOVERATM = 0x72
99− IFT_IPOVERCDLC = 0x6d
100− IFT_IPOVERCLAW = 0x6e
101− IFT_IPSWITCH = 0x4e
102− IFT_ISDN = 0x3f
103− IFT_ISDNBASIC = 0x14
104− IFT_ISDNPRIMARY = 0x15
105− IFT_ISDNS = 0x4b
106− IFT_ISDNU = 0x4c
107− IFT_ISO88022LLC = 0x29
108− IFT_ISO88023 = 0x7
109− IFT_ISO88024 = 0x8
110− IFT_ISO88025 = 0x9
111− IFT_ISO88025CRFPINT = 0x62
112− IFT_ISO88025DTR = 0x56
113− IFT_ISO88025FIBER = 0x73
114− IFT_ISO88026 = 0xa
115− IFT_ISUP = 0xb3
116− IFT_L3IPXVLAN = 0x89
117− IFT_LAPB = 0x10
118− IFT_LAPD = 0x4d
119− IFT_LAPF = 0x77
120− IFT_LOCALTALK = 0x2a
121− IFT_LOOP = 0x18
122− IFT_MEDIAMAILOVERIP = 0x8b
123− IFT_MFSIGLINK = 0xa7
124− IFT_MIOX25 = 0x26
125− IFT_MODEM = 0x30
126− IFT_MPC = 0x71
127− IFT_MPLS = 0xa6
128− IFT_MPLSTUNNEL = 0x96
129− IFT_MSDSL = 0x8f
130− IFT_MVL = 0xbf
131− IFT_MYRINET = 0x63
132− IFT_NFAS = 0xaf
133− IFT_NSIP = 0x1b
134− IFT_OPTICALCHANNEL = 0xc3
135− IFT_OPTICALTRANSPORT = 0xc4
136− IFT_OTHER = 0x1
137− IFT_P10 = 0xc
138− IFT_P80 = 0xd
139− IFT_PARA = 0x22
140− IFT_PFLOG = 0xf6
141− IFT_PFSYNC = 0xf7
142− IFT_PLC = 0xae
143− IFT_POS = 0xab
144− IFT_PPPMULTILINKBUNDLE = 0x6c
145− IFT_PROPBWAP2MP = 0xb8
146− IFT_PROPCNLS = 0x59
147− IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
148− IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
149− IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
150− IFT_PROPMUX = 0x36
151− IFT_PROPWIRELESSP2P = 0x9d
152− IFT_PTPSERIAL = 0x16
153− IFT_PVC = 0xf1
154− IFT_QLLC = 0x44
155− IFT_RADIOMAC = 0xbc
156− IFT_RADSL = 0x5f
157− IFT_REACHDSL = 0xc0
158− IFT_RFC1483 = 0x9f
159− IFT_RS232 = 0x21
160− IFT_RSRB = 0x4f
161− IFT_SDLC = 0x11
162− IFT_SDSL = 0x60
163− IFT_SHDSL = 0xa9
164− IFT_SIP = 0x1f
165− IFT_SLIP = 0x1c
166− IFT_SMDSDXI = 0x2b
167− IFT_SMDSICIP = 0x34
168− IFT_SONET = 0x27
169− IFT_SONETOVERHEADCHANNEL = 0xb9
170− IFT_SONETPATH = 0x32
171− IFT_SONETVT = 0x33
172− IFT_SRP = 0x97
173− IFT_SS7SIGLINK = 0x9c
174− IFT_STACKTOSTACK = 0x6f
175− IFT_STARLAN = 0xb
176− IFT_STF = 0xd7
177− IFT_T1 = 0x12
178− IFT_TDLC = 0x74
179− IFT_TERMPAD = 0x5b
180− IFT_TR008 = 0xb0
181− IFT_TRANSPHDLC = 0x7b
182− IFT_TUNNEL = 0x83
183− IFT_ULTRA = 0x1d
184− IFT_USB = 0xa0
185− IFT_V11 = 0x40
186− IFT_V35 = 0x2d
187− IFT_V36 = 0x41
188− IFT_V37 = 0x78
189− IFT_VDSL = 0x61
190− IFT_VIRTUALIPADDRESS = 0x70
191− IFT_VOICEEM = 0x64
192− IFT_VOICEENCAP = 0x67
193− IFT_VOICEFXO = 0x65
194− IFT_VOICEFXS = 0x66
195− IFT_VOICEOVERATM = 0x98
196− IFT_VOICEOVERFRAMERELAY = 0x99
197− IFT_VOICEOVERIP = 0x68
198− IFT_X213 = 0x5d
199− IFT_X25 = 0x5
200− IFT_X25DDN = 0x4
201− IFT_X25HUNTGROUP = 0x7a
202− IFT_X25MLP = 0x79
203− IFT_X25PLE = 0x28
204− IFT_XETHER = 0x1a
205−
206− // missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go
207− IFF_SMART = 0x20
208− IFT_FAITH = 0xf2
209− IFT_IPXIP = 0xf9
210− IPPROTO_MAXID = 0x34
211− IPV6_FAITH = 0x1d
212− IP_FAITH = 0x16
213− MAP_NORESERVE = 0x40
214− MAP_RENAME = 0x20
215− NET_RT_MAXID = 0x6
216− RTF_PRCLONING = 0x10000
217− RTM_OLDADD = 0x9
218− RTM_OLDDEL = 0xa
219− SIOCADDRT = 0x8030720a
220− SIOCALIFADDR = 0x8118691b
221− SIOCDELRT = 0x8030720b
222− SIOCDLIFADDR = 0x8118691d
223− SIOCGLIFADDR = 0xc118691c
224− SIOCGLIFPHYADDR = 0xc118694b
225− SIOCSLIFPHYADDR = 0x8118694a
226−)
vendor/golang.org/x/sys/unix/errors_freebsd_arm64.godeleted−17
@@ -1,17 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
6−// them here for backwards compatibility.
7−
8−package unix
9−
10−const (
11− DLT_HHDLC = 0x79
12− IPV6_MIN_MEMBERSHIPS = 0x1f
13− IP_MAX_SOURCE_FILTER = 0x400
14− IP_MIN_MEMBERSHIPS = 0x1f
15− RT_CACHING_CONTEXT = 0x1
16− RT_NORTREF = 0x2
17−)
vendor/golang.org/x/sys/unix/fcntl.godeleted−37
@@ -1,37 +0,0 @@
1−// Copyright 2014 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build dragonfly || freebsd || linux || netbsd || openbsd
6−// +build dragonfly freebsd linux netbsd openbsd
7−
8−package unix
9−
10−import "unsafe"
11−
12−// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
13−// systems by fcntl_linux_32bit.go to be SYS_FCNTL64.
14−var fcntl64Syscall uintptr = SYS_FCNTL
15−
16−func fcntl(fd int, cmd, arg int) (int, error) {
17− valptr, _, errno := Syscall(fcntl64Syscall, uintptr(fd), uintptr(cmd), uintptr(arg))
18− var err error
19− if errno != 0 {
20− err = errno
21− }
22− return int(valptr), err
23−}
24−
25−// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
26−func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
27− return fcntl(int(fd), cmd, arg)
28−}
29−
30−// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
31−func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
32− _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
33− if errno == 0 {
34− return nil
35− }
36− return errno
37−}
vendor/golang.org/x/sys/unix/fcntl_darwin.godeleted−24
@@ -1,24 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−package unix
6−
7−import "unsafe"
8−
9−// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
10−func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
11− return fcntl(int(fd), cmd, arg)
12−}
13−
14−// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
15−func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
16− _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
17− return err
18−}
19−
20−// FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command.
21−func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error {
22− _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore))))
23− return err
24−}
vendor/golang.org/x/sys/unix/fcntl_linux_32bit.godeleted−14
@@ -1,14 +0,0 @@
1−// Copyright 2014 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle)
6−// +build linux,386 linux,arm linux,mips linux,mipsle
7−
8−package unix
9−
10−func init() {
11− // On 32-bit Linux systems, the fcntl syscall that matches Go's
12− // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
13− fcntl64Syscall = SYS_FCNTL64
14−}
vendor/golang.org/x/sys/unix/fdset.godeleted−30
@@ -1,30 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
7−
8−package unix
9−
10−// Set adds fd to the set fds.
11−func (fds *FdSet) Set(fd int) {
12− fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS))
13−}
14−
15−// Clear removes fd from the set fds.
16−func (fds *FdSet) Clear(fd int) {
17− fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS))
18−}
19−
20−// IsSet returns whether fd is in the set fds.
21−func (fds *FdSet) IsSet(fd int) bool {
22− return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 0
23−}
24−
25−// Zero clears the set fds.
26−func (fds *FdSet) Zero() {
27− for i := range fds.Bits {
28− fds.Bits[i] = 0
29− }
30−}
vendor/golang.org/x/sys/unix/fstatfs_zos.godeleted−164
@@ -1,164 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build zos && s390x
6−// +build zos,s390x
7−
8−package unix
9−
10−import (
11− "unsafe"
12−)
13−
14−// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent.
15−
16−func Fstatfs(fd int, stat *Statfs_t) (err error) {
17− var stat_v Statvfs_t
18− err = Fstatvfs(fd, &stat_v)
19− if err == nil {
20− // populate stat
21− stat.Type = 0
22− stat.Bsize = stat_v.Bsize
23− stat.Blocks = stat_v.Blocks
24− stat.Bfree = stat_v.Bfree
25− stat.Bavail = stat_v.Bavail
26− stat.Files = stat_v.Files
27− stat.Ffree = stat_v.Ffree
28− stat.Fsid = stat_v.Fsid
29− stat.Namelen = stat_v.Namemax
30− stat.Frsize = stat_v.Frsize
31− stat.Flags = stat_v.Flag
32− for passn := 0; passn < 5; passn++ {
33− switch passn {
34− case 0:
35− err = tryGetmntent64(stat)
36− break
37− case 1:
38− err = tryGetmntent128(stat)
39− break
40− case 2:
41− err = tryGetmntent256(stat)
42− break
43− case 3:
44− err = tryGetmntent512(stat)
45− break
46− case 4:
47− err = tryGetmntent1024(stat)
48− break
49− default:
50− break
51− }
52− //proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred)
53− if err == nil || err != nil && err != ERANGE {
54− break
55− }
56− }
57− }
58− return err
59−}
60−
61−func tryGetmntent64(stat *Statfs_t) (err error) {
62− var mnt_ent_buffer struct {
63− header W_Mnth
64− filesys_info [64]W_Mntent
65− }
66− var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
67− fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
68− if err != nil {
69− return err
70− }
71− err = ERANGE //return ERANGE if no match is found in this batch
72− for i := 0; i < fs_count; i++ {
73− if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
74− stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
75− err = nil
76− break
77− }
78− }
79− return err
80−}
81−
82−func tryGetmntent128(stat *Statfs_t) (err error) {
83− var mnt_ent_buffer struct {
84− header W_Mnth
85− filesys_info [128]W_Mntent
86− }
87− var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
88− fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
89− if err != nil {
90− return err
91− }
92− err = ERANGE //return ERANGE if no match is found in this batch
93− for i := 0; i < fs_count; i++ {
94− if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
95− stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
96− err = nil
97− break
98− }
99− }
100− return err
101−}
102−
103−func tryGetmntent256(stat *Statfs_t) (err error) {
104− var mnt_ent_buffer struct {
105− header W_Mnth
106− filesys_info [256]W_Mntent
107− }
108− var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
109− fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
110− if err != nil {
111− return err
112− }
113− err = ERANGE //return ERANGE if no match is found in this batch
114− for i := 0; i < fs_count; i++ {
115− if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
116− stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
117− err = nil
118− break
119− }
120− }
121− return err
122−}
123−
124−func tryGetmntent512(stat *Statfs_t) (err error) {
125− var mnt_ent_buffer struct {
126− header W_Mnth
127− filesys_info [512]W_Mntent
128− }
129− var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
130− fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
131− if err != nil {
132− return err
133− }
134− err = ERANGE //return ERANGE if no match is found in this batch
135− for i := 0; i < fs_count; i++ {
136− if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
137− stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
138− err = nil
139− break
140− }
141− }
142− return err
143−}
144−
145−func tryGetmntent1024(stat *Statfs_t) (err error) {
146− var mnt_ent_buffer struct {
147− header W_Mnth
148− filesys_info [1024]W_Mntent
149− }
150− var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
151− fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
152− if err != nil {
153− return err
154− }
155− err = ERANGE //return ERANGE if no match is found in this batch
156− for i := 0; i < fs_count; i++ {
157− if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
158− stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
159− err = nil
160− break
161− }
162− }
163− return err
164−}
vendor/golang.org/x/sys/unix/gccgo.godeleted−60
@@ -1,60 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build gccgo && !aix
6−// +build gccgo,!aix
7−
8−package unix
9−
10−import "syscall"
11−
12−// We can't use the gc-syntax .s files for gccgo. On the plus side
13−// much of the functionality can be written directly in Go.
14−
15−func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
16−
17−func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
18−
19−func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
20− syscall.Entersyscall()
21− r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
22− syscall.Exitsyscall()
23− return r, 0
24−}
25−
26−func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
27− syscall.Entersyscall()
28− r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
29− syscall.Exitsyscall()
30− return r, 0, syscall.Errno(errno)
31−}
32−
33−func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
34− syscall.Entersyscall()
35− r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
36− syscall.Exitsyscall()
37− return r, 0, syscall.Errno(errno)
38−}
39−
40−func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
41− syscall.Entersyscall()
42− r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
43− syscall.Exitsyscall()
44− return r, 0, syscall.Errno(errno)
45−}
46−
47−func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
48− r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
49− return r, 0
50−}
51−
52−func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
53− r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
54− return r, 0, syscall.Errno(errno)
55−}
56−
57−func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
58− r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
59− return r, 0, syscall.Errno(errno)
60−}
vendor/golang.org/x/sys/unix/gccgo_c.cdeleted−45
@@ -1,45 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// +build gccgo
6−// +build !aix
7−
8−#include <errno.h>
9−#include <stdint.h>
10−#include <unistd.h>
11−
12−#define _STRINGIFY2_(x) #x
13−#define _STRINGIFY_(x) _STRINGIFY2_(x)
14−#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
15−
16−// Call syscall from C code because the gccgo support for calling from
17−// Go to C does not support varargs functions.
18−
19−struct ret {
20− uintptr_t r;
21− uintptr_t err;
22−};
23−
24−struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
25− __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscall");
26−
27−struct ret
28−gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
29−{
30− struct ret r;
31−
32− errno = 0;
33− r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
34− r.err = errno;
35− return r;
36−}
37−
38−uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
39− __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscallNoError");
40−
41−uintptr_t
42−gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
43−{
44− return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
45−}
vendor/golang.org/x/sys/unix/gccgo_linux_amd64.godeleted−21
@@ -1,21 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build gccgo && linux && amd64
6−// +build gccgo,linux,amd64
7−
8−package unix
9−
10−import "syscall"
11−
12−//extern gettimeofday
13−func realGettimeofday(*Timeval, *byte) int32
14−
15−func gettimeofday(tv *Timeval) (err syscall.Errno) {
16− r := realGettimeofday(tv, nil)
17− if r < 0 {
18− return syscall.GetErrno()
19− }
20− return 0
21−}
vendor/golang.org/x/sys/unix/ioctl.godeleted−75
@@ -1,75 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
7−
8−package unix
9−
10−import (
11− "runtime"
12− "unsafe"
13−)
14−
15−// ioctl itself should not be exposed directly, but additional get/set
16−// functions for specific types are permissible.
17−
18−// IoctlSetInt performs an ioctl operation which sets an integer value
19−// on fd, using the specified request number.
20−func IoctlSetInt(fd int, req uint, value int) error {
21− return ioctl(fd, req, uintptr(value))
22−}
23−
24−// IoctlSetPointerInt performs an ioctl operation which sets an
25−// integer value on fd, using the specified request number. The ioctl
26−// argument is called with a pointer to the integer value, rather than
27−// passing the integer value directly.
28−func IoctlSetPointerInt(fd int, req uint, value int) error {
29− v := int32(value)
30− return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
31−}
32−
33−// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
34−//
35−// To change fd's window size, the req argument should be TIOCSWINSZ.
36−func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
37− // TODO: if we get the chance, remove the req parameter and
38− // hardcode TIOCSWINSZ.
39− err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
40− runtime.KeepAlive(value)
41− return err
42−}
43−
44−// IoctlSetTermios performs an ioctl on fd with a *Termios.
45−//
46−// The req value will usually be TCSETA or TIOCSETA.
47−func IoctlSetTermios(fd int, req uint, value *Termios) error {
48− // TODO: if we get the chance, remove the req parameter.
49− err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
50− runtime.KeepAlive(value)
51− return err
52−}
53−
54−// IoctlGetInt performs an ioctl operation which gets an integer value
55−// from fd, using the specified request number.
56−//
57−// A few ioctl requests use the return value as an output parameter;
58−// for those, IoctlRetInt should be used instead of this function.
59−func IoctlGetInt(fd int, req uint) (int, error) {
60− var value int
61− err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
62− return value, err
63−}
64−
65−func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
66− var value Winsize
67− err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
68− return &value, err
69−}
70−
71−func IoctlGetTermios(fd int, req uint) (*Termios, error) {
72− var value Termios
73− err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
74− return &value, err
75−}
vendor/golang.org/x/sys/unix/ioctl_zos.godeleted−74
@@ -1,74 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build zos && s390x
6−// +build zos,s390x
7−
8−package unix
9−
10−import (
11− "runtime"
12− "unsafe"
13−)
14−
15−// ioctl itself should not be exposed directly, but additional get/set
16−// functions for specific types are permissible.
17−
18−// IoctlSetInt performs an ioctl operation which sets an integer value
19−// on fd, using the specified request number.
20−func IoctlSetInt(fd int, req uint, value int) error {
21− return ioctl(fd, req, uintptr(value))
22−}
23−
24−// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
25−//
26−// To change fd's window size, the req argument should be TIOCSWINSZ.
27−func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
28− // TODO: if we get the chance, remove the req parameter and
29− // hardcode TIOCSWINSZ.
30− err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
31− runtime.KeepAlive(value)
32− return err
33−}
34−
35−// IoctlSetTermios performs an ioctl on fd with a *Termios.
36−//
37−// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
38−func IoctlSetTermios(fd int, req uint, value *Termios) error {
39− if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
40− return ENOSYS
41− }
42− err := Tcsetattr(fd, int(req), value)
43− runtime.KeepAlive(value)
44− return err
45−}
46−
47−// IoctlGetInt performs an ioctl operation which gets an integer value
48−// from fd, using the specified request number.
49−//
50−// A few ioctl requests use the return value as an output parameter;
51−// for those, IoctlRetInt should be used instead of this function.
52−func IoctlGetInt(fd int, req uint) (int, error) {
53− var value int
54− err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
55− return value, err
56−}
57−
58−func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
59− var value Winsize
60− err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
61− return &value, err
62−}
63−
64−// IoctlGetTermios performs an ioctl on fd with a *Termios.
65−//
66−// The req value is expected to be TCGETS
67−func IoctlGetTermios(fd int, req uint) (*Termios, error) {
68− var value Termios
69− if req != TCGETS {
70− return &value, ENOSYS
71− }
72− err := Tcgetattr(fd, &value)
73− return &value, err
74−}
vendor/golang.org/x/sys/unix/mkall.shdeleted−243
@@ -1,243 +0,0 @@
1−#!/usr/bin/env bash
2−# Copyright 2009 The Go Authors. All rights reserved.
3−# Use of this source code is governed by a BSD-style
4−# license that can be found in the LICENSE file.
5−
6−# This script runs or (given -n) prints suggested commands to generate files for
7−# the Architecture/OS specified by the GOARCH and GOOS environment variables.
8−# See README.md for more information about how the build system works.
9−
10−GOOSARCH="${GOOS}_${GOARCH}"
11−
12−# defaults
13−mksyscall="go run mksyscall.go"
14−mkerrors="./mkerrors.sh"
15−zerrors="zerrors_$GOOSARCH.go"
16−mksysctl=""
17−zsysctl="zsysctl_$GOOSARCH.go"
18−mksysnum=
19−mktypes=
20−mkasm=
21−run="sh"
22−cmd=""
23−
24−case "$1" in
25−-syscalls)
26− for i in zsyscall*go
27− do
28− # Run the command line that appears in the first line
29− # of the generated file to regenerate it.
30− sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
31− rm _$i
32− done
33− exit 0
34− ;;
35−-n)
36− run="cat"
37− cmd="echo"
38− shift
39−esac
40−
41−case "$#" in
42−0)
43− ;;
44−*)
45− echo 'usage: mkall.sh [-n]' 1>&2
46− exit 2
47−esac
48−
49−if [[ "$GOOS" = "linux" ]]; then
50− # Use the Docker-based build system
51− # Files generated through docker (use $cmd so you can Ctl-C the build or run)
52− $cmd docker build --tag generate:$GOOS $GOOS
53− $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS
54− exit
55−fi
56−
57−GOOSARCH_in=syscall_$GOOSARCH.go
58−case "$GOOSARCH" in
59−_* | *_ | _)
60− echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
61− exit 1
62− ;;
63−aix_ppc)
64− mkerrors="$mkerrors -maix32"
65− mksyscall="go run mksyscall_aix_ppc.go -aix"
66− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
67− ;;
68−aix_ppc64)
69− mkerrors="$mkerrors -maix64"
70− mksyscall="go run mksyscall_aix_ppc64.go -aix"
71− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
72− ;;
73−darwin_386)
74− mkerrors="$mkerrors -m32"
75− mksyscall="go run mksyscall.go -l32"
76− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
77− mkasm="go run mkasm_darwin.go"
78− ;;
79−darwin_amd64)
80− mkerrors="$mkerrors -m64"
81− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
82− mkasm="go run mkasm_darwin.go"
83− ;;
84−darwin_arm)
85− mkerrors="$mkerrors"
86− mksyscall="go run mksyscall.go -l32"
87− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
88− mkasm="go run mkasm_darwin.go"
89− ;;
90−darwin_arm64)
91− mkerrors="$mkerrors -m64"
92− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
93− mkasm="go run mkasm_darwin.go"
94− ;;
95−dragonfly_amd64)
96− mkerrors="$mkerrors -m64"
97− mksyscall="go run mksyscall.go -dragonfly"
98− mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
99− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
100− ;;
101−freebsd_386)
102− mkerrors="$mkerrors -m32"
103− mksyscall="go run mksyscall.go -l32"
104− mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
105− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
106− ;;
107−freebsd_amd64)
108− mkerrors="$mkerrors -m64"
109− mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
110− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
111− ;;
112−freebsd_arm)
113− mkerrors="$mkerrors"
114− mksyscall="go run mksyscall.go -l32 -arm"
115− mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
116− # Let the type of C char be signed for making the bare syscall
117− # API consistent across platforms.
118− mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
119− ;;
120−freebsd_arm64)
121− mkerrors="$mkerrors -m64"
122− mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
123− mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
124− ;;
125−netbsd_386)
126− mkerrors="$mkerrors -m32"
127− mksyscall="go run mksyscall.go -l32 -netbsd"
128− mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
129− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
130− ;;
131−netbsd_amd64)
132− mkerrors="$mkerrors -m64"
133− mksyscall="go run mksyscall.go -netbsd"
134− mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
135− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
136− ;;
137−netbsd_arm)
138− mkerrors="$mkerrors"
139− mksyscall="go run mksyscall.go -l32 -netbsd -arm"
140− mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
141− # Let the type of C char be signed for making the bare syscall
142− # API consistent across platforms.
143− mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
144− ;;
145−netbsd_arm64)
146− mkerrors="$mkerrors -m64"
147− mksyscall="go run mksyscall.go -netbsd"
148− mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
149− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
150− ;;
151−openbsd_386)
152− mkerrors="$mkerrors -m32"
153− mksyscall="go run mksyscall.go -l32 -openbsd"
154− mksysctl="go run mksysctl_openbsd.go"
155− mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
156− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
157− ;;
158−openbsd_amd64)
159− mkerrors="$mkerrors -m64"
160− mksyscall="go run mksyscall.go -openbsd"
161− mksysctl="go run mksysctl_openbsd.go"
162− mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
163− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
164− ;;
165−openbsd_arm)
166− mkerrors="$mkerrors"
167− mksyscall="go run mksyscall.go -l32 -openbsd -arm"
168− mksysctl="go run mksysctl_openbsd.go"
169− mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
170− # Let the type of C char be signed for making the bare syscall
171− # API consistent across platforms.
172− mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
173− ;;
174−openbsd_arm64)
175− mkerrors="$mkerrors -m64"
176− mksyscall="go run mksyscall.go -openbsd"
177− mksysctl="go run mksysctl_openbsd.go"
178− mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
179− # Let the type of C char be signed for making the bare syscall
180− # API consistent across platforms.
181− mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
182− ;;
183−openbsd_mips64)
184− mkerrors="$mkerrors -m64"
185− mksyscall="go run mksyscall.go -openbsd"
186− mksysctl="go run mksysctl_openbsd.go"
187− mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
188− # Let the type of C char be signed for making the bare syscall
189− # API consistent across platforms.
190− mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
191− ;;
192−solaris_amd64)
193− mksyscall="go run mksyscall_solaris.go"
194− mkerrors="$mkerrors -m64"
195− mksysnum=
196− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
197− ;;
198−illumos_amd64)
199− mksyscall="go run mksyscall_solaris.go"
200− mkerrors=
201− mksysnum=
202− mktypes="GOARCH=$GOARCH go tool cgo -godefs"
203− ;;
204−*)
205− echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
206− exit 1
207− ;;
208−esac
209−
210−(
211− if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
212− case "$GOOS" in
213− *)
214− syscall_goos="syscall_$GOOS.go"
215− case "$GOOS" in
216− darwin | dragonfly | freebsd | netbsd | openbsd)
217− syscall_goos="syscall_bsd.go $syscall_goos"
218− ;;
219− esac
220− if [ -n "$mksyscall" ]; then
221− if [ "$GOOSARCH" == "aix_ppc64" ]; then
222− # aix/ppc64 script generates files instead of writing to stdin.
223− echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
224− elif [ "$GOOS" == "darwin" ]; then
225− # 1.12 and later, syscalls via libSystem
226− echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
227− # 1.13 and later, syscalls via libSystem (including syscallPtr)
228− echo "$mksyscall -tags $GOOS,$GOARCH,go1.13 syscall_darwin.1_13.go |gofmt >zsyscall_$GOOSARCH.1_13.go";
229− elif [ "$GOOS" == "illumos" ]; then
230− # illumos code generation requires a --illumos switch
231− echo "$mksyscall -illumos -tags illumos,$GOARCH syscall_illumos.go |gofmt > zsyscall_illumos_$GOARCH.go";
232− # illumos implies solaris, so solaris code generation is also required
233− echo "$mksyscall -tags solaris,$GOARCH syscall_solaris.go syscall_solaris_$GOARCH.go |gofmt >zsyscall_solaris_$GOARCH.go";
234− else
235− echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
236− fi
237− fi
238− esac
239− if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
240− if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
241− if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
242− if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
243−) | $run
vendor/golang.org/x/sys/unix/mkerrors.shdeleted−750
@@ -1,750 +0,0 @@
1−#!/usr/bin/env bash
2−# Copyright 2009 The Go Authors. All rights reserved.
3−# Use of this source code is governed by a BSD-style
4−# license that can be found in the LICENSE file.
5−
6−# Generate Go code listing errors and other #defined constant
7−# values (ENAMETOOLONG etc.), by asking the preprocessor
8−# about the definitions.
9−
10−unset LANG
11−export LC_ALL=C
12−export LC_CTYPE=C
13−
14−if test -z "$GOARCH" -o -z "$GOOS"; then
15− echo 1>&2 "GOARCH or GOOS not defined in environment"
16− exit 1
17−fi
18−
19−# Check that we are using the new build system if we should
20−if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
21− echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
22− echo 1>&2 "See README.md"
23− exit 1
24−fi
25−
26−if [[ "$GOOS" = "aix" ]]; then
27− CC=${CC:-gcc}
28−else
29− CC=${CC:-cc}
30−fi
31−
32−if [[ "$GOOS" = "solaris" ]]; then
33− # Assumes GNU versions of utilities in PATH.
34− export PATH=/usr/gnu/bin:$PATH
35−fi
36−
37−uname=$(uname)
38−
39−includes_AIX='
40−#include <net/if.h>
41−#include <net/netopt.h>
42−#include <netinet/ip_mroute.h>
43−#include <sys/protosw.h>
44−#include <sys/stropts.h>
45−#include <sys/mman.h>
46−#include <sys/poll.h>
47−#include <sys/select.h>
48−#include <sys/termio.h>
49−#include <termios.h>
50−#include <fcntl.h>
51−
52−#define AF_LOCAL AF_UNIX
53−'
54−
55−includes_Darwin='
56−#define _DARWIN_C_SOURCE
57−#define KERNEL
58−#define _DARWIN_USE_64_BIT_INODE
59−#define __APPLE_USE_RFC_3542
60−#include <stdint.h>
61−#include <sys/attr.h>
62−#include <sys/clonefile.h>
63−#include <sys/kern_control.h>
64−#include <sys/types.h>
65−#include <sys/event.h>
66−#include <sys/ptrace.h>
67−#include <sys/select.h>
68−#include <sys/socket.h>
69−#include <sys/un.h>
70−#include <sys/sockio.h>
71−#include <sys/sys_domain.h>
72−#include <sys/sysctl.h>
73−#include <sys/mman.h>
74−#include <sys/mount.h>
75−#include <sys/utsname.h>
76−#include <sys/wait.h>
77−#include <sys/xattr.h>
78−#include <net/bpf.h>
79−#include <net/if.h>
80−#include <net/if_types.h>
81−#include <net/route.h>
82−#include <netinet/in.h>
83−#include <netinet/ip.h>
84−#include <termios.h>
85−'
86−
87−includes_DragonFly='
88−#include <sys/types.h>
89−#include <sys/event.h>
90−#include <sys/select.h>
91−#include <sys/socket.h>
92−#include <sys/sockio.h>
93−#include <sys/stat.h>
94−#include <sys/sysctl.h>
95−#include <sys/mman.h>
96−#include <sys/mount.h>
97−#include <sys/wait.h>
98−#include <sys/ioctl.h>
99−#include <net/bpf.h>
100−#include <net/if.h>
101−#include <net/if_clone.h>
102−#include <net/if_types.h>
103−#include <net/route.h>
104−#include <netinet/in.h>
105−#include <termios.h>
106−#include <netinet/ip.h>
107−#include <net/ip_mroute/ip_mroute.h>
108−'
109−
110−includes_FreeBSD='
111−#include <sys/capsicum.h>
112−#include <sys/param.h>
113−#include <sys/types.h>
114−#include <sys/disk.h>
115−#include <sys/event.h>
116−#include <sys/sched.h>
117−#include <sys/select.h>
118−#include <sys/socket.h>
119−#include <sys/un.h>
120−#include <sys/sockio.h>
121−#include <sys/stat.h>
122−#include <sys/sysctl.h>
123−#include <sys/mman.h>
124−#include <sys/mount.h>
125−#include <sys/wait.h>
126−#include <sys/ioctl.h>
127−#include <net/bpf.h>
128−#include <net/if.h>
129−#include <net/if_types.h>
130−#include <net/route.h>
131−#include <netinet/in.h>
132−#include <termios.h>
133−#include <netinet/ip.h>
134−#include <netinet/ip_mroute.h>
135−#include <sys/extattr.h>
136−
137−#if __FreeBSD__ >= 10
138−#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
139−#undef SIOCAIFADDR
140−#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
141−#undef SIOCSIFPHYADDR
142−#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
143−#endif
144−'
145−
146−includes_Linux='
147−#define _LARGEFILE_SOURCE
148−#define _LARGEFILE64_SOURCE
149−#ifndef __LP64__
150−#define _FILE_OFFSET_BITS 64
151−#endif
152−#define _GNU_SOURCE
153−
154−// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
155−// these structures. We just include them copied from <bits/termios.h>.
156−#if defined(__powerpc__)
157−struct sgttyb {
158− char sg_ispeed;
159− char sg_ospeed;
160− char sg_erase;
161− char sg_kill;
162− short sg_flags;
163−};
164−
165−struct tchars {
166− char t_intrc;
167− char t_quitc;
168− char t_startc;
169− char t_stopc;
170− char t_eofc;
171− char t_brkc;
172−};
173−
174−struct ltchars {
175− char t_suspc;
176− char t_dsuspc;
177− char t_rprntc;
178− char t_flushc;
179− char t_werasc;
180− char t_lnextc;
181−};
182−#endif
183−
184−#include <bits/sockaddr.h>
185−#include <sys/epoll.h>
186−#include <sys/eventfd.h>
187−#include <sys/inotify.h>
188−#include <sys/ioctl.h>
189−#include <sys/mman.h>
190−#include <sys/mount.h>
191−#include <sys/prctl.h>
192−#include <sys/stat.h>
193−#include <sys/types.h>
194−#include <sys/time.h>
195−#include <sys/select.h>
196−#include <sys/signalfd.h>
197−#include <sys/socket.h>
198−#include <sys/timerfd.h>
199−#include <sys/uio.h>
200−#include <sys/xattr.h>
201−#include <linux/bpf.h>
202−#include <linux/can.h>
203−#include <linux/can/error.h>
204−#include <linux/can/raw.h>
205−#include <linux/capability.h>
206−#include <linux/cryptouser.h>
207−#include <linux/devlink.h>
208−#include <linux/dm-ioctl.h>
209−#include <linux/errqueue.h>
210−#include <linux/ethtool_netlink.h>
211−#include <linux/falloc.h>
212−#include <linux/fanotify.h>
213−#include <linux/filter.h>
214−#include <linux/fs.h>
215−#include <linux/fscrypt.h>
216−#include <linux/fsverity.h>
217−#include <linux/genetlink.h>
218−#include <linux/hdreg.h>
219−#include <linux/hidraw.h>
220−#include <linux/icmp.h>
221−#include <linux/icmpv6.h>
222−#include <linux/if.h>
223−#include <linux/if_addr.h>
224−#include <linux/if_alg.h>
225−#include <linux/if_arp.h>
226−#include <linux/if_ether.h>
227−#include <linux/if_ppp.h>
228−#include <linux/if_tun.h>
229−#include <linux/if_packet.h>
230−#include <linux/if_xdp.h>
231−#include <linux/input.h>
232−#include <linux/kexec.h>
233−#include <linux/keyctl.h>
234−#include <linux/loop.h>
235−#include <linux/lwtunnel.h>
236−#include <linux/magic.h>
237−#include <linux/memfd.h>
238−#include <linux/module.h>
239−#include <linux/netfilter/nfnetlink.h>
240−#include <linux/netlink.h>
241−#include <linux/net_namespace.h>
242−#include <linux/nsfs.h>
243−#include <linux/perf_event.h>
244−#include <linux/pps.h>
245−#include <linux/ptrace.h>
246−#include <linux/random.h>
247−#include <linux/reboot.h>
248−#include <linux/rtc.h>
249−#include <linux/rtnetlink.h>
250−#include <linux/sched.h>
251−#include <linux/seccomp.h>
252−#include <linux/serial.h>
253−#include <linux/sockios.h>
254−#include <linux/taskstats.h>
255−#include <linux/tipc.h>
256−#include <linux/vm_sockets.h>
257−#include <linux/wait.h>
258−#include <linux/watchdog.h>
259−
260−#include <mtd/ubi-user.h>
261−#include <net/route.h>
262−
263−#if defined(__sparc__)
264−// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
265−// definition in glibc. As only the error constants are needed here, include the
266−// generic termibits.h (which is included by termbits.h on sparc).
267−#include <asm-generic/termbits.h>
268−#else
269−#include <asm/termbits.h>
270−#endif
271−
272−#ifndef MSG_FASTOPEN
273−#define MSG_FASTOPEN 0x20000000
274−#endif
275−
276−#ifndef PTRACE_GETREGS
277−#define PTRACE_GETREGS 0xc
278−#endif
279−
280−#ifndef PTRACE_SETREGS
281−#define PTRACE_SETREGS 0xd
282−#endif
283−
284−#ifndef SOL_NETLINK
285−#define SOL_NETLINK 270
286−#endif
287−
288−#ifdef SOL_BLUETOOTH
289−// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
290−// but it is already in bluetooth_linux.go
291−#undef SOL_BLUETOOTH
292−#endif
293−
294−// Certain constants are missing from the fs/crypto UAPI
295−#define FS_KEY_DESC_PREFIX "fscrypt:"
296−#define FS_KEY_DESC_PREFIX_SIZE 8
297−#define FS_MAX_KEY_SIZE 64
298−
299−// The code generator produces -0x1 for (~0), but an unsigned value is necessary
300−// for the tipc_subscr timeout __u32 field.
301−#undef TIPC_WAIT_FOREVER
302−#define TIPC_WAIT_FOREVER 0xffffffff
303−
304−// Copied from linux/l2tp.h
305−// Including linux/l2tp.h here causes conflicts between linux/in.h
306−// and netinet/in.h included via net/route.h above.
307−#define IPPROTO_L2TP 115
308−
309−// Copied from linux/hid.h.
310−// Keep in sync with the size of the referenced fields.
311−#define _HIDIOCGRAWNAME_LEN 128 // sizeof_field(struct hid_device, name)
312−#define _HIDIOCGRAWPHYS_LEN 64 // sizeof_field(struct hid_device, phys)
313−#define _HIDIOCGRAWUNIQ_LEN 64 // sizeof_field(struct hid_device, uniq)
314−
315−#define _HIDIOCGRAWNAME HIDIOCGRAWNAME(_HIDIOCGRAWNAME_LEN)
316−#define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN)
317−#define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN)
318−
319−'
320−
321−includes_NetBSD='
322−#include <sys/types.h>
323−#include <sys/param.h>
324−#include <sys/event.h>
325−#include <sys/extattr.h>
326−#include <sys/mman.h>
327−#include <sys/mount.h>
328−#include <sys/sched.h>
329−#include <sys/select.h>
330−#include <sys/socket.h>
331−#include <sys/sockio.h>
332−#include <sys/sysctl.h>
333−#include <sys/termios.h>
334−#include <sys/ttycom.h>
335−#include <sys/wait.h>
336−#include <net/bpf.h>
337−#include <net/if.h>
338−#include <net/if_types.h>
339−#include <net/route.h>
340−#include <netinet/in.h>
341−#include <netinet/in_systm.h>
342−#include <netinet/ip.h>
343−#include <netinet/ip_mroute.h>
344−#include <netinet/if_ether.h>
345−
346−// Needed since <sys/param.h> refers to it...
347−#define schedppq 1
348−'
349−
350−includes_OpenBSD='
351−#include <sys/types.h>
352−#include <sys/param.h>
353−#include <sys/event.h>
354−#include <sys/mman.h>
355−#include <sys/mount.h>
356−#include <sys/select.h>
357−#include <sys/sched.h>
358−#include <sys/socket.h>
359−#include <sys/sockio.h>
360−#include <sys/stat.h>
361−#include <sys/sysctl.h>
362−#include <sys/termios.h>
363−#include <sys/ttycom.h>
364−#include <sys/unistd.h>
365−#include <sys/wait.h>
366−#include <net/bpf.h>
367−#include <net/if.h>
368−#include <net/if_types.h>
369−#include <net/if_var.h>
370−#include <net/route.h>
371−#include <netinet/in.h>
372−#include <netinet/in_systm.h>
373−#include <netinet/ip.h>
374−#include <netinet/ip_mroute.h>
375−#include <netinet/if_ether.h>
376−#include <net/if_bridge.h>
377−
378−// We keep some constants not supported in OpenBSD 5.5 and beyond for
379−// the promise of compatibility.
380−#define EMUL_ENABLED 0x1
381−#define EMUL_NATIVE 0x2
382−#define IPV6_FAITH 0x1d
383−#define IPV6_OPTIONS 0x1
384−#define IPV6_RTHDR_STRICT 0x1
385−#define IPV6_SOCKOPT_RESERVED1 0x3
386−#define SIOCGIFGENERIC 0xc020693a
387−#define SIOCSIFGENERIC 0x80206939
388−#define WALTSIG 0x4
389−'
390−
391−includes_SunOS='
392−#include <limits.h>
393−#include <sys/types.h>
394−#include <sys/select.h>
395−#include <sys/socket.h>
396−#include <sys/sockio.h>
397−#include <sys/stat.h>
398−#include <sys/stream.h>
399−#include <sys/mman.h>
400−#include <sys/wait.h>
401−#include <sys/ioctl.h>
402−#include <sys/mkdev.h>
403−#include <net/bpf.h>
404−#include <net/if.h>
405−#include <net/if_arp.h>
406−#include <net/if_types.h>
407−#include <net/route.h>
408−#include <netinet/icmp6.h>
409−#include <netinet/in.h>
410−#include <netinet/ip.h>
411−#include <netinet/ip_mroute.h>
412−#include <termios.h>
413−'
414−
415−
416−includes='
417−#include <sys/types.h>
418−#include <sys/file.h>
419−#include <fcntl.h>
420−#include <dirent.h>
421−#include <sys/socket.h>
422−#include <netinet/in.h>
423−#include <netinet/ip.h>
424−#include <netinet/ip6.h>
425−#include <netinet/tcp.h>
426−#include <errno.h>
427−#include <sys/signal.h>
428−#include <signal.h>
429−#include <sys/resource.h>
430−#include <time.h>
431−'
432−ccflags="$@"
433−
434−# Write go tool cgo -godefs input.
435−(
436− echo package unix
437− echo
438− echo '/*'
439− indirect="includes_$(uname)"
440− echo "${!indirect} $includes"
441− echo '*/'
442− echo 'import "C"'
443− echo 'import "syscall"'
444− echo
445− echo 'const ('
446−
447− # The gcc command line prints all the #defines
448− # it encounters while processing the input
449− echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
450− awk '
451− $1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
452−
453− $2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
454− $2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
455− $2 ~ /^(SCM_SRCRT)$/ {next}
456− $2 ~ /^(MAP_FAILED)$/ {next}
457− $2 ~ /^ELF_.*$/ {next}# <asm/elf.h> contains ELF_ARCH, etc.
458−
459− $2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
460− $2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
461−
462− $2 !~ /^ECCAPBITS/ &&
463− $2 !~ /^ETH_/ &&
464− $2 !~ /^EPROC_/ &&
465− $2 !~ /^EQUIV_/ &&
466− $2 !~ /^EXPR_/ &&
467− $2 !~ /^EVIOC/ &&
468− $2 !~ /^EV_/ &&
469− $2 ~ /^E[A-Z0-9_]+$/ ||
470− $2 ~ /^B[0-9_]+$/ ||
471− $2 ~ /^(OLD|NEW)DEV$/ ||
472− $2 == "BOTHER" ||
473− $2 ~ /^CI?BAUD(EX)?$/ ||
474− $2 == "IBSHIFT" ||
475− $2 ~ /^V[A-Z0-9]+$/ ||
476− $2 ~ /^CS[A-Z0-9]/ ||
477− $2 ~ /^I(SIG|CANON|CRNL|UCLC|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
478− $2 ~ /^IGN/ ||
479− $2 ~ /^IX(ON|ANY|OFF)$/ ||
480− $2 ~ /^IN(LCR|PCK)$/ ||
481− $2 !~ "X86_CR3_PCID_NOFLUSH" &&
482− $2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
483− $2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ ||
484− $2 == "BRKINT" ||
485− $2 == "HUPCL" ||
486− $2 == "PENDIN" ||
487− $2 == "TOSTOP" ||
488− $2 == "XCASE" ||
489− $2 == "ALTWERASE" ||
490− $2 == "NOKERNINFO" ||
491− $2 == "NFDBITS" ||
492− $2 ~ /^PAR/ ||
493− $2 ~ /^SIG[^_]/ ||
494− $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ ||
495− $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ ||
496− $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ ||
497− $2 ~ /^O?XTABS$/ ||
498− $2 ~ /^TC[IO](ON|OFF)$/ ||
499− $2 ~ /^IN_/ ||
500− $2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
501− $2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
502− $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
503− $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
504− $2 ~ /^TP_STATUS_/ ||
505− $2 ~ /^FALLOC_/ ||
506− $2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
507− $2 == "SOMAXCONN" ||
508− $2 == "NAME_MAX" ||
509− $2 == "IFNAMSIZ" ||
510− $2 ~ /^CTL_(HW|KERN|MAXNAME|NET|QUERY)$/ ||
511− $2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
512− $2 ~ /^HW_MACHINE$/ ||
513− $2 ~ /^SYSCTL_VERS/ ||
514− $2 !~ "MNT_BITS" &&
515− $2 ~ /^(MS|MNT|UMOUNT)_/ ||
516− $2 ~ /^NS_GET_/ ||
517− $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
518− $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
519− $2 ~ /^KEXEC_/ ||
520− $2 ~ /^LINUX_REBOOT_CMD_/ ||
521− $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
522− $2 ~ /^MODULE_INIT_/ ||
523− $2 !~ "NLA_TYPE_MASK" &&
524− $2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
525− $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
526− $2 ~ /^FIORDCHK$/ ||
527− $2 ~ /^SIOC/ ||
528− $2 ~ /^TIOC/ ||
529− $2 ~ /^TCGET/ ||
530− $2 ~ /^TCSET/ ||
531− $2 ~ /^TC(FLSH|SBRKP?|XONC)$/ ||
532− $2 !~ "RTF_BITS" &&
533− $2 ~ /^(IFF|IFT|NET_RT|RTM(GRP)?|RTF|RTV|RTA|RTAX)_/ ||
534− $2 ~ /^BIOC/ ||
535− $2 ~ /^DIOC/ ||
536− $2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
537− $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
538− $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
539− $2 ~ /^CLONE_[A-Z_]+/ ||
540− $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ &&
541− $2 ~ /^(BPF|DLT)_/ ||
542− $2 ~ /^(CLOCK|TIMER)_/ ||
543− $2 ~ /^CAN_/ ||
544− $2 ~ /^CAP_/ ||
545− $2 ~ /^CP_/ ||
546− $2 ~ /^CPUSTATES$/ ||
547− $2 ~ /^CTLIOCGINFO$/ ||
548− $2 ~ /^ALG_/ ||
549− $2 ~ /^FI(CLONE|DEDUPERANGE)/ ||
550− $2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ ||
551− $2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|[GS]ETFLAGS)/ ||
552− $2 ~ /^FS_VERITY_/ ||
553− $2 ~ /^FSCRYPT_/ ||
554− $2 ~ /^DM_/ ||
555− $2 ~ /^GRND_/ ||
556− $2 ~ /^RND/ ||
557− $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
558− $2 ~ /^KEYCTL_/ ||
559− $2 ~ /^PERF_/ ||
560− $2 ~ /^SECCOMP_MODE_/ ||
561− $2 ~ /^SPLICE_/ ||
562− $2 ~ /^SYNC_FILE_RANGE_/ ||
563− $2 !~ /^AUDIT_RECORD_MAGIC/ &&
564− $2 !~ /IOC_MAGIC/ &&
565− $2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
566− $2 ~ /^(VM|VMADDR)_/ ||
567− $2 ~ /^IOCTL_VM_SOCKETS_/ ||
568− $2 ~ /^(TASKSTATS|TS)_/ ||
569− $2 ~ /^CGROUPSTATS_/ ||
570− $2 ~ /^GENL_/ ||
571− $2 ~ /^STATX_/ ||
572− $2 ~ /^RENAME/ ||
573− $2 ~ /^UBI_IOC[A-Z]/ ||
574− $2 ~ /^UTIME_/ ||
575− $2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ ||
576− $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
577− $2 ~ /^FSOPT_/ ||
578− $2 ~ /^WDIO[CFS]_/ ||
579− $2 ~ /^NFN/ ||
580− $2 ~ /^XDP_/ ||
581− $2 ~ /^RWF_/ ||
582− $2 ~ /^(HDIO|WIN|SMART)_/ ||
583− $2 ~ /^CRYPTO_/ ||
584− $2 ~ /^TIPC_/ ||
585− $2 !~ "DEVLINK_RELOAD_LIMITS_VALID_MASK" &&
586− $2 ~ /^DEVLINK_/ ||
587− $2 ~ /^ETHTOOL_/ ||
588− $2 ~ /^LWTUNNEL_IP/ ||
589− $2 !~ "WMESGLEN" &&
590− $2 ~ /^W[A-Z0-9]+$/ ||
591− $2 ~/^PPPIOC/ ||
592− $2 ~ /^FAN_|FANOTIFY_/ ||
593− $2 == "HID_MAX_DESCRIPTOR_SIZE" ||
594− $2 ~ /^_?HIDIOC/ ||
595− $2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
596− $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
597− $2 ~ /^__WCOREFLAG$/ {next}
598− $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
599−
600− {next}
601− ' | sort
602−
603− echo ')'
604−) >_const.go
605−
606−# Pull out the error names for later.
607−errors=$(
608− echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
609− awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
610− sort
611−)
612−
613−# Pull out the signal names for later.
614−signals=$(
615− echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
616− awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
617− egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
618− sort
619−)
620−
621−# Again, writing regexps to a file.
622−echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
623− awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
624− sort >_error.grep
625−echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
626− awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
627− egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
628− sort >_signal.grep
629−
630−echo '// mkerrors.sh' "$@"
631−echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
632−echo
633−echo "//go:build ${GOARCH} && ${GOOS}"
634−echo "// +build ${GOARCH},${GOOS}"
635−echo
636−go tool cgo -godefs -- "$@" _const.go >_error.out
637−cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
638−echo
639−echo '// Errors'
640−echo 'const ('
641−cat _error.out | grep -f _error.grep | sed 's/=\(.*\)/= syscall.Errno(\1)/'
642−echo ')'
643−
644−echo
645−echo '// Signals'
646−echo 'const ('
647−cat _error.out | grep -f _signal.grep | sed 's/=\(.*\)/= syscall.Signal(\1)/'
648−echo ')'
649−
650−# Run C program to print error and syscall strings.
651−(
652− echo -E "
653−#include <stdio.h>
654−#include <stdlib.h>
655−#include <errno.h>
656−#include <ctype.h>
657−#include <string.h>
658−#include <signal.h>
659−
660−#define nelem(x) (sizeof(x)/sizeof((x)[0]))
661−
662−enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
663−
664−struct tuple {
665− int num;
666− const char *name;
667−};
668−
669−struct tuple errors[] = {
670−"
671− for i in $errors
672− do
673− echo -E ' {'$i', "'$i'" },'
674− done
675−
676− echo -E "
677−};
678−
679−struct tuple signals[] = {
680−"
681− for i in $signals
682− do
683− echo -E ' {'$i', "'$i'" },'
684− done
685−
686− # Use -E because on some systems bash builtin interprets \n itself.
687− echo -E '
688−};
689−
690−static int
691−tuplecmp(const void *a, const void *b)
692−{
693− return ((struct tuple *)a)->num - ((struct tuple *)b)->num;
694−}
695−
696−int
697−main(void)
698−{
699− int i, e;
700− char buf[1024], *p;
701−
702− printf("\n\n// Error table\n");
703− printf("var errorList = [...]struct {\n");
704− printf("\tnum syscall.Errno\n");
705− printf("\tname string\n");
706− printf("\tdesc string\n");
707− printf("} {\n");
708− qsort(errors, nelem(errors), sizeof errors[0], tuplecmp);
709− for(i=0; i<nelem(errors); i++) {
710− e = errors[i].num;
711− if(i > 0 && errors[i-1].num == e)
712− continue;
713− strcpy(buf, strerror(e));
714− // lowercase first letter: Bad -> bad, but STREAM -> STREAM.
715− if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
716− buf[0] += a - A;
717− printf("\t{ %d, \"%s\", \"%s\" },\n", e, errors[i].name, buf);
718− }
719− printf("}\n\n");
720−
721− printf("\n\n// Signal table\n");
722− printf("var signalList = [...]struct {\n");
723− printf("\tnum syscall.Signal\n");
724− printf("\tname string\n");
725− printf("\tdesc string\n");
726− printf("} {\n");
727− qsort(signals, nelem(signals), sizeof signals[0], tuplecmp);
728− for(i=0; i<nelem(signals); i++) {
729− e = signals[i].num;
730− if(i > 0 && signals[i-1].num == e)
731− continue;
732− strcpy(buf, strsignal(e));
733− // lowercase first letter: Bad -> bad, but STREAM -> STREAM.
734− if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
735− buf[0] += a - A;
736− // cut trailing : number.
737− p = strrchr(buf, ":"[0]);
738− if(p)
739− *p = '\0';
740− printf("\t{ %d, \"%s\", \"%s\" },\n", e, signals[i].name, buf);
741− }
742− printf("}\n\n");
743−
744− return 0;
745−}
746−
747−'
748−) >_errors.c
749−
750−$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out
vendor/golang.org/x/sys/unix/pagesize_unix.godeleted−16
@@ -1,16 +0,0 @@
1−// Copyright 2017 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
7−
8−// For Unix, get the pagesize from the runtime.
9−
10−package unix
11−
12−import "syscall"
13−
14−func Getpagesize() int {
15− return syscall.Getpagesize()
16−}
vendor/golang.org/x/sys/unix/pledge_openbsd.godeleted−163
@@ -1,163 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−package unix
6−
7−import (
8− "errors"
9− "fmt"
10− "strconv"
11− "syscall"
12− "unsafe"
13−)
14−
15−// Pledge implements the pledge syscall.
16−//
17−// The pledge syscall does not accept execpromises on OpenBSD releases
18−// before 6.3.
19−//
20−// execpromises must be empty when Pledge is called on OpenBSD
21−// releases predating 6.3, otherwise an error will be returned.
22−//
23−// For more information see pledge(2).
24−func Pledge(promises, execpromises string) error {
25− maj, min, err := majmin()
26− if err != nil {
27− return err
28− }
29−
30− err = pledgeAvailable(maj, min, execpromises)
31− if err != nil {
32− return err
33− }
34−
35− pptr, err := syscall.BytePtrFromString(promises)
36− if err != nil {
37− return err
38− }
39−
40− // This variable will hold either a nil unsafe.Pointer or
41− // an unsafe.Pointer to a string (execpromises).
42− var expr unsafe.Pointer
43−
44− // If we're running on OpenBSD > 6.2, pass execpromises to the syscall.
45− if maj > 6 || (maj == 6 && min > 2) {
46− exptr, err := syscall.BytePtrFromString(execpromises)
47− if err != nil {
48− return err
49− }
50− expr = unsafe.Pointer(exptr)
51− }
52−
53− _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
54− if e != 0 {
55− return e
56− }
57−
58− return nil
59−}
60−
61−// PledgePromises implements the pledge syscall.
62−//
63−// This changes the promises and leaves the execpromises untouched.
64−//
65−// For more information see pledge(2).
66−func PledgePromises(promises string) error {
67− maj, min, err := majmin()
68− if err != nil {
69− return err
70− }
71−
72− err = pledgeAvailable(maj, min, "")
73− if err != nil {
74− return err
75− }
76−
77− // This variable holds the execpromises and is always nil.
78− var expr unsafe.Pointer
79−
80− pptr, err := syscall.BytePtrFromString(promises)
81− if err != nil {
82− return err
83− }
84−
85− _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
86− if e != 0 {
87− return e
88− }
89−
90− return nil
91−}
92−
93−// PledgeExecpromises implements the pledge syscall.
94−//
95−// This changes the execpromises and leaves the promises untouched.
96−//
97−// For more information see pledge(2).
98−func PledgeExecpromises(execpromises string) error {
99− maj, min, err := majmin()
100− if err != nil {
101− return err
102− }
103−
104− err = pledgeAvailable(maj, min, execpromises)
105− if err != nil {
106− return err
107− }
108−
109− // This variable holds the promises and is always nil.
110− var pptr unsafe.Pointer
111−
112− exptr, err := syscall.BytePtrFromString(execpromises)
113− if err != nil {
114− return err
115− }
116−
117− _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0)
118− if e != 0 {
119− return e
120− }
121−
122− return nil
123−}
124−
125−// majmin returns major and minor version number for an OpenBSD system.
126−func majmin() (major int, minor int, err error) {
127− var v Utsname
128− err = Uname(&v)
129− if err != nil {
130− return
131− }
132−
133− major, err = strconv.Atoi(string(v.Release[0]))
134− if err != nil {
135− err = errors.New("cannot parse major version number returned by uname")
136− return
137− }
138−
139− minor, err = strconv.Atoi(string(v.Release[2]))
140− if err != nil {
141− err = errors.New("cannot parse minor version number returned by uname")
142− return
143− }
144−
145− return
146−}
147−
148−// pledgeAvailable checks for availability of the pledge(2) syscall
149−// based on the running OpenBSD version.
150−func pledgeAvailable(maj, min int, execpromises string) error {
151− // If OpenBSD <= 5.9, pledge is not available.
152− if (maj == 5 && min != 9) || maj < 5 {
153− return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
154− }
155−
156− // If OpenBSD <= 6.2 and execpromises is not empty,
157− // return an error - execpromises is not available before 6.3
158− if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
159− return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
160− }
161−
162− return nil
163−}
vendor/golang.org/x/sys/unix/ptrace_darwin.godeleted−12
@@ -1,12 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build darwin && !ios
6−// +build darwin,!ios
7−
8−package unix
9−
10−func ptrace(request int, pid int, addr uintptr, data uintptr) error {
11− return ptrace1(request, pid, addr, data)
12−}
vendor/golang.org/x/sys/unix/ptrace_ios.godeleted−12
@@ -1,12 +0,0 @@
1−// Copyright 2020 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build ios
6−// +build ios
7−
8−package unix
9−
10−func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
11− return ENOTSUP
12−}
vendor/golang.org/x/sys/unix/race.godeleted−31
@@ -1,31 +0,0 @@
1−// Copyright 2012 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build (darwin && race) || (linux && race) || (freebsd && race)
6−// +build darwin,race linux,race freebsd,race
7−
8−package unix
9−
10−import (
11− "runtime"
12− "unsafe"
13−)
14−
15−const raceenabled = true
16−
17−func raceAcquire(addr unsafe.Pointer) {
18− runtime.RaceAcquire(addr)
19−}
20−
21−func raceReleaseMerge(addr unsafe.Pointer) {
22− runtime.RaceReleaseMerge(addr)
23−}
24−
25−func raceReadRange(addr unsafe.Pointer, len int) {
26− runtime.RaceReadRange(addr, len)
27−}
28−
29−func raceWriteRange(addr unsafe.Pointer, len int) {
30− runtime.RaceWriteRange(addr, len)
31−}
vendor/golang.org/x/sys/unix/race0.godeleted−26
@@ -1,26 +0,0 @@
1−// Copyright 2012 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos
6−// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos
7−
8−package unix
9−
10−import (
11− "unsafe"
12−)
13−
14−const raceenabled = false
15−
16−func raceAcquire(addr unsafe.Pointer) {
17−}
18−
19−func raceReleaseMerge(addr unsafe.Pointer) {
20−}
21−
22−func raceReadRange(addr unsafe.Pointer, len int) {
23−}
24−
25−func raceWriteRange(addr unsafe.Pointer, len int) {
26−}
vendor/golang.org/x/sys/unix/readdirent_getdents.godeleted−13
@@ -1,13 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd
6−// +build aix dragonfly freebsd linux netbsd openbsd
7−
8−package unix
9−
10−// ReadDirent reads directory entries from fd and writes them into buf.
11−func ReadDirent(fd int, buf []byte) (n int, err error) {
12− return Getdents(fd, buf)
13−}
vendor/golang.org/x/sys/unix/readdirent_getdirentries.godeleted−20
@@ -1,20 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build darwin
6−// +build darwin
7−
8−package unix
9−
10−import "unsafe"
11−
12−// ReadDirent reads directory entries from fd and writes them into buf.
13−func ReadDirent(fd int, buf []byte) (n int, err error) {
14− // Final argument is (basep *uintptr) and the syscall doesn't take nil.
15− // 64 bits should be enough. (32 bits isn't even on 386). Since the
16− // actual system call is getdirentries64, 64 is a good guess.
17− // TODO(rsc): Can we use a single global basep for all calls?
18− var base = (*uintptr)(unsafe.Pointer(new(uint64)))
19− return Getdirentries(fd, buf, base)
20−}
vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.godeleted−16
@@ -1,16 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−package unix
6−
7−// Round the length of a raw sockaddr up to align it properly.
8−func cmsgAlignOf(salen int) int {
9− salign := SizeofPtr
10− if SizeofPtr == 8 && !supportsABI(_dragonflyABIChangeVersion) {
11− // 64-bit Dragonfly before the September 2019 ABI changes still requires
12− // 32-bit aligned access to network subsystem.
13− salign = 4
14− }
15− return (salen + salign - 1) & ^(salign - 1)
16−}
vendor/golang.org/x/sys/unix/sockcmsg_linux.godeleted−36
@@ -1,36 +0,0 @@
1−// Copyright 2011 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Socket control messages
6−
7−package unix
8−
9−import "unsafe"
10−
11−// UnixCredentials encodes credentials into a socket control message
12−// for sending to another process. This can be used for
13−// authentication.
14−func UnixCredentials(ucred *Ucred) []byte {
15− b := make([]byte, CmsgSpace(SizeofUcred))
16− h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
17− h.Level = SOL_SOCKET
18− h.Type = SCM_CREDENTIALS
19− h.SetLen(CmsgLen(SizeofUcred))
20− *(*Ucred)(h.data(0)) = *ucred
21− return b
22−}
23−
24−// ParseUnixCredentials decodes a socket control message that contains
25−// credentials in a Ucred structure. To receive such a message, the
26−// SO_PASSCRED option must be enabled on the socket.
27−func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) {
28− if m.Header.Level != SOL_SOCKET {
29− return nil, EINVAL
30− }
31− if m.Header.Type != SCM_CREDENTIALS {
32− return nil, EINVAL
33− }
34− ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0]))
35− return &ucred, nil
36−}
vendor/golang.org/x/sys/unix/sockcmsg_unix.godeleted−93
@@ -1,93 +0,0 @@
1−// Copyright 2011 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
7−
8−// Socket control messages
9−
10−package unix
11−
12−import (
13− "unsafe"
14−)
15−
16−// CmsgLen returns the value to store in the Len field of the Cmsghdr
17−// structure, taking into account any necessary alignment.
18−func CmsgLen(datalen int) int {
19− return cmsgAlignOf(SizeofCmsghdr) + datalen
20−}
21−
22−// CmsgSpace returns the number of bytes an ancillary element with
23−// payload of the passed data length occupies.
24−func CmsgSpace(datalen int) int {
25− return cmsgAlignOf(SizeofCmsghdr) + cmsgAlignOf(datalen)
26−}
27−
28−func (h *Cmsghdr) data(offset uintptr) unsafe.Pointer {
29− return unsafe.Pointer(uintptr(unsafe.Pointer(h)) + uintptr(cmsgAlignOf(SizeofCmsghdr)) + offset)
30−}
31−
32−// SocketControlMessage represents a socket control message.
33−type SocketControlMessage struct {
34− Header Cmsghdr
35− Data []byte
36−}
37−
38−// ParseSocketControlMessage parses b as an array of socket control
39−// messages.
40−func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) {
41− var msgs []SocketControlMessage
42− i := 0
43− for i+CmsgLen(0) <= len(b) {
44− h, dbuf, err := socketControlMessageHeaderAndData(b[i:])
45− if err != nil {
46− return nil, err
47− }
48− m := SocketControlMessage{Header: *h, Data: dbuf}
49− msgs = append(msgs, m)
50− i += cmsgAlignOf(int(h.Len))
51− }
52− return msgs, nil
53−}
54−
55−func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) {
56− h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
57− if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) {
58− return nil, nil, EINVAL
59− }
60− return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil
61−}
62−
63−// UnixRights encodes a set of open file descriptors into a socket
64−// control message for sending to another process.
65−func UnixRights(fds ...int) []byte {
66− datalen := len(fds) * 4
67− b := make([]byte, CmsgSpace(datalen))
68− h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
69− h.Level = SOL_SOCKET
70− h.Type = SCM_RIGHTS
71− h.SetLen(CmsgLen(datalen))
72− for i, fd := range fds {
73− *(*int32)(h.data(4 * uintptr(i))) = int32(fd)
74− }
75− return b
76−}
77−
78−// ParseUnixRights decodes a socket control message that contains an
79−// integer array of open file descriptors from another process.
80−func ParseUnixRights(m *SocketControlMessage) ([]int, error) {
81− if m.Header.Level != SOL_SOCKET {
82− return nil, EINVAL
83− }
84− if m.Header.Type != SCM_RIGHTS {
85− return nil, EINVAL
86− }
87− fds := make([]int, len(m.Data)>>2)
88− for i, j := 0, 0; i < len(m.Data); i += 4 {
89− fds[j] = int(*(*int32)(unsafe.Pointer(&m.Data[i])))
90− j++
91− }
92− return fds, nil
93−}
vendor/golang.org/x/sys/unix/sockcmsg_unix_other.godeleted−47
@@ -1,47 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
6−// +build aix darwin freebsd linux netbsd openbsd solaris zos
7−
8−package unix
9−
10−import (
11− "runtime"
12−)
13−
14−// Round the length of a raw sockaddr up to align it properly.
15−func cmsgAlignOf(salen int) int {
16− salign := SizeofPtr
17−
18− // dragonfly needs to check ABI version at runtime, see cmsgAlignOf in
19− // sockcmsg_dragonfly.go
20− switch runtime.GOOS {
21− case "aix":
22− // There is no alignment on AIX.
23− salign = 1
24− case "darwin", "ios", "illumos", "solaris":
25− // NOTE: It seems like 64-bit Darwin, Illumos and Solaris
26− // kernels still require 32-bit aligned access to network
27− // subsystem.
28− if SizeofPtr == 8 {
29− salign = 4
30− }
31− case "netbsd", "openbsd":
32− // NetBSD and OpenBSD armv7 require 64-bit alignment.
33− if runtime.GOARCH == "arm" {
34− salign = 8
35− }
36− // NetBSD aarch64 requires 128-bit alignment.
37− if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
38− salign = 16
39− }
40− case "zos":
41− // z/OS socket macros use [32-bit] sizeof(int) alignment,
42− // not pointer width.
43− salign = SizeofInt
44− }
45−
46− return (salen + salign - 1) & ^(salign - 1)
47−}
vendor/golang.org/x/sys/unix/str.godeleted−27
@@ -1,27 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
7−
8−package unix
9−
10−func itoa(val int) string { // do it here rather than with fmt to avoid dependency
11− if val < 0 {
12− return "-" + uitoa(uint(-val))
13− }
14− return uitoa(uint(val))
15−}
16−
17−func uitoa(val uint) string {
18− var buf [32]byte // big enough for int64
19− i := len(buf) - 1
20− for val >= 10 {
21− buf[i] = byte(val%10 + '0')
22− i--
23− val /= 10
24− }
25− buf[i] = byte(val + '0')
26− return string(buf[i:])
27−}
vendor/golang.org/x/sys/unix/syscall.godeleted−95
@@ -1,95 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
6−// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
7−
8−// Package unix contains an interface to the low-level operating system
9−// primitives. OS details vary depending on the underlying system, and
10−// by default, godoc will display OS-specific documentation for the current
11−// system. If you want godoc to display OS documentation for another
12−// system, set $GOOS and $GOARCH to the desired system. For example, if
13−// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
14−// to freebsd and $GOARCH to arm.
15−//
16−// The primary use of this package is inside other packages that provide a more
17−// portable interface to the system, such as "os", "time" and "net". Use
18−// those packages rather than this one if you can.
19−//
20−// For details of the functions and data types in this package consult
21−// the manuals for the appropriate operating system.
22−//
23−// These calls return err == nil to indicate success; otherwise
24−// err represents an operating system error describing the failure and
25−// holds a value of type syscall.Errno.
26−package unix // import "golang.org/x/sys/unix"
27−
28−import (
29− "bytes"
30− "strings"
31− "unsafe"
32−
33− "golang.org/x/sys/internal/unsafeheader"
34−)
35−
36−// ByteSliceFromString returns a NUL-terminated slice of bytes
37−// containing the text of s. If s contains a NUL byte at any
38−// location, it returns (nil, EINVAL).
39−func ByteSliceFromString(s string) ([]byte, error) {
40− if strings.IndexByte(s, 0) != -1 {
41− return nil, EINVAL
42− }
43− a := make([]byte, len(s)+1)
44− copy(a, s)
45− return a, nil
46−}
47−
48−// BytePtrFromString returns a pointer to a NUL-terminated array of
49−// bytes containing the text of s. If s contains a NUL byte at any
50−// location, it returns (nil, EINVAL).
51−func BytePtrFromString(s string) (*byte, error) {
52− a, err := ByteSliceFromString(s)
53− if err != nil {
54− return nil, err
55− }
56− return &a[0], nil
57−}
58−
59−// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
60−// bytes after the NUL removed.
61−func ByteSliceToString(s []byte) string {
62− if i := bytes.IndexByte(s, 0); i != -1 {
63− s = s[:i]
64− }
65− return string(s)
66−}
67−
68−// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
69−// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
70−// at a zero byte; if the zero byte is not present, the program may crash.
71−func BytePtrToString(p *byte) string {
72− if p == nil {
73− return ""
74− }
75− if *p == 0 {
76− return ""
77− }
78−
79− // Find NUL terminator.
80− n := 0
81− for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
82− ptr = unsafe.Pointer(uintptr(ptr) + 1)
83− }
84−
85− var s []byte
86− h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
87− h.Data = unsafe.Pointer(p)
88− h.Len = n
89− h.Cap = n
90−
91− return string(s)
92−}
93−
94−// Single-word zero for use when we need a valid pointer to 0 bytes.
95−var _zero uintptr
vendor/golang.org/x/sys/unix/syscall_aix.godeleted−553
@@ -1,553 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix
6−// +build aix
7−
8−// Aix system calls.
9−// This file is compiled as ordinary Go code,
10−// but it is also input to mksyscall,
11−// which parses the //sys lines and generates system call stubs.
12−// Note that sometimes we use a lowercase //sys name and
13−// wrap it in our own nicer implementation.
14−
15−package unix
16−
17−import "unsafe"
18−
19−/*
20− * Wrapped
21− */
22−
23−func Access(path string, mode uint32) (err error) {
24− return Faccessat(AT_FDCWD, path, mode, 0)
25−}
26−
27−func Chmod(path string, mode uint32) (err error) {
28− return Fchmodat(AT_FDCWD, path, mode, 0)
29−}
30−
31−func Chown(path string, uid int, gid int) (err error) {
32− return Fchownat(AT_FDCWD, path, uid, gid, 0)
33−}
34−
35−func Creat(path string, mode uint32) (fd int, err error) {
36− return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
37−}
38−
39−//sys utimes(path string, times *[2]Timeval) (err error)
40−func Utimes(path string, tv []Timeval) error {
41− if len(tv) != 2 {
42− return EINVAL
43− }
44− return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
45−}
46−
47−//sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error)
48−func UtimesNano(path string, ts []Timespec) error {
49− if len(ts) != 2 {
50− return EINVAL
51− }
52− return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
53−}
54−
55−func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
56− if ts == nil {
57− return utimensat(dirfd, path, nil, flags)
58− }
59− if len(ts) != 2 {
60− return EINVAL
61− }
62− return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
63−}
64−
65−func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
66− if sa.Port < 0 || sa.Port > 0xFFFF {
67− return nil, 0, EINVAL
68− }
69− sa.raw.Family = AF_INET
70− p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
71− p[0] = byte(sa.Port >> 8)
72− p[1] = byte(sa.Port)
73− for i := 0; i < len(sa.Addr); i++ {
74− sa.raw.Addr[i] = sa.Addr[i]
75− }
76− return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
77−}
78−
79−func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
80− if sa.Port < 0 || sa.Port > 0xFFFF {
81− return nil, 0, EINVAL
82− }
83− sa.raw.Family = AF_INET6
84− p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
85− p[0] = byte(sa.Port >> 8)
86− p[1] = byte(sa.Port)
87− sa.raw.Scope_id = sa.ZoneId
88− for i := 0; i < len(sa.Addr); i++ {
89− sa.raw.Addr[i] = sa.Addr[i]
90− }
91− return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
92−}
93−
94−func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
95− name := sa.Name
96− n := len(name)
97− if n > len(sa.raw.Path) {
98− return nil, 0, EINVAL
99− }
100− if n == len(sa.raw.Path) && name[0] != '@' {
101− return nil, 0, EINVAL
102− }
103− sa.raw.Family = AF_UNIX
104− for i := 0; i < n; i++ {
105− sa.raw.Path[i] = uint8(name[i])
106− }
107− // length is family (uint16), name, NUL.
108− sl := _Socklen(2)
109− if n > 0 {
110− sl += _Socklen(n) + 1
111− }
112− if sa.raw.Path[0] == '@' {
113− sa.raw.Path[0] = 0
114− // Don't count trailing NUL for abstract address.
115− sl--
116− }
117−
118− return unsafe.Pointer(&sa.raw), sl, nil
119−}
120−
121−func Getsockname(fd int) (sa Sockaddr, err error) {
122− var rsa RawSockaddrAny
123− var len _Socklen = SizeofSockaddrAny
124− if err = getsockname(fd, &rsa, &len); err != nil {
125− return
126− }
127− return anyToSockaddr(fd, &rsa)
128−}
129−
130−//sys getcwd(buf []byte) (err error)
131−
132−const ImplementsGetwd = true
133−
134−func Getwd() (ret string, err error) {
135− for len := uint64(4096); ; len *= 2 {
136− b := make([]byte, len)
137− err := getcwd(b)
138− if err == nil {
139− i := 0
140− for b[i] != 0 {
141− i++
142− }
143− return string(b[0:i]), nil
144− }
145− if err != ERANGE {
146− return "", err
147− }
148− }
149−}
150−
151−func Getcwd(buf []byte) (n int, err error) {
152− err = getcwd(buf)
153− if err == nil {
154− i := 0
155− for buf[i] != 0 {
156− i++
157− }
158− n = i + 1
159− }
160− return
161−}
162−
163−func Getgroups() (gids []int, err error) {
164− n, err := getgroups(0, nil)
165− if err != nil {
166− return nil, err
167− }
168− if n == 0 {
169− return nil, nil
170− }
171−
172− // Sanity check group count. Max is 16 on BSD.
173− if n < 0 || n > 1000 {
174− return nil, EINVAL
175− }
176−
177− a := make([]_Gid_t, n)
178− n, err = getgroups(n, &a[0])
179− if err != nil {
180− return nil, err
181− }
182− gids = make([]int, n)
183− for i, v := range a[0:n] {
184− gids[i] = int(v)
185− }
186− return
187−}
188−
189−func Setgroups(gids []int) (err error) {
190− if len(gids) == 0 {
191− return setgroups(0, nil)
192− }
193−
194− a := make([]_Gid_t, len(gids))
195− for i, v := range gids {
196− a[i] = _Gid_t(v)
197− }
198− return setgroups(len(a), &a[0])
199−}
200−
201−/*
202− * Socket
203− */
204−
205−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
206−
207−func Accept(fd int) (nfd int, sa Sockaddr, err error) {
208− var rsa RawSockaddrAny
209− var len _Socklen = SizeofSockaddrAny
210− nfd, err = accept(fd, &rsa, &len)
211− if nfd == -1 {
212− return
213− }
214− sa, err = anyToSockaddr(fd, &rsa)
215− if err != nil {
216− Close(nfd)
217− nfd = 0
218− }
219− return
220−}
221−
222−func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
223− // Recvmsg not implemented on AIX
224− sa := new(SockaddrUnix)
225− return -1, -1, -1, sa, ENOSYS
226−}
227−
228−func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
229− _, err = SendmsgN(fd, p, oob, to, flags)
230− return
231−}
232−
233−func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
234− // SendmsgN not implemented on AIX
235− return -1, ENOSYS
236−}
237−
238−func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
239− switch rsa.Addr.Family {
240−
241− case AF_UNIX:
242− pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
243− sa := new(SockaddrUnix)
244−
245− // Some versions of AIX have a bug in getsockname (see IV78655).
246− // We can't rely on sa.Len being set correctly.
247− n := SizeofSockaddrUnix - 3 // subtract leading Family, Len, terminating NUL.
248− for i := 0; i < n; i++ {
249− if pp.Path[i] == 0 {
250− n = i
251− break
252− }
253− }
254−
255− bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
256− sa.Name = string(bytes)
257− return sa, nil
258−
259− case AF_INET:
260− pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
261− sa := new(SockaddrInet4)
262− p := (*[2]byte)(unsafe.Pointer(&pp.Port))
263− sa.Port = int(p[0])<<8 + int(p[1])
264− for i := 0; i < len(sa.Addr); i++ {
265− sa.Addr[i] = pp.Addr[i]
266− }
267− return sa, nil
268−
269− case AF_INET6:
270− pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
271− sa := new(SockaddrInet6)
272− p := (*[2]byte)(unsafe.Pointer(&pp.Port))
273− sa.Port = int(p[0])<<8 + int(p[1])
274− sa.ZoneId = pp.Scope_id
275− for i := 0; i < len(sa.Addr); i++ {
276− sa.Addr[i] = pp.Addr[i]
277− }
278− return sa, nil
279− }
280− return nil, EAFNOSUPPORT
281−}
282−
283−func Gettimeofday(tv *Timeval) (err error) {
284− err = gettimeofday(tv, nil)
285− return
286−}
287−
288−func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
289− if raceenabled {
290− raceReleaseMerge(unsafe.Pointer(&ioSync))
291− }
292− return sendfile(outfd, infd, offset, count)
293−}
294−
295−// TODO
296−func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
297− return -1, ENOSYS
298−}
299−
300−func direntIno(buf []byte) (uint64, bool) {
301− return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
302−}
303−
304−func direntReclen(buf []byte) (uint64, bool) {
305− return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
306−}
307−
308−func direntNamlen(buf []byte) (uint64, bool) {
309− reclen, ok := direntReclen(buf)
310− if !ok {
311− return 0, false
312− }
313− return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
314−}
315−
316−//sys getdirent(fd int, buf []byte) (n int, err error)
317−func Getdents(fd int, buf []byte) (n int, err error) {
318− return getdirent(fd, buf)
319−}
320−
321−//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
322−func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
323− var status _C_int
324− var r Pid_t
325− err = ERESTART
326− // AIX wait4 may return with ERESTART errno, while the processus is still
327− // active.
328− for err == ERESTART {
329− r, err = wait4(Pid_t(pid), &status, options, rusage)
330− }
331− wpid = int(r)
332− if wstatus != nil {
333− *wstatus = WaitStatus(status)
334− }
335− return
336−}
337−
338−/*
339− * Wait
340− */
341−
342−type WaitStatus uint32
343−
344−func (w WaitStatus) Stopped() bool { return w&0x40 != 0 }
345−func (w WaitStatus) StopSignal() Signal {
346− if !w.Stopped() {
347− return -1
348− }
349− return Signal(w>>8) & 0xFF
350−}
351−
352−func (w WaitStatus) Exited() bool { return w&0xFF == 0 }
353−func (w WaitStatus) ExitStatus() int {
354− if !w.Exited() {
355− return -1
356− }
357− return int((w >> 8) & 0xFF)
358−}
359−
360−func (w WaitStatus) Signaled() bool { return w&0x40 == 0 && w&0xFF != 0 }
361−func (w WaitStatus) Signal() Signal {
362− if !w.Signaled() {
363− return -1
364− }
365− return Signal(w>>16) & 0xFF
366−}
367−
368−func (w WaitStatus) Continued() bool { return w&0x01000000 != 0 }
369−
370−func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 }
371−
372−func (w WaitStatus) TrapCause() int { return -1 }
373−
374−//sys ioctl(fd int, req uint, arg uintptr) (err error)
375−
376−// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
377−// There is no way to create a custom fcntl and to keep //sys fcntl easily,
378−// Therefore, the programmer must call dup2 instead of fcntl in this case.
379−
380−// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
381−//sys FcntlInt(fd uintptr, cmd int, arg int) (r int,err error) = fcntl
382−
383−// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
384−//sys FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) = fcntl
385−
386−//sys fcntl(fd int, cmd int, arg int) (val int, err error)
387−
388−/*
389− * Direct access
390− */
391−
392−//sys Acct(path string) (err error)
393−//sys Chdir(path string) (err error)
394−//sys Chroot(path string) (err error)
395−//sys Close(fd int) (err error)
396−//sys Dup(oldfd int) (fd int, err error)
397−//sys Exit(code int)
398−//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
399−//sys Fchdir(fd int) (err error)
400−//sys Fchmod(fd int, mode uint32) (err error)
401−//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
402−//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
403−//sys Fdatasync(fd int) (err error)
404−//sys Fsync(fd int) (err error)
405−// readdir_r
406−//sysnb Getpgid(pid int) (pgid int, err error)
407−
408−//sys Getpgrp() (pid int)
409−
410−//sysnb Getpid() (pid int)
411−//sysnb Getppid() (ppid int)
412−//sys Getpriority(which int, who int) (prio int, err error)
413−//sysnb Getrusage(who int, rusage *Rusage) (err error)
414−//sysnb Getsid(pid int) (sid int, err error)
415−//sysnb Kill(pid int, sig Signal) (err error)
416−//sys Klogctl(typ int, buf []byte) (n int, err error) = syslog
417−//sys Mkdir(dirfd int, path string, mode uint32) (err error)
418−//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
419−//sys Mkfifo(path string, mode uint32) (err error)
420−//sys Mknod(path string, mode uint32, dev int) (err error)
421−//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
422−//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
423−//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64
424−//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
425−//sys read(fd int, p []byte) (n int, err error)
426−//sys Readlink(path string, buf []byte) (n int, err error)
427−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
428−//sys Setdomainname(p []byte) (err error)
429−//sys Sethostname(p []byte) (err error)
430−//sysnb Setpgid(pid int, pgid int) (err error)
431−//sysnb Setsid() (pid int, err error)
432−//sysnb Settimeofday(tv *Timeval) (err error)
433−
434−//sys Setuid(uid int) (err error)
435−//sys Setgid(uid int) (err error)
436−
437−//sys Setpriority(which int, who int, prio int) (err error)
438−//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
439−//sys Sync()
440−//sysnb Times(tms *Tms) (ticks uintptr, err error)
441−//sysnb Umask(mask int) (oldmask int)
442−//sysnb Uname(buf *Utsname) (err error)
443−//sys Unlink(path string) (err error)
444−//sys Unlinkat(dirfd int, path string, flags int) (err error)
445−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
446−//sys write(fd int, p []byte) (n int, err error)
447−//sys readlen(fd int, p *byte, np int) (n int, err error) = read
448−//sys writelen(fd int, p *byte, np int) (n int, err error) = write
449−
450−//sys Dup2(oldfd int, newfd int) (err error)
451−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
452−//sys Fchown(fd int, uid int, gid int) (err error)
453−//sys fstat(fd int, stat *Stat_t) (err error)
454−//sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat
455−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
456−//sys Ftruncate(fd int, length int64) (err error)
457−//sysnb Getegid() (egid int)
458−//sysnb Geteuid() (euid int)
459−//sysnb Getgid() (gid int)
460−//sysnb Getuid() (uid int)
461−//sys Lchown(path string, uid int, gid int) (err error)
462−//sys Listen(s int, n int) (err error)
463−//sys lstat(path string, stat *Stat_t) (err error)
464−//sys Pause() (err error)
465−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
466−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
467−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
468−//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
469−//sysnb Setregid(rgid int, egid int) (err error)
470−//sysnb Setreuid(ruid int, euid int) (err error)
471−//sys Shutdown(fd int, how int) (err error)
472−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
473−//sys stat(path string, statptr *Stat_t) (err error)
474−//sys Statfs(path string, buf *Statfs_t) (err error)
475−//sys Truncate(path string, length int64) (err error)
476−
477−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
478−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
479−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
480−//sysnb setgroups(n int, list *_Gid_t) (err error)
481−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
482−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
483−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
484−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
485−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
486−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
487−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
488−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
489−
490−// In order to use msghdr structure with Control, Controllen, nrecvmsg and nsendmsg must be used.
491−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = nrecvmsg
492−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
493−
494−//sys munmap(addr uintptr, length uintptr) (err error)
495−
496−var mapper = &mmapper{
497− active: make(map[*byte][]byte),
498− mmap: mmap,
499− munmap: munmap,
500−}
501−
502−func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
503− return mapper.Mmap(fd, offset, length, prot, flags)
504−}
505−
506−func Munmap(b []byte) (err error) {
507− return mapper.Munmap(b)
508−}
509−
510−//sys Madvise(b []byte, advice int) (err error)
511−//sys Mprotect(b []byte, prot int) (err error)
512−//sys Mlock(b []byte) (err error)
513−//sys Mlockall(flags int) (err error)
514−//sys Msync(b []byte, flags int) (err error)
515−//sys Munlock(b []byte) (err error)
516−//sys Munlockall() (err error)
517−
518−//sysnb pipe(p *[2]_C_int) (err error)
519−
520−func Pipe(p []int) (err error) {
521− if len(p) != 2 {
522− return EINVAL
523− }
524− var pp [2]_C_int
525− err = pipe(&pp)
526− p[0] = int(pp[0])
527− p[1] = int(pp[1])
528− return
529−}
530−
531−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
532−
533−func Poll(fds []PollFd, timeout int) (n int, err error) {
534− if len(fds) == 0 {
535− return poll(nil, 0, timeout)
536− }
537− return poll(&fds[0], len(fds), timeout)
538−}
539−
540−//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
541−//sysnb Time(t *Time_t) (tt Time_t, err error)
542−//sys Utime(path string, buf *Utimbuf) (err error)
543−
544−//sys Getsystemcfg(label int) (n uint64)
545−
546−//sys umount(target string) (err error)
547−func Unmount(target string, flags int) (err error) {
548− if flags != 0 {
549− // AIX doesn't have any flags for umount.
550− return ENOSYS
551− }
552− return umount(target)
553−}
vendor/golang.org/x/sys/unix/syscall_aix_ppc.godeleted−54
@@ -1,54 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix && ppc
6−// +build aix,ppc
7−
8−package unix
9−
10−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
11−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64
12−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
13−
14−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
15−
16−func setTimespec(sec, nsec int64) Timespec {
17− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
18−}
19−
20−func setTimeval(sec, usec int64) Timeval {
21− return Timeval{Sec: int32(sec), Usec: int32(usec)}
22−}
23−
24−func (iov *Iovec) SetLen(length int) {
25− iov.Len = uint32(length)
26−}
27−
28−func (msghdr *Msghdr) SetControllen(length int) {
29− msghdr.Controllen = uint32(length)
30−}
31−
32−func (msghdr *Msghdr) SetIovlen(length int) {
33− msghdr.Iovlen = int32(length)
34−}
35−
36−func (cmsg *Cmsghdr) SetLen(length int) {
37− cmsg.Len = uint32(length)
38−}
39−
40−func Fstat(fd int, stat *Stat_t) error {
41− return fstat(fd, stat)
42−}
43−
44−func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error {
45− return fstatat(dirfd, path, stat, flags)
46−}
47−
48−func Lstat(path string, stat *Stat_t) error {
49− return lstat(path, stat)
50−}
51−
52−func Stat(path string, statptr *Stat_t) error {
53− return stat(path, statptr)
54−}
vendor/golang.org/x/sys/unix/syscall_aix_ppc64.godeleted−85
@@ -1,85 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build aix && ppc64
6−// +build aix,ppc64
7−
8−package unix
9−
10−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
11−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
12−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
13−
14−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
15−
16−func setTimespec(sec, nsec int64) Timespec {
17− return Timespec{Sec: sec, Nsec: nsec}
18−}
19−
20−func setTimeval(sec, usec int64) Timeval {
21− return Timeval{Sec: int64(sec), Usec: int32(usec)}
22−}
23−
24−func (iov *Iovec) SetLen(length int) {
25− iov.Len = uint64(length)
26−}
27−
28−func (msghdr *Msghdr) SetControllen(length int) {
29− msghdr.Controllen = uint32(length)
30−}
31−
32−func (msghdr *Msghdr) SetIovlen(length int) {
33− msghdr.Iovlen = int32(length)
34−}
35−
36−func (cmsg *Cmsghdr) SetLen(length int) {
37− cmsg.Len = uint32(length)
38−}
39−
40−// In order to only have Timespec structure, type of Stat_t's fields
41−// Atim, Mtim and Ctim is changed from StTimespec to Timespec during
42−// ztypes generation.
43−// On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an
44−// int32, so the fields' value must be modified.
45−func fixStatTimFields(stat *Stat_t) {
46− stat.Atim.Nsec >>= 32
47− stat.Mtim.Nsec >>= 32
48− stat.Ctim.Nsec >>= 32
49−}
50−
51−func Fstat(fd int, stat *Stat_t) error {
52− err := fstat(fd, stat)
53− if err != nil {
54− return err
55− }
56− fixStatTimFields(stat)
57− return nil
58−}
59−
60−func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error {
61− err := fstatat(dirfd, path, stat, flags)
62− if err != nil {
63− return err
64− }
65− fixStatTimFields(stat)
66− return nil
67−}
68−
69−func Lstat(path string, stat *Stat_t) error {
70− err := lstat(path, stat)
71− if err != nil {
72− return err
73− }
74− fixStatTimFields(stat)
75− return nil
76−}
77−
78−func Stat(path string, statptr *Stat_t) error {
79− err := stat(path, statptr)
80− if err != nil {
81− return err
82− }
83− fixStatTimFields(statptr)
84− return nil
85−}
vendor/golang.org/x/sys/unix/syscall_bsd.godeleted−664
@@ -1,664 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build darwin || dragonfly || freebsd || netbsd || openbsd
6−// +build darwin dragonfly freebsd netbsd openbsd
7−
8−// BSD system call wrappers shared by *BSD based systems
9−// including OS X (Darwin) and FreeBSD. Like the other
10−// syscall_*.go files it is compiled as Go code but also
11−// used as input to mksyscall which parses the //sys
12−// lines and generates system call stubs.
13−
14−package unix
15−
16−import (
17− "runtime"
18− "syscall"
19− "unsafe"
20−)
21−
22−const ImplementsGetwd = true
23−
24−func Getwd() (string, error) {
25− var buf [PathMax]byte
26− _, err := Getcwd(buf[0:])
27− if err != nil {
28− return "", err
29− }
30− n := clen(buf[:])
31− if n < 1 {
32− return "", EINVAL
33− }
34− return string(buf[:n]), nil
35−}
36−
37−/*
38− * Wrapped
39− */
40−
41−//sysnb getgroups(ngid int, gid *_Gid_t) (n int, err error)
42−//sysnb setgroups(ngid int, gid *_Gid_t) (err error)
43−
44−func Getgroups() (gids []int, err error) {
45− n, err := getgroups(0, nil)
46− if err != nil {
47− return nil, err
48− }
49− if n == 0 {
50− return nil, nil
51− }
52−
53− // Sanity check group count. Max is 16 on BSD.
54− if n < 0 || n > 1000 {
55− return nil, EINVAL
56− }
57−
58− a := make([]_Gid_t, n)
59− n, err = getgroups(n, &a[0])
60− if err != nil {
61− return nil, err
62− }
63− gids = make([]int, n)
64− for i, v := range a[0:n] {
65− gids[i] = int(v)
66− }
67− return
68−}
69−
70−func Setgroups(gids []int) (err error) {
71− if len(gids) == 0 {
72− return setgroups(0, nil)
73− }
74−
75− a := make([]_Gid_t, len(gids))
76− for i, v := range gids {
77− a[i] = _Gid_t(v)
78− }
79− return setgroups(len(a), &a[0])
80−}
81−
82−// Wait status is 7 bits at bottom, either 0 (exited),
83−// 0x7F (stopped), or a signal number that caused an exit.
84−// The 0x80 bit is whether there was a core dump.
85−// An extra number (exit code, signal causing a stop)
86−// is in the high bits.
87−
88−type WaitStatus uint32
89−
90−const (
91− mask = 0x7F
92− core = 0x80
93− shift = 8
94−
95− exited = 0
96− killed = 9
97− stopped = 0x7F
98−)
99−
100−func (w WaitStatus) Exited() bool { return w&mask == exited }
101−
102−func (w WaitStatus) ExitStatus() int {
103− if w&mask != exited {
104− return -1
105− }
106− return int(w >> shift)
107−}
108−
109−func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != 0 }
110−
111−func (w WaitStatus) Signal() syscall.Signal {
112− sig := syscall.Signal(w & mask)
113− if sig == stopped || sig == 0 {
114− return -1
115− }
116− return sig
117−}
118−
119−func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 }
120−
121−func (w WaitStatus) Stopped() bool { return w&mask == stopped && syscall.Signal(w>>shift) != SIGSTOP }
122−
123−func (w WaitStatus) Killed() bool { return w&mask == killed && syscall.Signal(w>>shift) != SIGKILL }
124−
125−func (w WaitStatus) Continued() bool { return w&mask == stopped && syscall.Signal(w>>shift) == SIGSTOP }
126−
127−func (w WaitStatus) StopSignal() syscall.Signal {
128− if !w.Stopped() {
129− return -1
130− }
131− return syscall.Signal(w>>shift) & 0xFF
132−}
133−
134−func (w WaitStatus) TrapCause() int { return -1 }
135−
136−//sys wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error)
137−
138−func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
139− var status _C_int
140− wpid, err = wait4(pid, &status, options, rusage)
141− if wstatus != nil {
142− *wstatus = WaitStatus(status)
143− }
144− return
145−}
146−
147−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
148−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
149−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
150−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
151−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
152−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
153−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
154−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
155−//sys Shutdown(s int, how int) (err error)
156−
157−func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
158− if sa.Port < 0 || sa.Port > 0xFFFF {
159− return nil, 0, EINVAL
160− }
161− sa.raw.Len = SizeofSockaddrInet4
162− sa.raw.Family = AF_INET
163− p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
164− p[0] = byte(sa.Port >> 8)
165− p[1] = byte(sa.Port)
166− for i := 0; i < len(sa.Addr); i++ {
167− sa.raw.Addr[i] = sa.Addr[i]
168− }
169− return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
170−}
171−
172−func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
173− if sa.Port < 0 || sa.Port > 0xFFFF {
174− return nil, 0, EINVAL
175− }
176− sa.raw.Len = SizeofSockaddrInet6
177− sa.raw.Family = AF_INET6
178− p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
179− p[0] = byte(sa.Port >> 8)
180− p[1] = byte(sa.Port)
181− sa.raw.Scope_id = sa.ZoneId
182− for i := 0; i < len(sa.Addr); i++ {
183− sa.raw.Addr[i] = sa.Addr[i]
184− }
185− return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
186−}
187−
188−func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
189− name := sa.Name
190− n := len(name)
191− if n >= len(sa.raw.Path) || n == 0 {
192− return nil, 0, EINVAL
193− }
194− sa.raw.Len = byte(3 + n) // 2 for Family, Len; 1 for NUL
195− sa.raw.Family = AF_UNIX
196− for i := 0; i < n; i++ {
197− sa.raw.Path[i] = int8(name[i])
198− }
199− return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
200−}
201−
202−func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) {
203− if sa.Index == 0 {
204− return nil, 0, EINVAL
205− }
206− sa.raw.Len = sa.Len
207− sa.raw.Family = AF_LINK
208− sa.raw.Index = sa.Index
209− sa.raw.Type = sa.Type
210− sa.raw.Nlen = sa.Nlen
211− sa.raw.Alen = sa.Alen
212− sa.raw.Slen = sa.Slen
213− for i := 0; i < len(sa.raw.Data); i++ {
214− sa.raw.Data[i] = sa.Data[i]
215− }
216− return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
217−}
218−
219−func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
220− switch rsa.Addr.Family {
221− case AF_LINK:
222− pp := (*RawSockaddrDatalink)(unsafe.Pointer(rsa))
223− sa := new(SockaddrDatalink)
224− sa.Len = pp.Len
225− sa.Family = pp.Family
226− sa.Index = pp.Index
227− sa.Type = pp.Type
228− sa.Nlen = pp.Nlen
229− sa.Alen = pp.Alen
230− sa.Slen = pp.Slen
231− for i := 0; i < len(sa.Data); i++ {
232− sa.Data[i] = pp.Data[i]
233− }
234− return sa, nil
235−
236− case AF_UNIX:
237− pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
238− if pp.Len < 2 || pp.Len > SizeofSockaddrUnix {
239− return nil, EINVAL
240− }
241− sa := new(SockaddrUnix)
242−
243− // Some BSDs include the trailing NUL in the length, whereas
244− // others do not. Work around this by subtracting the leading
245− // family and len. The path is then scanned to see if a NUL
246− // terminator still exists within the length.
247− n := int(pp.Len) - 2 // subtract leading Family, Len
248− for i := 0; i < n; i++ {
249− if pp.Path[i] == 0 {
250− // found early NUL; assume Len included the NUL
251− // or was overestimating.
252− n = i
253− break
254− }
255− }
256− bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
257− sa.Name = string(bytes)
258− return sa, nil
259−
260− case AF_INET:
261− pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
262− sa := new(SockaddrInet4)
263− p := (*[2]byte)(unsafe.Pointer(&pp.Port))
264− sa.Port = int(p[0])<<8 + int(p[1])
265− for i := 0; i < len(sa.Addr); i++ {
266− sa.Addr[i] = pp.Addr[i]
267− }
268− return sa, nil
269−
270− case AF_INET6:
271− pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
272− sa := new(SockaddrInet6)
273− p := (*[2]byte)(unsafe.Pointer(&pp.Port))
274− sa.Port = int(p[0])<<8 + int(p[1])
275− sa.ZoneId = pp.Scope_id
276− for i := 0; i < len(sa.Addr); i++ {
277− sa.Addr[i] = pp.Addr[i]
278− }
279− return sa, nil
280− }
281− return anyToSockaddrGOOS(fd, rsa)
282−}
283−
284−func Accept(fd int) (nfd int, sa Sockaddr, err error) {
285− var rsa RawSockaddrAny
286− var len _Socklen = SizeofSockaddrAny
287− nfd, err = accept(fd, &rsa, &len)
288− if err != nil {
289− return
290− }
291− if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 {
292− // Accepted socket has no address.
293− // This is likely due to a bug in xnu kernels,
294− // where instead of ECONNABORTED error socket
295− // is accepted, but has no address.
296− Close(nfd)
297− return 0, nil, ECONNABORTED
298− }
299− sa, err = anyToSockaddr(fd, &rsa)
300− if err != nil {
301− Close(nfd)
302− nfd = 0
303− }
304− return
305−}
306−
307−func Getsockname(fd int) (sa Sockaddr, err error) {
308− var rsa RawSockaddrAny
309− var len _Socklen = SizeofSockaddrAny
310− if err = getsockname(fd, &rsa, &len); err != nil {
311− return
312− }
313− // TODO(jsing): DragonFly has a "bug" (see issue 3349), which should be
314− // reported upstream.
315− if runtime.GOOS == "dragonfly" && rsa.Addr.Family == AF_UNSPEC && rsa.Addr.Len == 0 {
316− rsa.Addr.Family = AF_UNIX
317− rsa.Addr.Len = SizeofSockaddrUnix
318− }
319− return anyToSockaddr(fd, &rsa)
320−}
321−
322−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
323−
324−// GetsockoptString returns the string value of the socket option opt for the
325−// socket associated with fd at the given socket level.
326−func GetsockoptString(fd, level, opt int) (string, error) {
327− buf := make([]byte, 256)
328− vallen := _Socklen(len(buf))
329− err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
330− if err != nil {
331− return "", err
332− }
333− return string(buf[:vallen-1]), nil
334−}
335−
336−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
337−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
338−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
339−
340−func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
341− var msg Msghdr
342− var rsa RawSockaddrAny
343− msg.Name = (*byte)(unsafe.Pointer(&rsa))
344− msg.Namelen = uint32(SizeofSockaddrAny)
345− var iov Iovec
346− if len(p) > 0 {
347− iov.Base = (*byte)(unsafe.Pointer(&p[0]))
348− iov.SetLen(len(p))
349− }
350− var dummy byte
351− if len(oob) > 0 {
352− // receive at least one normal byte
353− if len(p) == 0 {
354− iov.Base = &dummy
355− iov.SetLen(1)
356− }
357− msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
358− msg.SetControllen(len(oob))
359− }
360− msg.Iov = &iov
361− msg.Iovlen = 1
362− if n, err = recvmsg(fd, &msg, flags); err != nil {
363− return
364− }
365− oobn = int(msg.Controllen)
366− recvflags = int(msg.Flags)
367− // source address is only specified if the socket is unconnected
368− if rsa.Addr.Family != AF_UNSPEC {
369− from, err = anyToSockaddr(fd, &rsa)
370− }
371− return
372−}
373−
374−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
375−
376−func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
377− _, err = SendmsgN(fd, p, oob, to, flags)
378− return
379−}
380−
381−func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
382− var ptr unsafe.Pointer
383− var salen _Socklen
384− if to != nil {
385− ptr, salen, err = to.sockaddr()
386− if err != nil {
387− return 0, err
388− }
389− }
390− var msg Msghdr
391− msg.Name = (*byte)(unsafe.Pointer(ptr))
392− msg.Namelen = uint32(salen)
393− var iov Iovec
394− if len(p) > 0 {
395− iov.Base = (*byte)(unsafe.Pointer(&p[0]))
396− iov.SetLen(len(p))
397− }
398− var dummy byte
399− if len(oob) > 0 {
400− // send at least one normal byte
401− if len(p) == 0 {
402− iov.Base = &dummy
403− iov.SetLen(1)
404− }
405− msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
406− msg.SetControllen(len(oob))
407− }
408− msg.Iov = &iov
409− msg.Iovlen = 1
410− if n, err = sendmsg(fd, &msg, flags); err != nil {
411− return 0, err
412− }
413− if len(oob) > 0 && len(p) == 0 {
414− n = 0
415− }
416− return n, nil
417−}
418−
419−//sys kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error)
420−
421−func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, err error) {
422− var change, event unsafe.Pointer
423− if len(changes) > 0 {
424− change = unsafe.Pointer(&changes[0])
425− }
426− if len(events) > 0 {
427− event = unsafe.Pointer(&events[0])
428− }
429− return kevent(kq, change, len(changes), event, len(events), timeout)
430−}
431−
432−// sysctlmib translates name to mib number and appends any additional args.
433−func sysctlmib(name string, args ...int) ([]_C_int, error) {
434− // Translate name to mib number.
435− mib, err := nametomib(name)
436− if err != nil {
437− return nil, err
438− }
439−
440− for _, a := range args {
441− mib = append(mib, _C_int(a))
442− }
443−
444− return mib, nil
445−}
446−
447−func Sysctl(name string) (string, error) {
448− return SysctlArgs(name)
449−}
450−
451−func SysctlArgs(name string, args ...int) (string, error) {
452− buf, err := SysctlRaw(name, args...)
453− if err != nil {
454− return "", err
455− }
456− n := len(buf)
457−
458− // Throw away terminating NUL.
459− if n > 0 && buf[n-1] == '\x00' {
460− n--
461− }
462− return string(buf[0:n]), nil
463−}
464−
465−func SysctlUint32(name string) (uint32, error) {
466− return SysctlUint32Args(name)
467−}
468−
469−func SysctlUint32Args(name string, args ...int) (uint32, error) {
470− mib, err := sysctlmib(name, args...)
471− if err != nil {
472− return 0, err
473− }
474−
475− n := uintptr(4)
476− buf := make([]byte, 4)
477− if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
478− return 0, err
479− }
480− if n != 4 {
481− return 0, EIO
482− }
483− return *(*uint32)(unsafe.Pointer(&buf[0])), nil
484−}
485−
486−func SysctlUint64(name string, args ...int) (uint64, error) {
487− mib, err := sysctlmib(name, args...)
488− if err != nil {
489− return 0, err
490− }
491−
492− n := uintptr(8)
493− buf := make([]byte, 8)
494− if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
495− return 0, err
496− }
497− if n != 8 {
498− return 0, EIO
499− }
500− return *(*uint64)(unsafe.Pointer(&buf[0])), nil
501−}
502−
503−func SysctlRaw(name string, args ...int) ([]byte, error) {
504− mib, err := sysctlmib(name, args...)
505− if err != nil {
506− return nil, err
507− }
508−
509− // Find size.
510− n := uintptr(0)
511− if err := sysctl(mib, nil, &n, nil, 0); err != nil {
512− return nil, err
513− }
514− if n == 0 {
515− return nil, nil
516− }
517−
518− // Read into buffer of that size.
519− buf := make([]byte, n)
520− if err := sysctl(mib, &buf[0], &n, nil, 0); err != nil {
521− return nil, err
522− }
523−
524− // The actual call may return less than the original reported required
525− // size so ensure we deal with that.
526− return buf[:n], nil
527−}
528−
529−func SysctlClockinfo(name string) (*Clockinfo, error) {
530− mib, err := sysctlmib(name)
531− if err != nil {
532− return nil, err
533− }
534−
535− n := uintptr(SizeofClockinfo)
536− var ci Clockinfo
537− if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
538− return nil, err
539− }
540− if n != SizeofClockinfo {
541− return nil, EIO
542− }
543− return &ci, nil
544−}
545−
546−func SysctlTimeval(name string) (*Timeval, error) {
547− mib, err := sysctlmib(name)
548− if err != nil {
549− return nil, err
550− }
551−
552− var tv Timeval
553− n := uintptr(unsafe.Sizeof(tv))
554− if err := sysctl(mib, (*byte)(unsafe.Pointer(&tv)), &n, nil, 0); err != nil {
555− return nil, err
556− }
557− if n != unsafe.Sizeof(tv) {
558− return nil, EIO
559− }
560− return &tv, nil
561−}
562−
563−//sys utimes(path string, timeval *[2]Timeval) (err error)
564−
565−func Utimes(path string, tv []Timeval) error {
566− if tv == nil {
567− return utimes(path, nil)
568− }
569− if len(tv) != 2 {
570− return EINVAL
571− }
572− return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
573−}
574−
575−func UtimesNano(path string, ts []Timespec) error {
576− if ts == nil {
577− err := utimensat(AT_FDCWD, path, nil, 0)
578− if err != ENOSYS {
579− return err
580− }
581− return utimes(path, nil)
582− }
583− if len(ts) != 2 {
584− return EINVAL
585− }
586− // Darwin setattrlist can set nanosecond timestamps
587− err := setattrlistTimes(path, ts, 0)
588− if err != ENOSYS {
589− return err
590− }
591− err = utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
592− if err != ENOSYS {
593− return err
594− }
595− // Not as efficient as it could be because Timespec and
596− // Timeval have different types in the different OSes
597− tv := [2]Timeval{
598− NsecToTimeval(TimespecToNsec(ts[0])),
599− NsecToTimeval(TimespecToNsec(ts[1])),
600− }
601− return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
602−}
603−
604−func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
605− if ts == nil {
606− return utimensat(dirfd, path, nil, flags)
607− }
608− if len(ts) != 2 {
609− return EINVAL
610− }
611− err := setattrlistTimes(path, ts, flags)
612− if err != ENOSYS {
613− return err
614− }
615− return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
616−}
617−
618−//sys futimes(fd int, timeval *[2]Timeval) (err error)
619−
620−func Futimes(fd int, tv []Timeval) error {
621− if tv == nil {
622− return futimes(fd, nil)
623− }
624− if len(tv) != 2 {
625− return EINVAL
626− }
627− return futimes(fd, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
628−}
629−
630−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
631−
632−func Poll(fds []PollFd, timeout int) (n int, err error) {
633− if len(fds) == 0 {
634− return poll(nil, 0, timeout)
635− }
636− return poll(&fds[0], len(fds), timeout)
637−}
638−
639−// TODO: wrap
640−// Acct(name nil-string) (err error)
641−// Gethostuuid(uuid *byte, timeout *Timespec) (err error)
642−// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, err error)
643−
644−var mapper = &mmapper{
645− active: make(map[*byte][]byte),
646− mmap: mmap,
647− munmap: munmap,
648−}
649−
650−func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
651− return mapper.Mmap(fd, offset, length, prot, flags)
652−}
653−
654−func Munmap(b []byte) (err error) {
655− return mapper.Munmap(b)
656−}
657−
658−//sys Madvise(b []byte, behav int) (err error)
659−//sys Mlock(b []byte) (err error)
660−//sys Mlockall(flags int) (err error)
661−//sys Mprotect(b []byte, prot int) (err error)
662−//sys Msync(b []byte, flags int) (err error)
663−//sys Munlock(b []byte) (err error)
664−//sys Munlockall() (err error)
vendor/golang.org/x/sys/unix/syscall_darwin.1_12.godeleted−32
@@ -1,32 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build darwin && go1.12 && !go1.13
6−// +build darwin,go1.12,!go1.13
7−
8−package unix
9−
10−import (
11− "unsafe"
12−)
13−
14−const _SYS_GETDIRENTRIES64 = 344
15−
16−func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
17− // To implement this using libSystem we'd need syscall_syscallPtr for
18− // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall
19− // back to raw syscalls for this func on Go 1.12.
20− var p unsafe.Pointer
21− if len(buf) > 0 {
22− p = unsafe.Pointer(&buf[0])
23− } else {
24− p = unsafe.Pointer(&_zero)
25− }
26− r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
27− n = int(r0)
28− if e1 != 0 {
29− return n, errnoErr(e1)
30− }
31− return n, nil
32−}
vendor/golang.org/x/sys/unix/syscall_darwin.1_13.godeleted−108
@@ -1,108 +0,0 @@
1−// Copyright 2019 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build darwin && go1.13
6−// +build darwin,go1.13
7−
8−package unix
9−
10−import (
11− "unsafe"
12−
13− "golang.org/x/sys/internal/unsafeheader"
14−)
15−
16−//sys closedir(dir uintptr) (err error)
17−//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
18−
19−func fdopendir(fd int) (dir uintptr, err error) {
20− r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0)
21− dir = uintptr(r0)
22− if e1 != 0 {
23− err = errnoErr(e1)
24− }
25− return
26−}
27−
28−func libc_fdopendir_trampoline()
29−
30−//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
31−
32−func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
33− // Simulate Getdirentries using fdopendir/readdir_r/closedir.
34− // We store the number of entries to skip in the seek
35− // offset of fd. See issue #31368.
36− // It's not the full required semantics, but should handle the case
37− // of calling Getdirentries or ReadDirent repeatedly.
38− // It won't handle assigning the results of lseek to *basep, or handle
39− // the directory being edited underfoot.
40− skip, err := Seek(fd, 0, 1 /* SEEK_CUR */)
41− if err != nil {
42− return 0, err
43− }
44−
45− // We need to duplicate the incoming file descriptor
46− // because the caller expects to retain control of it, but
47− // fdopendir expects to take control of its argument.
48− // Just Dup'ing the file descriptor is not enough, as the
49− // result shares underlying state. Use Openat to make a really
50− // new file descriptor referring to the same directory.
51− fd2, err := Openat(fd, ".", O_RDONLY, 0)
52− if err != nil {
53− return 0, err
54− }
55− d, err := fdopendir(fd2)
56− if err != nil {
57− Close(fd2)
58− return 0, err
59− }
60− defer closedir(d)
61−
62− var cnt int64
63− for {
64− var entry Dirent
65− var entryp *Dirent
66− e := readdir_r(d, &entry, &entryp)
67− if e != 0 {
68− return n, errnoErr(e)
69− }
70− if entryp == nil {
71− break
72− }
73− if skip > 0 {
74− skip--
75− cnt++
76− continue
77− }
78−
79− reclen := int(entry.Reclen)
80− if reclen > len(buf) {
81− // Not enough room. Return for now.
82− // The counter will let us know where we should start up again.
83− // Note: this strategy for suspending in the middle and
84− // restarting is O(n^2) in the length of the directory. Oh well.
85− break
86− }
87−
88− // Copy entry into return buffer.
89− var s []byte
90− hdr := (*unsafeheader.Slice)(unsafe.Pointer(&s))
91− hdr.Data = unsafe.Pointer(&entry)
92− hdr.Cap = reclen
93− hdr.Len = reclen
94− copy(buf, s)
95−
96− buf = buf[reclen:]
97− n += reclen
98− cnt++
99− }
100− // Set the seek offset of the input fd to record
101− // how many files we've already returned.
102− _, err = Seek(fd, cnt, 0 /* SEEK_SET */)
103− if err != nil {
104− return n, err
105− }
106−
107− return n, nil
108−}
vendor/golang.org/x/sys/unix/syscall_darwin.godeleted−677
@@ -1,677 +0,0 @@
1−// Copyright 2009,2010 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Darwin system calls.
6−// This file is compiled as ordinary Go code,
7−// but it is also input to mksyscall,
8−// which parses the //sys lines and generates system call stubs.
9−// Note that sometimes we use a lowercase //sys name and wrap
10−// it in our own nicer implementation, either here or in
11−// syscall_bsd.go or syscall_unix.go.
12−
13−package unix
14−
15−import (
16− "runtime"
17− "syscall"
18− "unsafe"
19−)
20−
21−// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
22−type SockaddrDatalink struct {
23− Len uint8
24− Family uint8
25− Index uint16
26− Type uint8
27− Nlen uint8
28− Alen uint8
29− Slen uint8
30− Data [12]int8
31− raw RawSockaddrDatalink
32−}
33−
34−// SockaddrCtl implements the Sockaddr interface for AF_SYSTEM type sockets.
35−type SockaddrCtl struct {
36− ID uint32
37− Unit uint32
38− raw RawSockaddrCtl
39−}
40−
41−func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
42− sa.raw.Sc_len = SizeofSockaddrCtl
43− sa.raw.Sc_family = AF_SYSTEM
44− sa.raw.Ss_sysaddr = AF_SYS_CONTROL
45− sa.raw.Sc_id = sa.ID
46− sa.raw.Sc_unit = sa.Unit
47− return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
48−}
49−
50−func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
51− switch rsa.Addr.Family {
52− case AF_SYSTEM:
53− pp := (*RawSockaddrCtl)(unsafe.Pointer(rsa))
54− if pp.Ss_sysaddr == AF_SYS_CONTROL {
55− sa := new(SockaddrCtl)
56− sa.ID = pp.Sc_id
57− sa.Unit = pp.Sc_unit
58− return sa, nil
59− }
60− }
61− return nil, EAFNOSUPPORT
62−}
63−
64−// Some external packages rely on SYS___SYSCTL being defined to implement their
65−// own sysctl wrappers. Provide it here, even though direct syscalls are no
66−// longer supported on darwin.
67−const SYS___SYSCTL = SYS_SYSCTL
68−
69−// Translate "kern.hostname" to []_C_int{0,1,2,3}.
70−func nametomib(name string) (mib []_C_int, err error) {
71− const siz = unsafe.Sizeof(mib[0])
72−
73− // NOTE(rsc): It seems strange to set the buffer to have
74− // size CTL_MAXNAME+2 but use only CTL_MAXNAME
75− // as the size. I don't know why the +2 is here, but the
76− // kernel uses +2 for its own implementation of this function.
77− // I am scared that if we don't include the +2 here, the kernel
78− // will silently write 2 words farther than we specify
79− // and we'll get memory corruption.
80− var buf [CTL_MAXNAME + 2]_C_int
81− n := uintptr(CTL_MAXNAME) * siz
82−
83− p := (*byte)(unsafe.Pointer(&buf[0]))
84− bytes, err := ByteSliceFromString(name)
85− if err != nil {
86− return nil, err
87− }
88−
89− // Magic sysctl: "setting" 0.3 to a string name
90− // lets you read back the array of integers form.
91− if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
92− return nil, err
93− }
94− return buf[0 : n/siz], nil
95−}
96−
97−func direntIno(buf []byte) (uint64, bool) {
98− return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
99−}
100−
101−func direntReclen(buf []byte) (uint64, bool) {
102− return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
103−}
104−
105−func direntNamlen(buf []byte) (uint64, bool) {
106− return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
107−}
108−
109−func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
110−func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
111−
112−type attrList struct {
113− bitmapCount uint16
114− _ uint16
115− CommonAttr uint32
116− VolAttr uint32
117− DirAttr uint32
118− FileAttr uint32
119− Forkattr uint32
120−}
121−
122−//sysnb pipe(p *[2]int32) (err error)
123−
124−func Pipe(p []int) (err error) {
125− if len(p) != 2 {
126− return EINVAL
127− }
128− var x [2]int32
129− err = pipe(&x)
130− p[0] = int(x[0])
131− p[1] = int(x[1])
132− return
133−}
134−
135−func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
136− var _p0 unsafe.Pointer
137− var bufsize uintptr
138− if len(buf) > 0 {
139− _p0 = unsafe.Pointer(&buf[0])
140− bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
141− }
142− return getfsstat(_p0, bufsize, flags)
143−}
144−
145−func xattrPointer(dest []byte) *byte {
146− // It's only when dest is set to NULL that the OS X implementations of
147− // getxattr() and listxattr() return the current sizes of the named attributes.
148− // An empty byte array is not sufficient. To maintain the same behaviour as the
149− // linux implementation, we wrap around the system calls and pass in NULL when
150− // dest is empty.
151− var destp *byte
152− if len(dest) > 0 {
153− destp = &dest[0]
154− }
155− return destp
156−}
157−
158−//sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
159−
160−func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
161− return getxattr(path, attr, xattrPointer(dest), len(dest), 0, 0)
162−}
163−
164−func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
165− return getxattr(link, attr, xattrPointer(dest), len(dest), 0, XATTR_NOFOLLOW)
166−}
167−
168−//sys fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
169−
170−func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
171− return fgetxattr(fd, attr, xattrPointer(dest), len(dest), 0, 0)
172−}
173−
174−//sys setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error)
175−
176−func Setxattr(path string, attr string, data []byte, flags int) (err error) {
177− // The parameters for the OS X implementation vary slightly compared to the
178− // linux system call, specifically the position parameter:
179− //
180− // linux:
181− // int setxattr(
182− // const char *path,
183− // const char *name,
184− // const void *value,
185− // size_t size,
186− // int flags
187− // );
188− //
189− // darwin:
190− // int setxattr(
191− // const char *path,
192− // const char *name,
193− // void *value,
194− // size_t size,
195− // u_int32_t position,
196− // int options
197− // );
198− //
199− // position specifies the offset within the extended attribute. In the
200− // current implementation, only the resource fork extended attribute makes
201− // use of this argument. For all others, position is reserved. We simply
202− // default to setting it to zero.
203− return setxattr(path, attr, xattrPointer(data), len(data), 0, flags)
204−}
205−
206−func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
207− return setxattr(link, attr, xattrPointer(data), len(data), 0, flags|XATTR_NOFOLLOW)
208−}
209−
210−//sys fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error)
211−
212−func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
213− return fsetxattr(fd, attr, xattrPointer(data), len(data), 0, 0)
214−}
215−
216−//sys removexattr(path string, attr string, options int) (err error)
217−
218−func Removexattr(path string, attr string) (err error) {
219− // We wrap around and explicitly zero out the options provided to the OS X
220− // implementation of removexattr, we do so for interoperability with the
221− // linux variant.
222− return removexattr(path, attr, 0)
223−}
224−
225−func Lremovexattr(link string, attr string) (err error) {
226− return removexattr(link, attr, XATTR_NOFOLLOW)
227−}
228−
229−//sys fremovexattr(fd int, attr string, options int) (err error)
230−
231−func Fremovexattr(fd int, attr string) (err error) {
232− return fremovexattr(fd, attr, 0)
233−}
234−
235−//sys listxattr(path string, dest *byte, size int, options int) (sz int, err error)
236−
237−func Listxattr(path string, dest []byte) (sz int, err error) {
238− return listxattr(path, xattrPointer(dest), len(dest), 0)
239−}
240−
241−func Llistxattr(link string, dest []byte) (sz int, err error) {
242− return listxattr(link, xattrPointer(dest), len(dest), XATTR_NOFOLLOW)
243−}
244−
245−//sys flistxattr(fd int, dest *byte, size int, options int) (sz int, err error)
246−
247−func Flistxattr(fd int, dest []byte) (sz int, err error) {
248− return flistxattr(fd, xattrPointer(dest), len(dest), 0)
249−}
250−
251−func setattrlistTimes(path string, times []Timespec, flags int) error {
252− _p0, err := BytePtrFromString(path)
253− if err != nil {
254− return err
255− }
256−
257− var attrList attrList
258− attrList.bitmapCount = ATTR_BIT_MAP_COUNT
259− attrList.CommonAttr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME
260−
261− // order is mtime, atime: the opposite of Chtimes
262− attributes := [2]Timespec{times[1], times[0]}
263− options := 0
264− if flags&AT_SYMLINK_NOFOLLOW != 0 {
265− options |= FSOPT_NOFOLLOW
266− }
267− return setattrlist(
268− _p0,
269− unsafe.Pointer(&attrList),
270− unsafe.Pointer(&attributes),
271− unsafe.Sizeof(attributes),
272− options)
273−}
274−
275−//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
276−
277−func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
278− // Darwin doesn't support SYS_UTIMENSAT
279− return ENOSYS
280−}
281−
282−/*
283− * Wrapped
284− */
285−
286−//sys fcntl(fd int, cmd int, arg int) (val int, err error)
287−
288−//sys kill(pid int, signum int, posix int) (err error)
289−
290−func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
291−
292−//sys ioctl(fd int, req uint, arg uintptr) (err error)
293−
294−func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
295− err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo)))
296− runtime.KeepAlive(ctlInfo)
297− return err
298−}
299−
300−// IfreqMTU is struct ifreq used to get or set a network device's MTU.
301−type IfreqMTU struct {
302− Name [IFNAMSIZ]byte
303− MTU int32
304−}
305−
306−// IoctlGetIfreqMTU performs the SIOCGIFMTU ioctl operation on fd to get the MTU
307−// of the network device specified by ifname.
308−func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
309− var ifreq IfreqMTU
310− copy(ifreq.Name[:], ifname)
311− err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq)))
312− return &ifreq, err
313−}
314−
315−// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
316−// of the network device specified by ifreq.Name.
317−func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
318− err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq)))
319− runtime.KeepAlive(ifreq)
320− return err
321−}
322−
323−//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
324−
325−func Uname(uname *Utsname) error {
326− mib := []_C_int{CTL_KERN, KERN_OSTYPE}
327− n := unsafe.Sizeof(uname.Sysname)
328− if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
329− return err
330− }
331−
332− mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
333− n = unsafe.Sizeof(uname.Nodename)
334− if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
335− return err
336− }
337−
338− mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
339− n = unsafe.Sizeof(uname.Release)
340− if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
341− return err
342− }
343−
344− mib = []_C_int{CTL_KERN, KERN_VERSION}
345− n = unsafe.Sizeof(uname.Version)
346− if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
347− return err
348− }
349−
350− // The version might have newlines or tabs in it, convert them to
351− // spaces.
352− for i, b := range uname.Version {
353− if b == '\n' || b == '\t' {
354− if i == len(uname.Version)-1 {
355− uname.Version[i] = 0
356− } else {
357− uname.Version[i] = ' '
358− }
359− }
360− }
361−
362− mib = []_C_int{CTL_HW, HW_MACHINE}
363− n = unsafe.Sizeof(uname.Machine)
364− if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
365− return err
366− }
367−
368− return nil
369−}
370−
371−func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
372− if raceenabled {
373− raceReleaseMerge(unsafe.Pointer(&ioSync))
374− }
375− var length = int64(count)
376− err = sendfile(infd, outfd, *offset, &length, nil, 0)
377− written = int(length)
378− return
379−}
380−
381−// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct.
382−// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
383−func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
384− x := new(Xucred)
385− vallen := _Socklen(SizeofXucred)
386− err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
387− return x, err
388−}
389−
390−//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
391−
392−/*
393− * Exposed directly
394− */
395−//sys Access(path string, mode uint32) (err error)
396−//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
397−//sys Chdir(path string) (err error)
398−//sys Chflags(path string, flags int) (err error)
399−//sys Chmod(path string, mode uint32) (err error)
400−//sys Chown(path string, uid int, gid int) (err error)
401−//sys Chroot(path string) (err error)
402−//sys ClockGettime(clockid int32, time *Timespec) (err error)
403−//sys Close(fd int) (err error)
404−//sys Clonefile(src string, dst string, flags int) (err error)
405−//sys Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error)
406−//sys Dup(fd int) (nfd int, err error)
407−//sys Dup2(from int, to int) (err error)
408−//sys Exchangedata(path1 string, path2 string, options int) (err error)
409−//sys Exit(code int)
410−//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
411−//sys Fchdir(fd int) (err error)
412−//sys Fchflags(fd int, flags int) (err error)
413−//sys Fchmod(fd int, mode uint32) (err error)
414−//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
415−//sys Fchown(fd int, uid int, gid int) (err error)
416−//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
417−//sys Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
418−//sys Flock(fd int, how int) (err error)
419−//sys Fpathconf(fd int, name int) (val int, err error)
420−//sys Fsync(fd int) (err error)
421−//sys Ftruncate(fd int, length int64) (err error)
422−//sys Getcwd(buf []byte) (n int, err error)
423−//sys Getdtablesize() (size int)
424−//sysnb Getegid() (egid int)
425−//sysnb Geteuid() (uid int)
426−//sysnb Getgid() (gid int)
427−//sysnb Getpgid(pid int) (pgid int, err error)
428−//sysnb Getpgrp() (pgrp int)
429−//sysnb Getpid() (pid int)
430−//sysnb Getppid() (ppid int)
431−//sys Getpriority(which int, who int) (prio int, err error)
432−//sysnb Getrlimit(which int, lim *Rlimit) (err error)
433−//sysnb Getrusage(who int, rusage *Rusage) (err error)
434−//sysnb Getsid(pid int) (sid int, err error)
435−//sysnb Gettimeofday(tp *Timeval) (err error)
436−//sysnb Getuid() (uid int)
437−//sysnb Issetugid() (tainted bool)
438−//sys Kqueue() (fd int, err error)
439−//sys Lchown(path string, uid int, gid int) (err error)
440−//sys Link(path string, link string) (err error)
441−//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
442−//sys Listen(s int, backlog int) (err error)
443−//sys Mkdir(path string, mode uint32) (err error)
444−//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
445−//sys Mkfifo(path string, mode uint32) (err error)
446−//sys Mknod(path string, mode uint32, dev int) (err error)
447−//sys Open(path string, mode int, perm uint32) (fd int, err error)
448−//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
449−//sys Pathconf(path string, name int) (val int, err error)
450−//sys Pread(fd int, p []byte, offset int64) (n int, err error)
451−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
452−//sys read(fd int, p []byte) (n int, err error)
453−//sys Readlink(path string, buf []byte) (n int, err error)
454−//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
455−//sys Rename(from string, to string) (err error)
456−//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
457−//sys Revoke(path string) (err error)
458−//sys Rmdir(path string) (err error)
459−//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
460−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
461−//sys Setegid(egid int) (err error)
462−//sysnb Seteuid(euid int) (err error)
463−//sysnb Setgid(gid int) (err error)
464−//sys Setlogin(name string) (err error)
465−//sysnb Setpgid(pid int, pgid int) (err error)
466−//sys Setpriority(which int, who int, prio int) (err error)
467−//sys Setprivexec(flag int) (err error)
468−//sysnb Setregid(rgid int, egid int) (err error)
469−//sysnb Setreuid(ruid int, euid int) (err error)
470−//sysnb Setrlimit(which int, lim *Rlimit) (err error)
471−//sysnb Setsid() (pid int, err error)
472−//sysnb Settimeofday(tp *Timeval) (err error)
473−//sysnb Setuid(uid int) (err error)
474−//sys Symlink(path string, link string) (err error)
475−//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
476−//sys Sync() (err error)
477−//sys Truncate(path string, length int64) (err error)
478−//sys Umask(newmask int) (oldmask int)
479−//sys Undelete(path string) (err error)
480−//sys Unlink(path string) (err error)
481−//sys Unlinkat(dirfd int, path string, flags int) (err error)
482−//sys Unmount(path string, flags int) (err error)
483−//sys write(fd int, p []byte) (n int, err error)
484−//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
485−//sys munmap(addr uintptr, length uintptr) (err error)
486−//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
487−//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
488−
489−/*
490− * Unimplemented
491− */
492−// Profil
493−// Sigaction
494−// Sigprocmask
495−// Getlogin
496−// Sigpending
497−// Sigaltstack
498−// Ioctl
499−// Reboot
500−// Execve
501−// Vfork
502−// Sbrk
503−// Sstk
504−// Ovadvise
505−// Mincore
506−// Setitimer
507−// Swapon
508−// Select
509−// Sigsuspend
510−// Readv
511−// Writev
512−// Nfssvc
513−// Getfh
514−// Quotactl
515−// Mount
516−// Csops
517−// Waitid
518−// Add_profil
519−// Kdebug_trace
520−// Sigreturn
521−// Atsocket
522−// Kqueue_from_portset_np
523−// Kqueue_portset
524−// Getattrlist
525−// Setattrlist
526−// Getdirentriesattr
527−// Searchfs
528−// Delete
529−// Copyfile
530−// Watchevent
531−// Waitevent
532−// Modwatch
533−// Fsctl
534−// Initgroups
535−// Posix_spawn
536−// Nfsclnt
537−// Fhopen
538−// Minherit
539−// Semsys
540−// Msgsys
541−// Shmsys
542−// Semctl
543−// Semget
544−// Semop
545−// Msgctl
546−// Msgget
547−// Msgsnd
548−// Msgrcv
549−// Shmat
550−// Shmctl
551−// Shmdt
552−// Shmget
553−// Shm_open
554−// Shm_unlink
555−// Sem_open
556−// Sem_close
557−// Sem_unlink
558−// Sem_wait
559−// Sem_trywait
560−// Sem_post
561−// Sem_getvalue
562−// Sem_init
563−// Sem_destroy
564−// Open_extended
565−// Umask_extended
566−// Stat_extended
567−// Lstat_extended
568−// Fstat_extended
569−// Chmod_extended
570−// Fchmod_extended
571−// Access_extended
572−// Settid
573−// Gettid
574−// Setsgroups
575−// Getsgroups
576−// Setwgroups
577−// Getwgroups
578−// Mkfifo_extended
579−// Mkdir_extended
580−// Identitysvc
581−// Shared_region_check_np
582−// Shared_region_map_np
583−// __pthread_mutex_destroy
584−// __pthread_mutex_init
585−// __pthread_mutex_lock
586−// __pthread_mutex_trylock
587−// __pthread_mutex_unlock
588−// __pthread_cond_init
589−// __pthread_cond_destroy
590−// __pthread_cond_broadcast
591−// __pthread_cond_signal
592−// Setsid_with_pid
593−// __pthread_cond_timedwait
594−// Aio_fsync
595−// Aio_return
596−// Aio_suspend
597−// Aio_cancel
598−// Aio_error
599−// Aio_read
600−// Aio_write
601−// Lio_listio
602−// __pthread_cond_wait
603−// Iopolicysys
604−// __pthread_kill
605−// __pthread_sigmask
606−// __sigwait
607−// __disable_threadsignal
608−// __pthread_markcancel
609−// __pthread_canceled
610−// __semwait_signal
611−// Proc_info
612−// sendfile
613−// Stat64_extended
614−// Lstat64_extended
615−// Fstat64_extended
616−// __pthread_chdir
617−// __pthread_fchdir
618−// Audit
619−// Auditon
620−// Getauid
621−// Setauid
622−// Getaudit
623−// Setaudit
624−// Getaudit_addr
625−// Setaudit_addr
626−// Auditctl
627−// Bsdthread_create
628−// Bsdthread_terminate
629−// Stack_snapshot
630−// Bsdthread_register
631−// Workq_open
632−// Workq_ops
633−// __mac_execve
634−// __mac_syscall
635−// __mac_get_file
636−// __mac_set_file
637−// __mac_get_link
638−// __mac_set_link
639−// __mac_get_proc
640−// __mac_set_proc
641−// __mac_get_fd
642−// __mac_set_fd
643−// __mac_get_pid
644−// __mac_get_lcid
645−// __mac_get_lctx
646−// __mac_set_lctx
647−// Setlcid
648−// Read_nocancel
649−// Write_nocancel
650−// Open_nocancel
651−// Close_nocancel
652−// Wait4_nocancel
653−// Recvmsg_nocancel
654−// Sendmsg_nocancel
655−// Recvfrom_nocancel
656−// Accept_nocancel
657−// Fcntl_nocancel
658−// Select_nocancel
659−// Fsync_nocancel
660−// Connect_nocancel
661−// Sigsuspend_nocancel
662−// Readv_nocancel
663−// Writev_nocancel
664−// Sendto_nocancel
665−// Pread_nocancel
666−// Pwrite_nocancel
667−// Waitid_nocancel
668−// Poll_nocancel
669−// Msgsnd_nocancel
670−// Msgrcv_nocancel
671−// Sem_wait_nocancel
672−// Aio_suspend_nocancel
673−// __sigwait_nocancel
674−// __semwait_signal_nocancel
675−// __mac_mount
676−// __mac_get_mount
677−// __mac_getfsstat
vendor/golang.org/x/sys/unix/syscall_darwin_386.godeleted−51
@@ -1,51 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build 386 && darwin
6−// +build 386,darwin
7−
8−package unix
9−
10−import "syscall"
11−
12−func setTimespec(sec, nsec int64) Timespec {
13− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
14−}
15−
16−func setTimeval(sec, usec int64) Timeval {
17− return Timeval{Sec: int32(sec), Usec: int32(usec)}
18−}
19−
20−func SetKevent(k *Kevent_t, fd, mode, flags int) {
21− k.Ident = uint32(fd)
22− k.Filter = int16(mode)
23− k.Flags = uint16(flags)
24−}
25−
26−func (iov *Iovec) SetLen(length int) {
27− iov.Len = uint32(length)
28−}
29−
30−func (msghdr *Msghdr) SetControllen(length int) {
31− msghdr.Controllen = uint32(length)
32−}
33−
34−func (msghdr *Msghdr) SetIovlen(length int) {
35− msghdr.Iovlen = int32(length)
36−}
37−
38−func (cmsg *Cmsghdr) SetLen(length int) {
39− cmsg.Len = uint32(length)
40−}
41−
42−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
43−
44−//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
45−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
46−//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
47−//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
48−//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
49−//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
50−//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
51−//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.godeleted−51
@@ -1,51 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build amd64 && darwin
6−// +build amd64,darwin
7−
8−package unix
9−
10−import "syscall"
11−
12−func setTimespec(sec, nsec int64) Timespec {
13− return Timespec{Sec: sec, Nsec: nsec}
14−}
15−
16−func setTimeval(sec, usec int64) Timeval {
17− return Timeval{Sec: sec, Usec: int32(usec)}
18−}
19−
20−func SetKevent(k *Kevent_t, fd, mode, flags int) {
21− k.Ident = uint64(fd)
22− k.Filter = int16(mode)
23− k.Flags = uint16(flags)
24−}
25−
26−func (iov *Iovec) SetLen(length int) {
27− iov.Len = uint64(length)
28−}
29−
30−func (msghdr *Msghdr) SetControllen(length int) {
31− msghdr.Controllen = uint32(length)
32−}
33−
34−func (msghdr *Msghdr) SetIovlen(length int) {
35− msghdr.Iovlen = int32(length)
36−}
37−
38−func (cmsg *Cmsghdr) SetLen(length int) {
39− cmsg.Len = uint32(length)
40−}
41−
42−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
43−
44−//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
45−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
46−//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
47−//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
48−//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
49−//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
50−//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
51−//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
vendor/golang.org/x/sys/unix/syscall_darwin_arm.godeleted−51
@@ -1,51 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−package unix
6−
7−import "syscall"
8−
9−func ptrace1(request int, pid int, addr uintptr, data uintptr) error {
10− return ENOTSUP
11−}
12−
13−func setTimespec(sec, nsec int64) Timespec {
14− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
15−}
16−
17−func setTimeval(sec, usec int64) Timeval {
18− return Timeval{Sec: int32(sec), Usec: int32(usec)}
19−}
20−
21−func SetKevent(k *Kevent_t, fd, mode, flags int) {
22− k.Ident = uint32(fd)
23− k.Filter = int16(mode)
24− k.Flags = uint16(flags)
25−}
26−
27−func (iov *Iovec) SetLen(length int) {
28− iov.Len = uint32(length)
29−}
30−
31−func (msghdr *Msghdr) SetControllen(length int) {
32− msghdr.Controllen = uint32(length)
33−}
34−
35−func (msghdr *Msghdr) SetIovlen(length int) {
36− msghdr.Iovlen = int32(length)
37−}
38−
39−func (cmsg *Cmsghdr) SetLen(length int) {
40− cmsg.Len = uint32(length)
41−}
42−
43−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
44−
45−//sys Fstat(fd int, stat *Stat_t) (err error)
46−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
47−//sys Fstatfs(fd int, stat *Statfs_t) (err error)
48−//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
49−//sys Lstat(path string, stat *Stat_t) (err error)
50−//sys Stat(path string, stat *Stat_t) (err error)
51−//sys Statfs(path string, stat *Statfs_t) (err error)
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.godeleted−51
@@ -1,51 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build arm64 && darwin
6−// +build arm64,darwin
7−
8−package unix
9−
10−import "syscall"
11−
12−func setTimespec(sec, nsec int64) Timespec {
13− return Timespec{Sec: sec, Nsec: nsec}
14−}
15−
16−func setTimeval(sec, usec int64) Timeval {
17− return Timeval{Sec: sec, Usec: int32(usec)}
18−}
19−
20−func SetKevent(k *Kevent_t, fd, mode, flags int) {
21− k.Ident = uint64(fd)
22− k.Filter = int16(mode)
23− k.Flags = uint16(flags)
24−}
25−
26−func (iov *Iovec) SetLen(length int) {
27− iov.Len = uint64(length)
28−}
29−
30−func (msghdr *Msghdr) SetControllen(length int) {
31− msghdr.Controllen = uint32(length)
32−}
33−
34−func (msghdr *Msghdr) SetIovlen(length int) {
35− msghdr.Iovlen = int32(length)
36−}
37−
38−func (cmsg *Cmsghdr) SetLen(length int) {
39− cmsg.Len = uint32(length)
40−}
41−
42−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
43−
44−//sys Fstat(fd int, stat *Stat_t) (err error)
45−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
46−//sys Fstatfs(fd int, stat *Statfs_t) (err error)
47−//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
48−//sys Lstat(path string, stat *Stat_t) (err error)
49−//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
50−//sys Stat(path string, stat *Stat_t) (err error)
51−//sys Statfs(path string, stat *Statfs_t) (err error)
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.godeleted−34
@@ -1,34 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build darwin && go1.12
6−// +build darwin,go1.12
7−
8−package unix
9−
10−import "unsafe"
11−
12−// Implemented in the runtime package (runtime/sys_darwin.go)
13−func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
14−func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
15−func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
16−func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only
17−func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
18−func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
19−func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
20−
21−//go:linkname syscall_syscall syscall.syscall
22−//go:linkname syscall_syscall6 syscall.syscall6
23−//go:linkname syscall_syscall6X syscall.syscall6X
24−//go:linkname syscall_syscall9 syscall.syscall9
25−//go:linkname syscall_rawSyscall syscall.rawSyscall
26−//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
27−//go:linkname syscall_syscallPtr syscall.syscallPtr
28−
29−// Find the entry point for f. See comments in runtime/proc.go for the
30−// function of the same name.
31−//go:nosplit
32−func funcPC(f func()) uintptr {
33− return **(**uintptr)(unsafe.Pointer(&f))
34−}
vendor/golang.org/x/sys/unix/syscall_dragonfly.godeleted−541
@@ -1,541 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// DragonFly BSD system calls.
6−// This file is compiled as ordinary Go code,
7−// but it is also input to mksyscall,
8−// which parses the //sys lines and generates system call stubs.
9−// Note that sometimes we use a lowercase //sys name and wrap
10−// it in our own nicer implementation, either here or in
11−// syscall_bsd.go or syscall_unix.go.
12−
13−package unix
14−
15−import (
16− "sync"
17− "unsafe"
18−)
19−
20−// See version list in https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/param.h
21−var (
22− osreldateOnce sync.Once
23− osreldate uint32
24−)
25−
26−// First __DragonFly_version after September 2019 ABI changes
27−// http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html
28−const _dragonflyABIChangeVersion = 500705
29−
30−func supportsABI(ver uint32) bool {
31− osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
32− return osreldate >= ver
33−}
34−
35−// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
36−type SockaddrDatalink struct {
37− Len uint8
38− Family uint8
39− Index uint16
40− Type uint8
41− Nlen uint8
42− Alen uint8
43− Slen uint8
44− Data [12]int8
45− Rcf uint16
46− Route [16]uint16
47− raw RawSockaddrDatalink
48−}
49−
50−func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
51− return nil, EAFNOSUPPORT
52−}
53−
54−// Translate "kern.hostname" to []_C_int{0,1,2,3}.
55−func nametomib(name string) (mib []_C_int, err error) {
56− const siz = unsafe.Sizeof(mib[0])
57−
58− // NOTE(rsc): It seems strange to set the buffer to have
59− // size CTL_MAXNAME+2 but use only CTL_MAXNAME
60− // as the size. I don't know why the +2 is here, but the
61− // kernel uses +2 for its own implementation of this function.
62− // I am scared that if we don't include the +2 here, the kernel
63− // will silently write 2 words farther than we specify
64− // and we'll get memory corruption.
65− var buf [CTL_MAXNAME + 2]_C_int
66− n := uintptr(CTL_MAXNAME) * siz
67−
68− p := (*byte)(unsafe.Pointer(&buf[0]))
69− bytes, err := ByteSliceFromString(name)
70− if err != nil {
71− return nil, err
72− }
73−
74− // Magic sysctl: "setting" 0.3 to a string name
75− // lets you read back the array of integers form.
76− if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
77− return nil, err
78− }
79− return buf[0 : n/siz], nil
80−}
81−
82−func direntIno(buf []byte) (uint64, bool) {
83− return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
84−}
85−
86−func direntReclen(buf []byte) (uint64, bool) {
87− namlen, ok := direntNamlen(buf)
88− if !ok {
89− return 0, false
90− }
91− return (16 + namlen + 1 + 7) &^ 7, true
92−}
93−
94−func direntNamlen(buf []byte) (uint64, bool) {
95− return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
96−}
97−
98−//sysnb pipe() (r int, w int, err error)
99−
100−func Pipe(p []int) (err error) {
101− if len(p) != 2 {
102− return EINVAL
103− }
104− p[0], p[1], err = pipe()
105− return
106−}
107−
108−//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error)
109−
110−func Pipe2(p []int, flags int) (err error) {
111− if len(p) != 2 {
112− return EINVAL
113− }
114− var pp [2]_C_int
115− // pipe2 on dragonfly takes an fds array as an argument, but still
116− // returns the file descriptors.
117− p[0], p[1], err = pipe2(&pp, flags)
118− return err
119−}
120−
121−//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
122−func Pread(fd int, p []byte, offset int64) (n int, err error) {
123− return extpread(fd, p, 0, offset)
124−}
125−
126−//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error)
127−func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
128− return extpwrite(fd, p, 0, offset)
129−}
130−
131−func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
132− var rsa RawSockaddrAny
133− var len _Socklen = SizeofSockaddrAny
134− nfd, err = accept4(fd, &rsa, &len, flags)
135− if err != nil {
136− return
137− }
138− if len > SizeofSockaddrAny {
139− panic("RawSockaddrAny too small")
140− }
141− sa, err = anyToSockaddr(fd, &rsa)
142− if err != nil {
143− Close(nfd)
144− nfd = 0
145− }
146− return
147−}
148−
149−//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
150−
151−func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
152− var _p0 unsafe.Pointer
153− var bufsize uintptr
154− if len(buf) > 0 {
155− _p0 = unsafe.Pointer(&buf[0])
156− bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
157− }
158− r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
159− n = int(r0)
160− if e1 != 0 {
161− err = e1
162− }
163− return
164−}
165−
166−func setattrlistTimes(path string, times []Timespec, flags int) error {
167− // used on Darwin for UtimesNano
168− return ENOSYS
169−}
170−
171−//sys ioctl(fd int, req uint, arg uintptr) (err error)
172−
173−//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
174−
175−func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error {
176− err := sysctl(mib, old, oldlen, nil, 0)
177− if err != nil {
178− // Utsname members on Dragonfly are only 32 bytes and
179− // the syscall returns ENOMEM in case the actual value
180− // is longer.
181− if err == ENOMEM {
182− err = nil
183− }
184− }
185− return err
186−}
187−
188−func Uname(uname *Utsname) error {
189− mib := []_C_int{CTL_KERN, KERN_OSTYPE}
190− n := unsafe.Sizeof(uname.Sysname)
191− if err := sysctlUname(mib, &uname.Sysname[0], &n); err != nil {
192− return err
193− }
194− uname.Sysname[unsafe.Sizeof(uname.Sysname)-1] = 0
195−
196− mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
197− n = unsafe.Sizeof(uname.Nodename)
198− if err := sysctlUname(mib, &uname.Nodename[0], &n); err != nil {
199− return err
200− }
201− uname.Nodename[unsafe.Sizeof(uname.Nodename)-1] = 0
202−
203− mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
204− n = unsafe.Sizeof(uname.Release)
205− if err := sysctlUname(mib, &uname.Release[0], &n); err != nil {
206− return err
207− }
208− uname.Release[unsafe.Sizeof(uname.Release)-1] = 0
209−
210− mib = []_C_int{CTL_KERN, KERN_VERSION}
211− n = unsafe.Sizeof(uname.Version)
212− if err := sysctlUname(mib, &uname.Version[0], &n); err != nil {
213− return err
214− }
215−
216− // The version might have newlines or tabs in it, convert them to
217− // spaces.
218− for i, b := range uname.Version {
219− if b == '\n' || b == '\t' {
220− if i == len(uname.Version)-1 {
221− uname.Version[i] = 0
222− } else {
223− uname.Version[i] = ' '
224− }
225− }
226− }
227−
228− mib = []_C_int{CTL_HW, HW_MACHINE}
229− n = unsafe.Sizeof(uname.Machine)
230− if err := sysctlUname(mib, &uname.Machine[0], &n); err != nil {
231− return err
232− }
233− uname.Machine[unsafe.Sizeof(uname.Machine)-1] = 0
234−
235− return nil
236−}
237−
238−func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
239− if raceenabled {
240− raceReleaseMerge(unsafe.Pointer(&ioSync))
241− }
242− return sendfile(outfd, infd, offset, count)
243−}
244−
245−/*
246− * Exposed directly
247− */
248−//sys Access(path string, mode uint32) (err error)
249−//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
250−//sys Chdir(path string) (err error)
251−//sys Chflags(path string, flags int) (err error)
252−//sys Chmod(path string, mode uint32) (err error)
253−//sys Chown(path string, uid int, gid int) (err error)
254−//sys Chroot(path string) (err error)
255−//sys Close(fd int) (err error)
256−//sys Dup(fd int) (nfd int, err error)
257−//sys Dup2(from int, to int) (err error)
258−//sys Exit(code int)
259−//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
260−//sys Fchdir(fd int) (err error)
261−//sys Fchflags(fd int, flags int) (err error)
262−//sys Fchmod(fd int, mode uint32) (err error)
263−//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
264−//sys Fchown(fd int, uid int, gid int) (err error)
265−//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
266−//sys Flock(fd int, how int) (err error)
267−//sys Fpathconf(fd int, name int) (val int, err error)
268−//sys Fstat(fd int, stat *Stat_t) (err error)
269−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
270−//sys Fstatfs(fd int, stat *Statfs_t) (err error)
271−//sys Fsync(fd int) (err error)
272−//sys Ftruncate(fd int, length int64) (err error)
273−//sys Getdents(fd int, buf []byte) (n int, err error)
274−//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
275−//sys Getdtablesize() (size int)
276−//sysnb Getegid() (egid int)
277−//sysnb Geteuid() (uid int)
278−//sysnb Getgid() (gid int)
279−//sysnb Getpgid(pid int) (pgid int, err error)
280−//sysnb Getpgrp() (pgrp int)
281−//sysnb Getpid() (pid int)
282−//sysnb Getppid() (ppid int)
283−//sys Getpriority(which int, who int) (prio int, err error)
284−//sysnb Getrlimit(which int, lim *Rlimit) (err error)
285−//sysnb Getrusage(who int, rusage *Rusage) (err error)
286−//sysnb Getsid(pid int) (sid int, err error)
287−//sysnb Gettimeofday(tv *Timeval) (err error)
288−//sysnb Getuid() (uid int)
289−//sys Issetugid() (tainted bool)
290−//sys Kill(pid int, signum syscall.Signal) (err error)
291−//sys Kqueue() (fd int, err error)
292−//sys Lchown(path string, uid int, gid int) (err error)
293−//sys Link(path string, link string) (err error)
294−//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
295−//sys Listen(s int, backlog int) (err error)
296−//sys Lstat(path string, stat *Stat_t) (err error)
297−//sys Mkdir(path string, mode uint32) (err error)
298−//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
299−//sys Mkfifo(path string, mode uint32) (err error)
300−//sys Mknod(path string, mode uint32, dev int) (err error)
301−//sys Mknodat(fd int, path string, mode uint32, dev int) (err error)
302−//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
303−//sys Open(path string, mode int, perm uint32) (fd int, err error)
304−//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
305−//sys Pathconf(path string, name int) (val int, err error)
306−//sys read(fd int, p []byte) (n int, err error)
307−//sys Readlink(path string, buf []byte) (n int, err error)
308−//sys Rename(from string, to string) (err error)
309−//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
310−//sys Revoke(path string) (err error)
311−//sys Rmdir(path string) (err error)
312−//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
313−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
314−//sysnb Setegid(egid int) (err error)
315−//sysnb Seteuid(euid int) (err error)
316−//sysnb Setgid(gid int) (err error)
317−//sys Setlogin(name string) (err error)
318−//sysnb Setpgid(pid int, pgid int) (err error)
319−//sys Setpriority(which int, who int, prio int) (err error)
320−//sysnb Setregid(rgid int, egid int) (err error)
321−//sysnb Setreuid(ruid int, euid int) (err error)
322−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
323−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
324−//sysnb Setrlimit(which int, lim *Rlimit) (err error)
325−//sysnb Setsid() (pid int, err error)
326−//sysnb Settimeofday(tp *Timeval) (err error)
327−//sysnb Setuid(uid int) (err error)
328−//sys Stat(path string, stat *Stat_t) (err error)
329−//sys Statfs(path string, stat *Statfs_t) (err error)
330−//sys Symlink(path string, link string) (err error)
331−//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
332−//sys Sync() (err error)
333−//sys Truncate(path string, length int64) (err error)
334−//sys Umask(newmask int) (oldmask int)
335−//sys Undelete(path string) (err error)
336−//sys Unlink(path string) (err error)
337−//sys Unlinkat(dirfd int, path string, flags int) (err error)
338−//sys Unmount(path string, flags int) (err error)
339−//sys write(fd int, p []byte) (n int, err error)
340−//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
341−//sys munmap(addr uintptr, length uintptr) (err error)
342−//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
343−//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
344−//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
345−//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
346−
347−/*
348− * Unimplemented
349− * TODO(jsing): Update this list for DragonFly.
350− */
351−// Profil
352−// Sigaction
353−// Sigprocmask
354−// Getlogin
355−// Sigpending
356−// Sigaltstack
357−// Reboot
358−// Execve
359−// Vfork
360−// Sbrk
361−// Sstk
362−// Ovadvise
363−// Mincore
364−// Setitimer
365−// Swapon
366−// Select
367−// Sigsuspend
368−// Readv
369−// Writev
370−// Nfssvc
371−// Getfh
372−// Quotactl
373−// Mount
374−// Csops
375−// Waitid
376−// Add_profil
377−// Kdebug_trace
378−// Sigreturn
379−// Atsocket
380−// Kqueue_from_portset_np
381−// Kqueue_portset
382−// Getattrlist
383−// Setattrlist
384−// Getdirentriesattr
385−// Searchfs
386−// Delete
387−// Copyfile
388−// Watchevent
389−// Waitevent
390−// Modwatch
391−// Getxattr
392−// Fgetxattr
393−// Setxattr
394−// Fsetxattr
395−// Removexattr
396−// Fremovexattr
397−// Listxattr
398−// Flistxattr
399−// Fsctl
400−// Initgroups
401−// Posix_spawn
402−// Nfsclnt
403−// Fhopen
404−// Minherit
405−// Semsys
406−// Msgsys
407−// Shmsys
408−// Semctl
409−// Semget
410−// Semop
411−// Msgctl
412−// Msgget
413−// Msgsnd
414−// Msgrcv
415−// Shmat
416−// Shmctl
417−// Shmdt
418−// Shmget
419−// Shm_open
420−// Shm_unlink
421−// Sem_open
422−// Sem_close
423−// Sem_unlink
424−// Sem_wait
425−// Sem_trywait
426−// Sem_post
427−// Sem_getvalue
428−// Sem_init
429−// Sem_destroy
430−// Open_extended
431−// Umask_extended
432−// Stat_extended
433−// Lstat_extended
434−// Fstat_extended
435−// Chmod_extended
436−// Fchmod_extended
437−// Access_extended
438−// Settid
439−// Gettid
440−// Setsgroups
441−// Getsgroups
442−// Setwgroups
443−// Getwgroups
444−// Mkfifo_extended
445−// Mkdir_extended
446−// Identitysvc
447−// Shared_region_check_np
448−// Shared_region_map_np
449−// __pthread_mutex_destroy
450−// __pthread_mutex_init
451−// __pthread_mutex_lock
452−// __pthread_mutex_trylock
453−// __pthread_mutex_unlock
454−// __pthread_cond_init
455−// __pthread_cond_destroy
456−// __pthread_cond_broadcast
457−// __pthread_cond_signal
458−// Setsid_with_pid
459−// __pthread_cond_timedwait
460−// Aio_fsync
461−// Aio_return
462−// Aio_suspend
463−// Aio_cancel
464−// Aio_error
465−// Aio_read
466−// Aio_write
467−// Lio_listio
468−// __pthread_cond_wait
469−// Iopolicysys
470−// __pthread_kill
471−// __pthread_sigmask
472−// __sigwait
473−// __disable_threadsignal
474−// __pthread_markcancel
475−// __pthread_canceled
476−// __semwait_signal
477−// Proc_info
478−// Stat64_extended
479−// Lstat64_extended
480−// Fstat64_extended
481−// __pthread_chdir
482−// __pthread_fchdir
483−// Audit
484−// Auditon
485−// Getauid
486−// Setauid
487−// Getaudit
488−// Setaudit
489−// Getaudit_addr
490−// Setaudit_addr
491−// Auditctl
492−// Bsdthread_create
493−// Bsdthread_terminate
494−// Stack_snapshot
495−// Bsdthread_register
496−// Workq_open
497−// Workq_ops
498−// __mac_execve
499−// __mac_syscall
500−// __mac_get_file
501−// __mac_set_file
502−// __mac_get_link
503−// __mac_set_link
504−// __mac_get_proc
505−// __mac_set_proc
506−// __mac_get_fd
507−// __mac_set_fd
508−// __mac_get_pid
509−// __mac_get_lcid
510−// __mac_get_lctx
511−// __mac_set_lctx
512−// Setlcid
513−// Read_nocancel
514−// Write_nocancel
515−// Open_nocancel
516−// Close_nocancel
517−// Wait4_nocancel
518−// Recvmsg_nocancel
519−// Sendmsg_nocancel
520−// Recvfrom_nocancel
521−// Accept_nocancel
522−// Fcntl_nocancel
523−// Select_nocancel
524−// Fsync_nocancel
525−// Connect_nocancel
526−// Sigsuspend_nocancel
527−// Readv_nocancel
528−// Writev_nocancel
529−// Sendto_nocancel
530−// Pread_nocancel
531−// Pwrite_nocancel
532−// Waitid_nocancel
533−// Msgsnd_nocancel
534−// Msgrcv_nocancel
535−// Sem_wait_nocancel
536−// Aio_suspend_nocancel
537−// __sigwait_nocancel
538−// __semwait_signal_nocancel
539−// __mac_mount
540−// __mac_get_mount
541−// __mac_getfsstat
vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.godeleted−57
@@ -1,57 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build amd64 && dragonfly
6−// +build amd64,dragonfly
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func setTimespec(sec, nsec int64) Timespec {
16− return Timespec{Sec: sec, Nsec: nsec}
17−}
18−
19−func setTimeval(sec, usec int64) Timeval {
20− return Timeval{Sec: sec, Usec: usec}
21−}
22−
23−func SetKevent(k *Kevent_t, fd, mode, flags int) {
24− k.Ident = uint64(fd)
25− k.Filter = int16(mode)
26− k.Flags = uint16(flags)
27−}
28−
29−func (iov *Iovec) SetLen(length int) {
30− iov.Len = uint64(length)
31−}
32−
33−func (msghdr *Msghdr) SetControllen(length int) {
34− msghdr.Controllen = uint32(length)
35−}
36−
37−func (msghdr *Msghdr) SetIovlen(length int) {
38− msghdr.Iovlen = int32(length)
39−}
40−
41−func (cmsg *Cmsghdr) SetLen(length int) {
42− cmsg.Len = uint32(length)
43−}
44−
45−func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
46− var writtenOut uint64 = 0
47− _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
48−
49− written = int(writtenOut)
50−
51− if e1 != 0 {
52− err = e1
53− }
54− return
55−}
56−
57−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
vendor/golang.org/x/sys/unix/syscall_freebsd.godeleted−872
@@ -1,872 +0,0 @@
1−// Copyright 2009,2010 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// FreeBSD system calls.
6−// This file is compiled as ordinary Go code,
7−// but it is also input to mksyscall,
8−// which parses the //sys lines and generates system call stubs.
9−// Note that sometimes we use a lowercase //sys name and wrap
10−// it in our own nicer implementation, either here or in
11−// syscall_bsd.go or syscall_unix.go.
12−
13−package unix
14−
15−import (
16− "sync"
17− "unsafe"
18−)
19−
20−const (
21− SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); }
22− SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \
23− SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \
24− SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \
25− SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \
26− SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \
27− SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \
28−)
29−
30−// See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html.
31−var (
32− osreldateOnce sync.Once
33− osreldate uint32
34−)
35−
36−// INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h
37−const _ino64First = 1200031
38−
39−func supportsABI(ver uint32) bool {
40− osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
41− return osreldate >= ver
42−}
43−
44−// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
45−type SockaddrDatalink struct {
46− Len uint8
47− Family uint8
48− Index uint16
49− Type uint8
50− Nlen uint8
51− Alen uint8
52− Slen uint8
53− Data [46]int8
54− raw RawSockaddrDatalink
55−}
56−
57−func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
58− return nil, EAFNOSUPPORT
59−}
60−
61−// Translate "kern.hostname" to []_C_int{0,1,2,3}.
62−func nametomib(name string) (mib []_C_int, err error) {
63− const siz = unsafe.Sizeof(mib[0])
64−
65− // NOTE(rsc): It seems strange to set the buffer to have
66− // size CTL_MAXNAME+2 but use only CTL_MAXNAME
67− // as the size. I don't know why the +2 is here, but the
68− // kernel uses +2 for its own implementation of this function.
69− // I am scared that if we don't include the +2 here, the kernel
70− // will silently write 2 words farther than we specify
71− // and we'll get memory corruption.
72− var buf [CTL_MAXNAME + 2]_C_int
73− n := uintptr(CTL_MAXNAME) * siz
74−
75− p := (*byte)(unsafe.Pointer(&buf[0]))
76− bytes, err := ByteSliceFromString(name)
77− if err != nil {
78− return nil, err
79− }
80−
81− // Magic sysctl: "setting" 0.3 to a string name
82− // lets you read back the array of integers form.
83− if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil {
84− return nil, err
85− }
86− return buf[0 : n/siz], nil
87−}
88−
89−func direntIno(buf []byte) (uint64, bool) {
90− return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
91−}
92−
93−func direntReclen(buf []byte) (uint64, bool) {
94− return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
95−}
96−
97−func direntNamlen(buf []byte) (uint64, bool) {
98− return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
99−}
100−
101−func Pipe(p []int) (err error) {
102− return Pipe2(p, 0)
103−}
104−
105−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
106−
107−func Pipe2(p []int, flags int) error {
108− if len(p) != 2 {
109− return EINVAL
110− }
111− var pp [2]_C_int
112− err := pipe2(&pp, flags)
113− p[0] = int(pp[0])
114− p[1] = int(pp[1])
115− return err
116−}
117−
118−func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
119− var value IPMreqn
120− vallen := _Socklen(SizeofIPMreqn)
121− errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
122− return &value, errno
123−}
124−
125−func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
126− return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
127−}
128−
129−// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct.
130−// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
131−func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
132− x := new(Xucred)
133− vallen := _Socklen(SizeofXucred)
134− err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
135− return x, err
136−}
137−
138−func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
139− var rsa RawSockaddrAny
140− var len _Socklen = SizeofSockaddrAny
141− nfd, err = accept4(fd, &rsa, &len, flags)
142− if err != nil {
143− return
144− }
145− if len > SizeofSockaddrAny {
146− panic("RawSockaddrAny too small")
147− }
148− sa, err = anyToSockaddr(fd, &rsa)
149− if err != nil {
150− Close(nfd)
151− nfd = 0
152− }
153− return
154−}
155−
156−//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
157−
158−func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
159− var (
160− _p0 unsafe.Pointer
161− bufsize uintptr
162− oldBuf []statfs_freebsd11_t
163− needsConvert bool
164− )
165−
166− if len(buf) > 0 {
167− if supportsABI(_ino64First) {
168− _p0 = unsafe.Pointer(&buf[0])
169− bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
170− } else {
171− n := len(buf)
172− oldBuf = make([]statfs_freebsd11_t, n)
173− _p0 = unsafe.Pointer(&oldBuf[0])
174− bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n)
175− needsConvert = true
176− }
177− }
178− var sysno uintptr = SYS_GETFSSTAT
179− if supportsABI(_ino64First) {
180− sysno = SYS_GETFSSTAT_FREEBSD12
181− }
182− r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags))
183− n = int(r0)
184− if e1 != 0 {
185− err = e1
186− }
187− if e1 == 0 && needsConvert {
188− for i := range oldBuf {
189− buf[i].convertFrom(&oldBuf[i])
190− }
191− }
192− return
193−}
194−
195−func setattrlistTimes(path string, times []Timespec, flags int) error {
196− // used on Darwin for UtimesNano
197− return ENOSYS
198−}
199−
200−//sys ioctl(fd int, req uint, arg uintptr) (err error)
201−
202−//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
203−
204−func Uname(uname *Utsname) error {
205− mib := []_C_int{CTL_KERN, KERN_OSTYPE}
206− n := unsafe.Sizeof(uname.Sysname)
207− if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
208− return err
209− }
210−
211− mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
212− n = unsafe.Sizeof(uname.Nodename)
213− if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
214− return err
215− }
216−
217− mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
218− n = unsafe.Sizeof(uname.Release)
219− if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
220− return err
221− }
222−
223− mib = []_C_int{CTL_KERN, KERN_VERSION}
224− n = unsafe.Sizeof(uname.Version)
225− if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
226− return err
227− }
228−
229− // The version might have newlines or tabs in it, convert them to
230− // spaces.
231− for i, b := range uname.Version {
232− if b == '\n' || b == '\t' {
233− if i == len(uname.Version)-1 {
234− uname.Version[i] = 0
235− } else {
236− uname.Version[i] = ' '
237− }
238− }
239− }
240−
241− mib = []_C_int{CTL_HW, HW_MACHINE}
242− n = unsafe.Sizeof(uname.Machine)
243− if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
244− return err
245− }
246−
247− return nil
248−}
249−
250−func Stat(path string, st *Stat_t) (err error) {
251− var oldStat stat_freebsd11_t
252− if supportsABI(_ino64First) {
253− return fstatat_freebsd12(AT_FDCWD, path, st, 0)
254− }
255− err = stat(path, &oldStat)
256− if err != nil {
257− return err
258− }
259−
260− st.convertFrom(&oldStat)
261− return nil
262−}
263−
264−func Lstat(path string, st *Stat_t) (err error) {
265− var oldStat stat_freebsd11_t
266− if supportsABI(_ino64First) {
267− return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW)
268− }
269− err = lstat(path, &oldStat)
270− if err != nil {
271− return err
272− }
273−
274− st.convertFrom(&oldStat)
275− return nil
276−}
277−
278−func Fstat(fd int, st *Stat_t) (err error) {
279− var oldStat stat_freebsd11_t
280− if supportsABI(_ino64First) {
281− return fstat_freebsd12(fd, st)
282− }
283− err = fstat(fd, &oldStat)
284− if err != nil {
285− return err
286− }
287−
288− st.convertFrom(&oldStat)
289− return nil
290−}
291−
292−func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) {
293− var oldStat stat_freebsd11_t
294− if supportsABI(_ino64First) {
295− return fstatat_freebsd12(fd, path, st, flags)
296− }
297− err = fstatat(fd, path, &oldStat, flags)
298− if err != nil {
299− return err
300− }
301−
302− st.convertFrom(&oldStat)
303− return nil
304−}
305−
306−func Statfs(path string, st *Statfs_t) (err error) {
307− var oldStatfs statfs_freebsd11_t
308− if supportsABI(_ino64First) {
309− return statfs_freebsd12(path, st)
310− }
311− err = statfs(path, &oldStatfs)
312− if err != nil {
313− return err
314− }
315−
316− st.convertFrom(&oldStatfs)
317− return nil
318−}
319−
320−func Fstatfs(fd int, st *Statfs_t) (err error) {
321− var oldStatfs statfs_freebsd11_t
322− if supportsABI(_ino64First) {
323− return fstatfs_freebsd12(fd, st)
324− }
325− err = fstatfs(fd, &oldStatfs)
326− if err != nil {
327− return err
328− }
329−
330− st.convertFrom(&oldStatfs)
331− return nil
332−}
333−
334−func Getdents(fd int, buf []byte) (n int, err error) {
335− return Getdirentries(fd, buf, nil)
336−}
337−
338−func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
339− if supportsABI(_ino64First) {
340− if basep == nil || unsafe.Sizeof(*basep) == 8 {
341− return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep)))
342− }
343− // The freebsd12 syscall needs a 64-bit base. On 32-bit machines
344− // we can't just use the basep passed in. See #32498.
345− var base uint64 = uint64(*basep)
346− n, err = getdirentries_freebsd12(fd, buf, &base)
347− *basep = uintptr(base)
348− if base>>32 != 0 {
349− // We can't stuff the base back into a uintptr, so any
350− // future calls would be suspect. Generate an error.
351− // EIO is allowed by getdirentries.
352− err = EIO
353− }
354− return
355− }
356−
357− // The old syscall entries are smaller than the new. Use 1/4 of the original
358− // buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c).
359− oldBufLen := roundup(len(buf)/4, _dirblksiz)
360− oldBuf := make([]byte, oldBufLen)
361− n, err = getdirentries(fd, oldBuf, basep)
362− if err == nil && n > 0 {
363− n = convertFromDirents11(buf, oldBuf[:n])
364− }
365− return
366−}
367−
368−func Mknod(path string, mode uint32, dev uint64) (err error) {
369− var oldDev int
370− if supportsABI(_ino64First) {
371− return mknodat_freebsd12(AT_FDCWD, path, mode, dev)
372− }
373− oldDev = int(dev)
374− return mknod(path, mode, oldDev)
375−}
376−
377−func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) {
378− var oldDev int
379− if supportsABI(_ino64First) {
380− return mknodat_freebsd12(fd, path, mode, dev)
381− }
382− oldDev = int(dev)
383− return mknodat(fd, path, mode, oldDev)
384−}
385−
386−// round x to the nearest multiple of y, larger or equal to x.
387−//
388−// from /usr/include/sys/param.h Macros for counting and rounding.
389−// #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
390−func roundup(x, y int) int {
391− return ((x + y - 1) / y) * y
392−}
393−
394−func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
395− *s = Stat_t{
396− Dev: uint64(old.Dev),
397− Ino: uint64(old.Ino),
398− Nlink: uint64(old.Nlink),
399− Mode: old.Mode,
400− Uid: old.Uid,
401− Gid: old.Gid,
402− Rdev: uint64(old.Rdev),
403− Atim: old.Atim,
404− Mtim: old.Mtim,
405− Ctim: old.Ctim,
406− Btim: old.Btim,
407− Size: old.Size,
408− Blocks: old.Blocks,
409− Blksize: old.Blksize,
410− Flags: old.Flags,
411− Gen: uint64(old.Gen),
412− }
413−}
414−
415−func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) {
416− *s = Statfs_t{
417− Version: _statfsVersion,
418− Type: old.Type,
419− Flags: old.Flags,
420− Bsize: old.Bsize,
421− Iosize: old.Iosize,
422− Blocks: old.Blocks,
423− Bfree: old.Bfree,
424− Bavail: old.Bavail,
425− Files: old.Files,
426− Ffree: old.Ffree,
427− Syncwrites: old.Syncwrites,
428− Asyncwrites: old.Asyncwrites,
429− Syncreads: old.Syncreads,
430− Asyncreads: old.Asyncreads,
431− // Spare
432− Namemax: old.Namemax,
433− Owner: old.Owner,
434− Fsid: old.Fsid,
435− // Charspare
436− // Fstypename
437− // Mntfromname
438− // Mntonname
439− }
440−
441− sl := old.Fstypename[:]
442− n := clen(*(*[]byte)(unsafe.Pointer(&sl)))
443− copy(s.Fstypename[:], old.Fstypename[:n])
444−
445− sl = old.Mntfromname[:]
446− n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
447− copy(s.Mntfromname[:], old.Mntfromname[:n])
448−
449− sl = old.Mntonname[:]
450− n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
451− copy(s.Mntonname[:], old.Mntonname[:n])
452−}
453−
454−func convertFromDirents11(buf []byte, old []byte) int {
455− const (
456− fixedSize = int(unsafe.Offsetof(Dirent{}.Name))
457− oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name))
458− )
459−
460− dstPos := 0
461− srcPos := 0
462− for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) {
463− var dstDirent Dirent
464− var srcDirent dirent_freebsd11
465−
466− // If multiple direntries are written, sometimes when we reach the final one,
467− // we may have cap of old less than size of dirent_freebsd11.
468− copy((*[unsafe.Sizeof(srcDirent)]byte)(unsafe.Pointer(&srcDirent))[:], old[srcPos:])
469−
470− reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8)
471− if dstPos+reclen > len(buf) {
472− break
473− }
474−
475− dstDirent.Fileno = uint64(srcDirent.Fileno)
476− dstDirent.Off = 0
477− dstDirent.Reclen = uint16(reclen)
478− dstDirent.Type = srcDirent.Type
479− dstDirent.Pad0 = 0
480− dstDirent.Namlen = uint16(srcDirent.Namlen)
481− dstDirent.Pad1 = 0
482−
483− copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen])
484− copy(buf[dstPos:], (*[unsafe.Sizeof(dstDirent)]byte)(unsafe.Pointer(&dstDirent))[:])
485− padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen]
486− for i := range padding {
487− padding[i] = 0
488− }
489−
490− dstPos += int(dstDirent.Reclen)
491− srcPos += int(srcDirent.Reclen)
492− }
493−
494− return dstPos
495−}
496−
497−func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
498− if raceenabled {
499− raceReleaseMerge(unsafe.Pointer(&ioSync))
500− }
501− return sendfile(outfd, infd, offset, count)
502−}
503−
504−//sys ptrace(request int, pid int, addr uintptr, data int) (err error)
505−
506−func PtraceAttach(pid int) (err error) {
507− return ptrace(PTRACE_ATTACH, pid, 0, 0)
508−}
509−
510−func PtraceCont(pid int, signal int) (err error) {
511− return ptrace(PTRACE_CONT, pid, 1, signal)
512−}
513−
514−func PtraceDetach(pid int) (err error) {
515− return ptrace(PTRACE_DETACH, pid, 1, 0)
516−}
517−
518−func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
519− return ptrace(PTRACE_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0)
520−}
521−
522−func PtraceGetRegs(pid int, regsout *Reg) (err error) {
523− return ptrace(PTRACE_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0)
524−}
525−
526−func PtraceLwpEvents(pid int, enable int) (err error) {
527− return ptrace(PTRACE_LWPEVENTS, pid, 0, enable)
528−}
529−
530−func PtraceLwpInfo(pid int, info uintptr) (err error) {
531− return ptrace(PTRACE_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{})))
532−}
533−
534−func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
535− return PtraceIO(PIOD_READ_D, pid, addr, out, SizeofLong)
536−}
537−
538−func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) {
539− return PtraceIO(PIOD_READ_I, pid, addr, out, SizeofLong)
540−}
541−
542−func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) {
543− return PtraceIO(PIOD_WRITE_D, pid, addr, data, SizeofLong)
544−}
545−
546−func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) {
547− return PtraceIO(PIOD_WRITE_I, pid, addr, data, SizeofLong)
548−}
549−
550−func PtraceSetRegs(pid int, regs *Reg) (err error) {
551− return ptrace(PTRACE_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0)
552−}
553−
554−func PtraceSingleStep(pid int) (err error) {
555− return ptrace(PTRACE_SINGLESTEP, pid, 1, 0)
556−}
557−
558−/*
559− * Exposed directly
560− */
561−//sys Access(path string, mode uint32) (err error)
562−//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
563−//sys CapEnter() (err error)
564−//sys capRightsGet(version int, fd int, rightsp *CapRights) (err error) = SYS___CAP_RIGHTS_GET
565−//sys capRightsLimit(fd int, rightsp *CapRights) (err error)
566−//sys Chdir(path string) (err error)
567−//sys Chflags(path string, flags int) (err error)
568−//sys Chmod(path string, mode uint32) (err error)
569−//sys Chown(path string, uid int, gid int) (err error)
570−//sys Chroot(path string) (err error)
571−//sys Close(fd int) (err error)
572−//sys Dup(fd int) (nfd int, err error)
573−//sys Dup2(from int, to int) (err error)
574−//sys Exit(code int)
575−//sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
576−//sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
577−//sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error)
578−//sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
579−//sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
580−//sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
581−//sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error)
582−//sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
583−//sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
584−//sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
585−//sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error)
586−//sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
587−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE
588−//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
589−//sys Fchdir(fd int) (err error)
590−//sys Fchflags(fd int, flags int) (err error)
591−//sys Fchmod(fd int, mode uint32) (err error)
592−//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
593−//sys Fchown(fd int, uid int, gid int) (err error)
594−//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
595−//sys Flock(fd int, how int) (err error)
596−//sys Fpathconf(fd int, name int) (val int, err error)
597−//sys fstat(fd int, stat *stat_freebsd11_t) (err error)
598−//sys fstat_freebsd12(fd int, stat *Stat_t) (err error)
599−//sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error)
600−//sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error)
601−//sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error)
602−//sys fstatfs_freebsd12(fd int, stat *Statfs_t) (err error)
603−//sys Fsync(fd int) (err error)
604−//sys Ftruncate(fd int, length int64) (err error)
605−//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
606−//sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error)
607−//sys Getdtablesize() (size int)
608−//sysnb Getegid() (egid int)
609−//sysnb Geteuid() (uid int)
610−//sysnb Getgid() (gid int)
611−//sysnb Getpgid(pid int) (pgid int, err error)
612−//sysnb Getpgrp() (pgrp int)
613−//sysnb Getpid() (pid int)
614−//sysnb Getppid() (ppid int)
615−//sys Getpriority(which int, who int) (prio int, err error)
616−//sysnb Getrlimit(which int, lim *Rlimit) (err error)
617−//sysnb Getrusage(who int, rusage *Rusage) (err error)
618−//sysnb Getsid(pid int) (sid int, err error)
619−//sysnb Gettimeofday(tv *Timeval) (err error)
620−//sysnb Getuid() (uid int)
621−//sys Issetugid() (tainted bool)
622−//sys Kill(pid int, signum syscall.Signal) (err error)
623−//sys Kqueue() (fd int, err error)
624−//sys Lchown(path string, uid int, gid int) (err error)
625−//sys Link(path string, link string) (err error)
626−//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
627−//sys Listen(s int, backlog int) (err error)
628−//sys lstat(path string, stat *stat_freebsd11_t) (err error)
629−//sys Mkdir(path string, mode uint32) (err error)
630−//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
631−//sys Mkfifo(path string, mode uint32) (err error)
632−//sys mknod(path string, mode uint32, dev int) (err error)
633−//sys mknodat(fd int, path string, mode uint32, dev int) (err error)
634−//sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error)
635−//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
636−//sys Open(path string, mode int, perm uint32) (fd int, err error)
637−//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
638−//sys Pathconf(path string, name int) (val int, err error)
639−//sys Pread(fd int, p []byte, offset int64) (n int, err error)
640−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
641−//sys read(fd int, p []byte) (n int, err error)
642−//sys Readlink(path string, buf []byte) (n int, err error)
643−//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
644−//sys Rename(from string, to string) (err error)
645−//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
646−//sys Revoke(path string) (err error)
647−//sys Rmdir(path string) (err error)
648−//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
649−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
650−//sysnb Setegid(egid int) (err error)
651−//sysnb Seteuid(euid int) (err error)
652−//sysnb Setgid(gid int) (err error)
653−//sys Setlogin(name string) (err error)
654−//sysnb Setpgid(pid int, pgid int) (err error)
655−//sys Setpriority(which int, who int, prio int) (err error)
656−//sysnb Setregid(rgid int, egid int) (err error)
657−//sysnb Setreuid(ruid int, euid int) (err error)
658−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
659−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
660−//sysnb Setrlimit(which int, lim *Rlimit) (err error)
661−//sysnb Setsid() (pid int, err error)
662−//sysnb Settimeofday(tp *Timeval) (err error)
663−//sysnb Setuid(uid int) (err error)
664−//sys stat(path string, stat *stat_freebsd11_t) (err error)
665−//sys statfs(path string, stat *statfs_freebsd11_t) (err error)
666−//sys statfs_freebsd12(path string, stat *Statfs_t) (err error)
667−//sys Symlink(path string, link string) (err error)
668−//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
669−//sys Sync() (err error)
670−//sys Truncate(path string, length int64) (err error)
671−//sys Umask(newmask int) (oldmask int)
672−//sys Undelete(path string) (err error)
673−//sys Unlink(path string) (err error)
674−//sys Unlinkat(dirfd int, path string, flags int) (err error)
675−//sys Unmount(path string, flags int) (err error)
676−//sys write(fd int, p []byte) (n int, err error)
677−//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
678−//sys munmap(addr uintptr, length uintptr) (err error)
679−//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
680−//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
681−//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
682−//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
683−
684−/*
685− * Unimplemented
686− */
687−// Profil
688−// Sigaction
689−// Sigprocmask
690−// Getlogin
691−// Sigpending
692−// Sigaltstack
693−// Ioctl
694−// Reboot
695−// Execve
696−// Vfork
697−// Sbrk
698−// Sstk
699−// Ovadvise
700−// Mincore
701−// Setitimer
702−// Swapon
703−// Select
704−// Sigsuspend
705−// Readv
706−// Writev
707−// Nfssvc
708−// Getfh
709−// Quotactl
710−// Mount
711−// Csops
712−// Waitid
713−// Add_profil
714−// Kdebug_trace
715−// Sigreturn
716−// Atsocket
717−// Kqueue_from_portset_np
718−// Kqueue_portset
719−// Getattrlist
720−// Setattrlist
721−// Getdents
722−// Getdirentriesattr
723−// Searchfs
724−// Delete
725−// Copyfile
726−// Watchevent
727−// Waitevent
728−// Modwatch
729−// Fsctl
730−// Initgroups
731−// Posix_spawn
732−// Nfsclnt
733−// Fhopen
734−// Minherit
735−// Semsys
736−// Msgsys
737−// Shmsys
738−// Semctl
739−// Semget
740−// Semop
741−// Msgctl
742−// Msgget
743−// Msgsnd
744−// Msgrcv
745−// Shmat
746−// Shmctl
747−// Shmdt
748−// Shmget
749−// Shm_open
750−// Shm_unlink
751−// Sem_open
752−// Sem_close
753−// Sem_unlink
754−// Sem_wait
755−// Sem_trywait
756−// Sem_post
757−// Sem_getvalue
758−// Sem_init
759−// Sem_destroy
760−// Open_extended
761−// Umask_extended
762−// Stat_extended
763−// Lstat_extended
764−// Fstat_extended
765−// Chmod_extended
766−// Fchmod_extended
767−// Access_extended
768−// Settid
769−// Gettid
770−// Setsgroups
771−// Getsgroups
772−// Setwgroups
773−// Getwgroups
774−// Mkfifo_extended
775−// Mkdir_extended
776−// Identitysvc
777−// Shared_region_check_np
778−// Shared_region_map_np
779−// __pthread_mutex_destroy
780−// __pthread_mutex_init
781−// __pthread_mutex_lock
782−// __pthread_mutex_trylock
783−// __pthread_mutex_unlock
784−// __pthread_cond_init
785−// __pthread_cond_destroy
786−// __pthread_cond_broadcast
787−// __pthread_cond_signal
788−// Setsid_with_pid
789−// __pthread_cond_timedwait
790−// Aio_fsync
791−// Aio_return
792−// Aio_suspend
793−// Aio_cancel
794−// Aio_error
795−// Aio_read
796−// Aio_write
797−// Lio_listio
798−// __pthread_cond_wait
799−// Iopolicysys
800−// __pthread_kill
801−// __pthread_sigmask
802−// __sigwait
803−// __disable_threadsignal
804−// __pthread_markcancel
805−// __pthread_canceled
806−// __semwait_signal
807−// Proc_info
808−// Stat64_extended
809−// Lstat64_extended
810−// Fstat64_extended
811−// __pthread_chdir
812−// __pthread_fchdir
813−// Audit
814−// Auditon
815−// Getauid
816−// Setauid
817−// Getaudit
818−// Setaudit
819−// Getaudit_addr
820−// Setaudit_addr
821−// Auditctl
822−// Bsdthread_create
823−// Bsdthread_terminate
824−// Stack_snapshot
825−// Bsdthread_register
826−// Workq_open
827−// Workq_ops
828−// __mac_execve
829−// __mac_syscall
830−// __mac_get_file
831−// __mac_set_file
832−// __mac_get_link
833−// __mac_set_link
834−// __mac_get_proc
835−// __mac_set_proc
836−// __mac_get_fd
837−// __mac_set_fd
838−// __mac_get_pid
839−// __mac_get_lcid
840−// __mac_get_lctx
841−// __mac_set_lctx
842−// Setlcid
843−// Read_nocancel
844−// Write_nocancel
845−// Open_nocancel
846−// Close_nocancel
847−// Wait4_nocancel
848−// Recvmsg_nocancel
849−// Sendmsg_nocancel
850−// Recvfrom_nocancel
851−// Accept_nocancel
852−// Fcntl_nocancel
853−// Select_nocancel
854−// Fsync_nocancel
855−// Connect_nocancel
856−// Sigsuspend_nocancel
857−// Readv_nocancel
858−// Writev_nocancel
859−// Sendto_nocancel
860−// Pread_nocancel
861−// Pwrite_nocancel
862−// Waitid_nocancel
863−// Poll_nocancel
864−// Msgsnd_nocancel
865−// Msgrcv_nocancel
866−// Sem_wait_nocancel
867−// Aio_suspend_nocancel
868−// __sigwait_nocancel
869−// __semwait_signal_nocancel
870−// __mac_mount
871−// __mac_get_mount
872−// __mac_getfsstat
vendor/golang.org/x/sys/unix/syscall_freebsd_386.godeleted−67
@@ -1,67 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build 386 && freebsd
6−// +build 386,freebsd
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func setTimespec(sec, nsec int64) Timespec {
16− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
17−}
18−
19−func setTimeval(sec, usec int64) Timeval {
20− return Timeval{Sec: int32(sec), Usec: int32(usec)}
21−}
22−
23−func SetKevent(k *Kevent_t, fd, mode, flags int) {
24− k.Ident = uint32(fd)
25− k.Filter = int16(mode)
26− k.Flags = uint16(flags)
27−}
28−
29−func (iov *Iovec) SetLen(length int) {
30− iov.Len = uint32(length)
31−}
32−
33−func (msghdr *Msghdr) SetControllen(length int) {
34− msghdr.Controllen = uint32(length)
35−}
36−
37−func (msghdr *Msghdr) SetIovlen(length int) {
38− msghdr.Iovlen = int32(length)
39−}
40−
41−func (cmsg *Cmsghdr) SetLen(length int) {
42− cmsg.Len = uint32(length)
43−}
44−
45−func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
46− var writtenOut uint64 = 0
47− _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
48−
49− written = int(writtenOut)
50−
51− if e1 != 0 {
52− err = e1
53− }
54− return
55−}
56−
57−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
58−
59−func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
60− return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
61−}
62−
63−func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
64− ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)}
65− err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
66− return int(ioDesc.Len), err
67−}
vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.godeleted−67
@@ -1,67 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build amd64 && freebsd
6−// +build amd64,freebsd
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func setTimespec(sec, nsec int64) Timespec {
16− return Timespec{Sec: sec, Nsec: nsec}
17−}
18−
19−func setTimeval(sec, usec int64) Timeval {
20− return Timeval{Sec: sec, Usec: usec}
21−}
22−
23−func SetKevent(k *Kevent_t, fd, mode, flags int) {
24− k.Ident = uint64(fd)
25− k.Filter = int16(mode)
26− k.Flags = uint16(flags)
27−}
28−
29−func (iov *Iovec) SetLen(length int) {
30− iov.Len = uint64(length)
31−}
32−
33−func (msghdr *Msghdr) SetControllen(length int) {
34− msghdr.Controllen = uint32(length)
35−}
36−
37−func (msghdr *Msghdr) SetIovlen(length int) {
38− msghdr.Iovlen = int32(length)
39−}
40−
41−func (cmsg *Cmsghdr) SetLen(length int) {
42− cmsg.Len = uint32(length)
43−}
44−
45−func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
46− var writtenOut uint64 = 0
47− _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
48−
49− written = int(writtenOut)
50−
51− if e1 != 0 {
52− err = e1
53− }
54− return
55−}
56−
57−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
58−
59−func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
60− return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
61−}
62−
63−func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
64− ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)}
65− err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
66− return int(ioDesc.Len), err
67−}
vendor/golang.org/x/sys/unix/syscall_freebsd_arm.godeleted−63
@@ -1,63 +0,0 @@
1−// Copyright 2012 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build arm && freebsd
6−// +build arm,freebsd
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func setTimespec(sec, nsec int64) Timespec {
16− return Timespec{Sec: sec, Nsec: int32(nsec)}
17−}
18−
19−func setTimeval(sec, usec int64) Timeval {
20− return Timeval{Sec: sec, Usec: int32(usec)}
21−}
22−
23−func SetKevent(k *Kevent_t, fd, mode, flags int) {
24− k.Ident = uint32(fd)
25− k.Filter = int16(mode)
26− k.Flags = uint16(flags)
27−}
28−
29−func (iov *Iovec) SetLen(length int) {
30− iov.Len = uint32(length)
31−}
32−
33−func (msghdr *Msghdr) SetControllen(length int) {
34− msghdr.Controllen = uint32(length)
35−}
36−
37−func (msghdr *Msghdr) SetIovlen(length int) {
38− msghdr.Iovlen = int32(length)
39−}
40−
41−func (cmsg *Cmsghdr) SetLen(length int) {
42− cmsg.Len = uint32(length)
43−}
44−
45−func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
46− var writtenOut uint64 = 0
47− _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
48−
49− written = int(writtenOut)
50−
51− if e1 != 0 {
52− err = e1
53− }
54− return
55−}
56−
57−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
58−
59−func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
60− ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)}
61− err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
62− return int(ioDesc.Len), err
63−}
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.godeleted−63
@@ -1,63 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build arm64 && freebsd
6−// +build arm64,freebsd
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func setTimespec(sec, nsec int64) Timespec {
16− return Timespec{Sec: sec, Nsec: nsec}
17−}
18−
19−func setTimeval(sec, usec int64) Timeval {
20− return Timeval{Sec: sec, Usec: usec}
21−}
22−
23−func SetKevent(k *Kevent_t, fd, mode, flags int) {
24− k.Ident = uint64(fd)
25− k.Filter = int16(mode)
26− k.Flags = uint16(flags)
27−}
28−
29−func (iov *Iovec) SetLen(length int) {
30− iov.Len = uint64(length)
31−}
32−
33−func (msghdr *Msghdr) SetControllen(length int) {
34− msghdr.Controllen = uint32(length)
35−}
36−
37−func (msghdr *Msghdr) SetIovlen(length int) {
38− msghdr.Iovlen = int32(length)
39−}
40−
41−func (cmsg *Cmsghdr) SetLen(length int) {
42− cmsg.Len = uint32(length)
43−}
44−
45−func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
46− var writtenOut uint64 = 0
47− _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
48−
49− written = int(writtenOut)
50−
51− if e1 != 0 {
52− err = e1
53− }
54− return
55−}
56−
57−func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
58−
59−func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
60− ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)}
61− err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
62− return int(ioDesc.Len), err
63−}
vendor/golang.org/x/sys/unix/syscall_illumos.godeleted−129
@@ -1,129 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// illumos system calls not present on Solaris.
6−
7−//go:build amd64 && illumos
8−// +build amd64,illumos
9−
10−package unix
11−
12−import (
13− "unsafe"
14−)
15−
16−func bytes2iovec(bs [][]byte) []Iovec {
17− iovecs := make([]Iovec, len(bs))
18− for i, b := range bs {
19− iovecs[i].SetLen(len(b))
20− if len(b) > 0 {
21− // somehow Iovec.Base on illumos is (*int8), not (*byte)
22− iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0]))
23− } else {
24− iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero))
25− }
26− }
27− return iovecs
28−}
29−
30−//sys readv(fd int, iovs []Iovec) (n int, err error)
31−
32−func Readv(fd int, iovs [][]byte) (n int, err error) {
33− iovecs := bytes2iovec(iovs)
34− n, err = readv(fd, iovecs)
35− return n, err
36−}
37−
38−//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error)
39−
40−func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
41− iovecs := bytes2iovec(iovs)
42− n, err = preadv(fd, iovecs, off)
43− return n, err
44−}
45−
46−//sys writev(fd int, iovs []Iovec) (n int, err error)
47−
48−func Writev(fd int, iovs [][]byte) (n int, err error) {
49− iovecs := bytes2iovec(iovs)
50− n, err = writev(fd, iovecs)
51− return n, err
52−}
53−
54−//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
55−
56−func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) {
57− iovecs := bytes2iovec(iovs)
58− n, err = pwritev(fd, iovecs, off)
59− return n, err
60−}
61−
62−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) = libsocket.accept4
63−
64−func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
65− var rsa RawSockaddrAny
66− var len _Socklen = SizeofSockaddrAny
67− nfd, err = accept4(fd, &rsa, &len, flags)
68− if err != nil {
69− return
70− }
71− if len > SizeofSockaddrAny {
72− panic("RawSockaddrAny too small")
73− }
74− sa, err = anyToSockaddr(fd, &rsa)
75− if err != nil {
76− Close(nfd)
77− nfd = 0
78− }
79− return
80−}
81−
82−//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error)
83−
84−func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) {
85− var clp, datap *strbuf
86− if len(cl) > 0 {
87− clp = &strbuf{
88− Len: int32(len(cl)),
89− Buf: (*int8)(unsafe.Pointer(&cl[0])),
90− }
91− }
92− if len(data) > 0 {
93− datap = &strbuf{
94− Len: int32(len(data)),
95− Buf: (*int8)(unsafe.Pointer(&data[0])),
96− }
97− }
98− return putmsg(fd, clp, datap, flags)
99−}
100−
101−//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error)
102−
103−func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) {
104− var clp, datap *strbuf
105− if len(cl) > 0 {
106− clp = &strbuf{
107− Maxlen: int32(len(cl)),
108− Buf: (*int8)(unsafe.Pointer(&cl[0])),
109− }
110− }
111− if len(data) > 0 {
112− datap = &strbuf{
113− Maxlen: int32(len(data)),
114− Buf: (*int8)(unsafe.Pointer(&data[0])),
115− }
116− }
117−
118− if err = getmsg(fd, clp, datap, &flags); err != nil {
119− return nil, nil, 0, err
120− }
121−
122− if len(cl) > 0 {
123− retCl = cl[:clp.Len]
124− }
125− if len(data) > 0 {
126− retData = data[:datap.Len]
127− }
128− return retCl, retData, flags, nil
129−}
vendor/golang.org/x/sys/unix/syscall_linux.godeleted−2510
@@ -1,2510 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−// Linux system calls.
6−// This file is compiled as ordinary Go code,
7−// but it is also input to mksyscall,
8−// which parses the //sys lines and generates system call stubs.
9−// Note that sometimes we use a lowercase //sys name and
10−// wrap it in our own nicer implementation.
11−
12−package unix
13−
14−import (
15− "encoding/binary"
16− "runtime"
17− "syscall"
18− "unsafe"
19−)
20−
21−/*
22− * Wrapped
23− */
24−
25−func Access(path string, mode uint32) (err error) {
26− return Faccessat(AT_FDCWD, path, mode, 0)
27−}
28−
29−func Chmod(path string, mode uint32) (err error) {
30− return Fchmodat(AT_FDCWD, path, mode, 0)
31−}
32−
33−func Chown(path string, uid int, gid int) (err error) {
34− return Fchownat(AT_FDCWD, path, uid, gid, 0)
35−}
36−
37−func Creat(path string, mode uint32) (fd int, err error) {
38− return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
39−}
40−
41−//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error)
42−//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error)
43−
44−func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (err error) {
45− if pathname == "" {
46− return fanotifyMark(fd, flags, mask, dirFd, nil)
47− }
48− p, err := BytePtrFromString(pathname)
49− if err != nil {
50− return err
51− }
52− return fanotifyMark(fd, flags, mask, dirFd, p)
53−}
54−
55−//sys fchmodat(dirfd int, path string, mode uint32) (err error)
56−
57−func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
58− // Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior
59− // and check the flags. Otherwise the mode would be applied to the symlink
60− // destination which is not what the user expects.
61− if flags&^AT_SYMLINK_NOFOLLOW != 0 {
62− return EINVAL
63− } else if flags&AT_SYMLINK_NOFOLLOW != 0 {
64− return EOPNOTSUPP
65− }
66− return fchmodat(dirfd, path, mode)
67−}
68−
69−//sys ioctl(fd int, req uint, arg uintptr) (err error)
70−
71−// ioctl itself should not be exposed directly, but additional get/set
72−// functions for specific types are permissible.
73−
74−// IoctlRetInt performs an ioctl operation specified by req on a device
75−// associated with opened file descriptor fd, and returns a non-negative
76−// integer that is returned by the ioctl syscall.
77−func IoctlRetInt(fd int, req uint) (int, error) {
78− ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
79− if err != 0 {
80− return 0, err
81− }
82− return int(ret), nil
83−}
84−
85−func IoctlSetRTCTime(fd int, value *RTCTime) error {
86− err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
87− runtime.KeepAlive(value)
88− return err
89−}
90−
91−func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error {
92− err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value)))
93− runtime.KeepAlive(value)
94− return err
95−}
96−
97−func IoctlGetUint32(fd int, req uint) (uint32, error) {
98− var value uint32
99− err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
100− return value, err
101−}
102−
103−func IoctlGetRTCTime(fd int) (*RTCTime, error) {
104− var value RTCTime
105− err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value)))
106− return &value, err
107−}
108−
109−type ifreqEthtool struct {
110− name [IFNAMSIZ]byte
111− data unsafe.Pointer
112−}
113−
114−// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network
115−// device specified by ifname.
116−func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
117− // Leave room for terminating NULL byte.
118− if len(ifname) >= IFNAMSIZ {
119− return nil, EINVAL
120− }
121−
122− value := EthtoolDrvinfo{
123− Cmd: ETHTOOL_GDRVINFO,
124− }
125− ifreq := ifreqEthtool{
126− data: unsafe.Pointer(&value),
127− }
128− copy(ifreq.name[:], ifname)
129− err := ioctl(fd, SIOCETHTOOL, uintptr(unsafe.Pointer(&ifreq)))
130− runtime.KeepAlive(ifreq)
131− return &value, err
132−}
133−
134−// IoctlGetWatchdogInfo fetches information about a watchdog device from the
135−// Linux watchdog API. For more information, see:
136−// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
137−func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
138− var value WatchdogInfo
139− err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value)))
140− return &value, err
141−}
142−
143−func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
144− var value RTCWkAlrm
145− err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value)))
146− return &value, err
147−}
148−
149−// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
150−// range of data conveyed in value to the file associated with the file
151−// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
152−func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
153− err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value)))
154− runtime.KeepAlive(value)
155− return err
156−}
157−
158−// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
159−// associated with the file description srcFd to the file associated with the
160−// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
161−func IoctlFileClone(destFd, srcFd int) error {
162− return ioctl(destFd, FICLONE, uintptr(srcFd))
163−}
164−
165−type FileDedupeRange struct {
166− Src_offset uint64
167− Src_length uint64
168− Reserved1 uint16
169− Reserved2 uint32
170− Info []FileDedupeRangeInfo
171−}
172−
173−type FileDedupeRangeInfo struct {
174− Dest_fd int64
175− Dest_offset uint64
176− Bytes_deduped uint64
177− Status int32
178− Reserved uint32
179−}
180−
181−// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
182−// range of data conveyed in value from the file associated with the file
183−// descriptor srcFd to the value.Info destinations. See the
184−// ioctl_fideduperange(2) man page for details.
185−func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {
186− buf := make([]byte, SizeofRawFileDedupeRange+
187− len(value.Info)*SizeofRawFileDedupeRangeInfo)
188− rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0]))
189− rawrange.Src_offset = value.Src_offset
190− rawrange.Src_length = value.Src_length
191− rawrange.Dest_count = uint16(len(value.Info))
192− rawrange.Reserved1 = value.Reserved1
193− rawrange.Reserved2 = value.Reserved2
194−
195− for i := range value.Info {
196− rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
197− uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
198− uintptr(i*SizeofRawFileDedupeRangeInfo)))
199− rawinfo.Dest_fd = value.Info[i].Dest_fd
200− rawinfo.Dest_offset = value.Info[i].Dest_offset
201− rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped
202− rawinfo.Status = value.Info[i].Status
203− rawinfo.Reserved = value.Info[i].Reserved
204− }
205−
206− err := ioctl(srcFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(&buf[0])))
207−
208− // Output
209− for i := range value.Info {
210− rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
211− uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
212− uintptr(i*SizeofRawFileDedupeRangeInfo)))
213− value.Info[i].Dest_fd = rawinfo.Dest_fd
214− value.Info[i].Dest_offset = rawinfo.Dest_offset
215− value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped
216− value.Info[i].Status = rawinfo.Status
217− value.Info[i].Reserved = rawinfo.Reserved
218− }
219−
220− return err
221−}
222−
223−// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
224−// more information, see:
225−// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
226−func IoctlWatchdogKeepalive(fd int) error {
227− return ioctl(fd, WDIOC_KEEPALIVE, 0)
228−}
229−
230−func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error {
231− err := ioctl(fd, HIDIOCGRDESC, uintptr(unsafe.Pointer(value)))
232− runtime.KeepAlive(value)
233− return err
234−}
235−
236−func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {
237− var value HIDRawDevInfo
238− err := ioctl(fd, HIDIOCGRAWINFO, uintptr(unsafe.Pointer(&value)))
239− return &value, err
240−}
241−
242−func IoctlHIDGetRawName(fd int) (string, error) {
243− var value [_HIDIOCGRAWNAME_LEN]byte
244− err := ioctl(fd, _HIDIOCGRAWNAME, uintptr(unsafe.Pointer(&value[0])))
245− return ByteSliceToString(value[:]), err
246−}
247−
248−func IoctlHIDGetRawPhys(fd int) (string, error) {
249− var value [_HIDIOCGRAWPHYS_LEN]byte
250− err := ioctl(fd, _HIDIOCGRAWPHYS, uintptr(unsafe.Pointer(&value[0])))
251− return ByteSliceToString(value[:]), err
252−}
253−
254−func IoctlHIDGetRawUniq(fd int) (string, error) {
255− var value [_HIDIOCGRAWUNIQ_LEN]byte
256− err := ioctl(fd, _HIDIOCGRAWUNIQ, uintptr(unsafe.Pointer(&value[0])))
257− return ByteSliceToString(value[:]), err
258−}
259−
260−//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
261−
262−func Link(oldpath string, newpath string) (err error) {
263− return Linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0)
264−}
265−
266−func Mkdir(path string, mode uint32) (err error) {
267− return Mkdirat(AT_FDCWD, path, mode)
268−}
269−
270−func Mknod(path string, mode uint32, dev int) (err error) {
271− return Mknodat(AT_FDCWD, path, mode, dev)
272−}
273−
274−func Open(path string, mode int, perm uint32) (fd int, err error) {
275− return openat(AT_FDCWD, path, mode|O_LARGEFILE, perm)
276−}
277−
278−//sys openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
279−
280−func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) {
281− return openat(dirfd, path, flags|O_LARGEFILE, mode)
282−}
283−
284−//sys openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error)
285−
286−func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) {
287− return openat2(dirfd, path, how, SizeofOpenHow)
288−}
289−
290−//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
291−
292−func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
293− if len(fds) == 0 {
294− return ppoll(nil, 0, timeout, sigmask)
295− }
296− return ppoll(&fds[0], len(fds), timeout, sigmask)
297−}
298−
299−//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
300−
301−func Readlink(path string, buf []byte) (n int, err error) {
302− return Readlinkat(AT_FDCWD, path, buf)
303−}
304−
305−func Rename(oldpath string, newpath string) (err error) {
306− return Renameat(AT_FDCWD, oldpath, AT_FDCWD, newpath)
307−}
308−
309−func Rmdir(path string) error {
310− return Unlinkat(AT_FDCWD, path, AT_REMOVEDIR)
311−}
312−
313−//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
314−
315−func Symlink(oldpath string, newpath string) (err error) {
316− return Symlinkat(oldpath, AT_FDCWD, newpath)
317−}
318−
319−func Unlink(path string) error {
320− return Unlinkat(AT_FDCWD, path, 0)
321−}
322−
323−//sys Unlinkat(dirfd int, path string, flags int) (err error)
324−
325−func Utimes(path string, tv []Timeval) error {
326− if tv == nil {
327− err := utimensat(AT_FDCWD, path, nil, 0)
328− if err != ENOSYS {
329− return err
330− }
331− return utimes(path, nil)
332− }
333− if len(tv) != 2 {
334− return EINVAL
335− }
336− var ts [2]Timespec
337− ts[0] = NsecToTimespec(TimevalToNsec(tv[0]))
338− ts[1] = NsecToTimespec(TimevalToNsec(tv[1]))
339− err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
340− if err != ENOSYS {
341− return err
342− }
343− return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
344−}
345−
346−//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
347−
348−func UtimesNano(path string, ts []Timespec) error {
349− if ts == nil {
350− err := utimensat(AT_FDCWD, path, nil, 0)
351− if err != ENOSYS {
352− return err
353− }
354− return utimes(path, nil)
355− }
356− if len(ts) != 2 {
357− return EINVAL
358− }
359− err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
360− if err != ENOSYS {
361− return err
362− }
363− // If the utimensat syscall isn't available (utimensat was added to Linux
364− // in 2.6.22, Released, 8 July 2007) then fall back to utimes
365− var tv [2]Timeval
366− for i := 0; i < 2; i++ {
367− tv[i] = NsecToTimeval(TimespecToNsec(ts[i]))
368− }
369− return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
370−}
371−
372−func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
373− if ts == nil {
374− return utimensat(dirfd, path, nil, flags)
375− }
376− if len(ts) != 2 {
377− return EINVAL
378− }
379− return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
380−}
381−
382−func Futimesat(dirfd int, path string, tv []Timeval) error {
383− if tv == nil {
384− return futimesat(dirfd, path, nil)
385− }
386− if len(tv) != 2 {
387− return EINVAL
388− }
389− return futimesat(dirfd, path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
390−}
391−
392−func Futimes(fd int, tv []Timeval) (err error) {
393− // Believe it or not, this is the best we can do on Linux
394− // (and is what glibc does).
395− return Utimes("/proc/self/fd/"+itoa(fd), tv)
396−}
397−
398−const ImplementsGetwd = true
399−
400−//sys Getcwd(buf []byte) (n int, err error)
401−
402−func Getwd() (wd string, err error) {
403− var buf [PathMax]byte
404− n, err := Getcwd(buf[0:])
405− if err != nil {
406− return "", err
407− }
408− // Getcwd returns the number of bytes written to buf, including the NUL.
409− if n < 1 || n > len(buf) || buf[n-1] != 0 {
410− return "", EINVAL
411− }
412− return string(buf[0 : n-1]), nil
413−}
414−
415−func Getgroups() (gids []int, err error) {
416− n, err := getgroups(0, nil)
417− if err != nil {
418− return nil, err
419− }
420− if n == 0 {
421− return nil, nil
422− }
423−
424− // Sanity check group count. Max is 1<<16 on Linux.
425− if n < 0 || n > 1<<20 {
426− return nil, EINVAL
427− }
428−
429− a := make([]_Gid_t, n)
430− n, err = getgroups(n, &a[0])
431− if err != nil {
432− return nil, err
433− }
434− gids = make([]int, n)
435− for i, v := range a[0:n] {
436− gids[i] = int(v)
437− }
438− return
439−}
440−
441−func Setgroups(gids []int) (err error) {
442− if len(gids) == 0 {
443− return setgroups(0, nil)
444− }
445−
446− a := make([]_Gid_t, len(gids))
447− for i, v := range gids {
448− a[i] = _Gid_t(v)
449− }
450− return setgroups(len(a), &a[0])
451−}
452−
453−type WaitStatus uint32
454−
455−// Wait status is 7 bits at bottom, either 0 (exited),
456−// 0x7F (stopped), or a signal number that caused an exit.
457−// The 0x80 bit is whether there was a core dump.
458−// An extra number (exit code, signal causing a stop)
459−// is in the high bits. At least that's the idea.
460−// There are various irregularities. For example, the
461−// "continued" status is 0xFFFF, distinguishing itself
462−// from stopped via the core dump bit.
463−
464−const (
465− mask = 0x7F
466− core = 0x80
467− exited = 0x00
468− stopped = 0x7F
469− shift = 8
470−)
471−
472−func (w WaitStatus) Exited() bool { return w&mask == exited }
473−
474−func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != exited }
475−
476−func (w WaitStatus) Stopped() bool { return w&0xFF == stopped }
477−
478−func (w WaitStatus) Continued() bool { return w == 0xFFFF }
479−
480−func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 }
481−
482−func (w WaitStatus) ExitStatus() int {
483− if !w.Exited() {
484− return -1
485− }
486− return int(w>>shift) & 0xFF
487−}
488−
489−func (w WaitStatus) Signal() syscall.Signal {
490− if !w.Signaled() {
491− return -1
492− }
493− return syscall.Signal(w & mask)
494−}
495−
496−func (w WaitStatus) StopSignal() syscall.Signal {
497− if !w.Stopped() {
498− return -1
499− }
500− return syscall.Signal(w>>shift) & 0xFF
501−}
502−
503−func (w WaitStatus) TrapCause() int {
504− if w.StopSignal() != SIGTRAP {
505− return -1
506− }
507− return int(w>>shift) >> 8
508−}
509−
510−//sys wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error)
511−
512−func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
513− var status _C_int
514− wpid, err = wait4(pid, &status, options, rusage)
515− if wstatus != nil {
516− *wstatus = WaitStatus(status)
517− }
518− return
519−}
520−
521−func Mkfifo(path string, mode uint32) error {
522− return Mknod(path, mode|S_IFIFO, 0)
523−}
524−
525−func Mkfifoat(dirfd int, path string, mode uint32) error {
526− return Mknodat(dirfd, path, mode|S_IFIFO, 0)
527−}
528−
529−func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
530− if sa.Port < 0 || sa.Port > 0xFFFF {
531− return nil, 0, EINVAL
532− }
533− sa.raw.Family = AF_INET
534− p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
535− p[0] = byte(sa.Port >> 8)
536− p[1] = byte(sa.Port)
537− for i := 0; i < len(sa.Addr); i++ {
538− sa.raw.Addr[i] = sa.Addr[i]
539− }
540− return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
541−}
542−
543−func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
544− if sa.Port < 0 || sa.Port > 0xFFFF {
545− return nil, 0, EINVAL
546− }
547− sa.raw.Family = AF_INET6
548− p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
549− p[0] = byte(sa.Port >> 8)
550− p[1] = byte(sa.Port)
551− sa.raw.Scope_id = sa.ZoneId
552− for i := 0; i < len(sa.Addr); i++ {
553− sa.raw.Addr[i] = sa.Addr[i]
554− }
555− return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
556−}
557−
558−func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
559− name := sa.Name
560− n := len(name)
561− if n >= len(sa.raw.Path) {
562− return nil, 0, EINVAL
563− }
564− sa.raw.Family = AF_UNIX
565− for i := 0; i < n; i++ {
566− sa.raw.Path[i] = int8(name[i])
567− }
568− // length is family (uint16), name, NUL.
569− sl := _Socklen(2)
570− if n > 0 {
571− sl += _Socklen(n) + 1
572− }
573− if sa.raw.Path[0] == '@' {
574− sa.raw.Path[0] = 0
575− // Don't count trailing NUL for abstract address.
576− sl--
577− }
578−
579− return unsafe.Pointer(&sa.raw), sl, nil
580−}
581−
582−// SockaddrLinklayer implements the Sockaddr interface for AF_PACKET type sockets.
583−type SockaddrLinklayer struct {
584− Protocol uint16
585− Ifindex int
586− Hatype uint16
587− Pkttype uint8
588− Halen uint8
589− Addr [8]byte
590− raw RawSockaddrLinklayer
591−}
592−
593−func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) {
594− if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
595− return nil, 0, EINVAL
596− }
597− sa.raw.Family = AF_PACKET
598− sa.raw.Protocol = sa.Protocol
599− sa.raw.Ifindex = int32(sa.Ifindex)
600− sa.raw.Hatype = sa.Hatype
601− sa.raw.Pkttype = sa.Pkttype
602− sa.raw.Halen = sa.Halen
603− for i := 0; i < len(sa.Addr); i++ {
604− sa.raw.Addr[i] = sa.Addr[i]
605− }
606− return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil
607−}
608−
609−// SockaddrNetlink implements the Sockaddr interface for AF_NETLINK type sockets.
610−type SockaddrNetlink struct {
611− Family uint16
612− Pad uint16
613− Pid uint32
614− Groups uint32
615− raw RawSockaddrNetlink
616−}
617−
618−func (sa *SockaddrNetlink) sockaddr() (unsafe.Pointer, _Socklen, error) {
619− sa.raw.Family = AF_NETLINK
620− sa.raw.Pad = sa.Pad
621− sa.raw.Pid = sa.Pid
622− sa.raw.Groups = sa.Groups
623− return unsafe.Pointer(&sa.raw), SizeofSockaddrNetlink, nil
624−}
625−
626−// SockaddrHCI implements the Sockaddr interface for AF_BLUETOOTH type sockets
627−// using the HCI protocol.
628−type SockaddrHCI struct {
629− Dev uint16
630− Channel uint16
631− raw RawSockaddrHCI
632−}
633−
634−func (sa *SockaddrHCI) sockaddr() (unsafe.Pointer, _Socklen, error) {
635− sa.raw.Family = AF_BLUETOOTH
636− sa.raw.Dev = sa.Dev
637− sa.raw.Channel = sa.Channel
638− return unsafe.Pointer(&sa.raw), SizeofSockaddrHCI, nil
639−}
640−
641−// SockaddrL2 implements the Sockaddr interface for AF_BLUETOOTH type sockets
642−// using the L2CAP protocol.
643−type SockaddrL2 struct {
644− PSM uint16
645− CID uint16
646− Addr [6]uint8
647− AddrType uint8
648− raw RawSockaddrL2
649−}
650−
651−func (sa *SockaddrL2) sockaddr() (unsafe.Pointer, _Socklen, error) {
652− sa.raw.Family = AF_BLUETOOTH
653− psm := (*[2]byte)(unsafe.Pointer(&sa.raw.Psm))
654− psm[0] = byte(sa.PSM)
655− psm[1] = byte(sa.PSM >> 8)
656− for i := 0; i < len(sa.Addr); i++ {
657− sa.raw.Bdaddr[i] = sa.Addr[len(sa.Addr)-1-i]
658− }
659− cid := (*[2]byte)(unsafe.Pointer(&sa.raw.Cid))
660− cid[0] = byte(sa.CID)
661− cid[1] = byte(sa.CID >> 8)
662− sa.raw.Bdaddr_type = sa.AddrType
663− return unsafe.Pointer(&sa.raw), SizeofSockaddrL2, nil
664−}
665−
666−// SockaddrRFCOMM implements the Sockaddr interface for AF_BLUETOOTH type sockets
667−// using the RFCOMM protocol.
668−//
669−// Server example:
670−//
671−// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
672−// _ = unix.Bind(fd, &unix.SockaddrRFCOMM{
673−// Channel: 1,
674−// Addr: [6]uint8{0, 0, 0, 0, 0, 0}, // BDADDR_ANY or 00:00:00:00:00:00
675−// })
676−// _ = Listen(fd, 1)
677−// nfd, sa, _ := Accept(fd)
678−// fmt.Printf("conn addr=%v fd=%d", sa.(*unix.SockaddrRFCOMM).Addr, nfd)
679−// Read(nfd, buf)
680−//
681−// Client example:
682−//
683−// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
684−// _ = Connect(fd, &SockaddrRFCOMM{
685−// Channel: 1,
686−// Addr: [6]byte{0x11, 0x22, 0x33, 0xaa, 0xbb, 0xcc}, // CC:BB:AA:33:22:11
687−// })
688−// Write(fd, []byte(`hello`))
689−type SockaddrRFCOMM struct {
690− // Addr represents a bluetooth address, byte ordering is little-endian.
691− Addr [6]uint8
692−
693− // Channel is a designated bluetooth channel, only 1-30 are available for use.
694− // Since Linux 2.6.7 and further zero value is the first available channel.
695− Channel uint8
696−
697− raw RawSockaddrRFCOMM
698−}
699−
700−func (sa *SockaddrRFCOMM) sockaddr() (unsafe.Pointer, _Socklen, error) {
701− sa.raw.Family = AF_BLUETOOTH
702− sa.raw.Channel = sa.Channel
703− sa.raw.Bdaddr = sa.Addr
704− return unsafe.Pointer(&sa.raw), SizeofSockaddrRFCOMM, nil
705−}
706−
707−// SockaddrCAN implements the Sockaddr interface for AF_CAN type sockets.
708−// The RxID and TxID fields are used for transport protocol addressing in
709−// (CAN_TP16, CAN_TP20, CAN_MCNET, and CAN_ISOTP), they can be left with
710−// zero values for CAN_RAW and CAN_BCM sockets as they have no meaning.
711−//
712−// The SockaddrCAN struct must be bound to the socket file descriptor
713−// using Bind before the CAN socket can be used.
714−//
715−// // Read one raw CAN frame
716−// fd, _ := Socket(AF_CAN, SOCK_RAW, CAN_RAW)
717−// addr := &SockaddrCAN{Ifindex: index}
718−// Bind(fd, addr)
719−// frame := make([]byte, 16)
720−// Read(fd, frame)
721−//
722−// The full SocketCAN documentation can be found in the linux kernel
723−// archives at: https://www.kernel.org/doc/Documentation/networking/can.txt
724−type SockaddrCAN struct {
725− Ifindex int
726− RxID uint32
727− TxID uint32
728− raw RawSockaddrCAN
729−}
730−
731−func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
732− if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
733− return nil, 0, EINVAL
734− }
735− sa.raw.Family = AF_CAN
736− sa.raw.Ifindex = int32(sa.Ifindex)
737− rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
738− for i := 0; i < 4; i++ {
739− sa.raw.Addr[i] = rx[i]
740− }
741− tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
742− for i := 0; i < 4; i++ {
743− sa.raw.Addr[i+4] = tx[i]
744− }
745− return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
746−}
747−
748−// SockaddrCANJ1939 implements the Sockaddr interface for AF_CAN using J1939
749−// protocol (https://en.wikipedia.org/wiki/SAE_J1939). For more information
750−// on the purposes of the fields, check the official linux kernel documentation
751−// available here: https://www.kernel.org/doc/Documentation/networking/j1939.rst
752−type SockaddrCANJ1939 struct {
753− Ifindex int
754− Name uint64
755− PGN uint32
756− Addr uint8
757− raw RawSockaddrCAN
758−}
759−
760−func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) {
761− if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
762− return nil, 0, EINVAL
763− }
764− sa.raw.Family = AF_CAN
765− sa.raw.Ifindex = int32(sa.Ifindex)
766− n := (*[8]byte)(unsafe.Pointer(&sa.Name))
767− for i := 0; i < 8; i++ {
768− sa.raw.Addr[i] = n[i]
769− }
770− p := (*[4]byte)(unsafe.Pointer(&sa.PGN))
771− for i := 0; i < 4; i++ {
772− sa.raw.Addr[i+8] = p[i]
773− }
774− sa.raw.Addr[12] = sa.Addr
775− return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
776−}
777−
778−// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
779−// SockaddrALG enables userspace access to the Linux kernel's cryptography
780−// subsystem. The Type and Name fields specify which type of hash or cipher
781−// should be used with a given socket.
782−//
783−// To create a file descriptor that provides access to a hash or cipher, both
784−// Bind and Accept must be used. Once the setup process is complete, input
785−// data can be written to the socket, processed by the kernel, and then read
786−// back as hash output or ciphertext.
787−//
788−// Here is an example of using an AF_ALG socket with SHA1 hashing.
789−// The initial socket setup process is as follows:
790−//
791−// // Open a socket to perform SHA1 hashing.
792−// fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
793−// addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
794−// unix.Bind(fd, addr)
795−// // Note: unix.Accept does not work at this time; must invoke accept()
796−// // manually using unix.Syscall.
797−// hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
798−//
799−// Once a file descriptor has been returned from Accept, it may be used to
800−// perform SHA1 hashing. The descriptor is not safe for concurrent use, but
801−// may be re-used repeatedly with subsequent Write and Read operations.
802−//
803−// When hashing a small byte slice or string, a single Write and Read may
804−// be used:
805−//
806−// // Assume hashfd is already configured using the setup process.
807−// hash := os.NewFile(hashfd, "sha1")
808−// // Hash an input string and read the results. Each Write discards
809−// // previous hash state. Read always reads the current state.
810−// b := make([]byte, 20)
811−// for i := 0; i < 2; i++ {
812−// io.WriteString(hash, "Hello, world.")
813−// hash.Read(b)
814−// fmt.Println(hex.EncodeToString(b))
815−// }
816−// // Output:
817−// // 2ae01472317d1935a84797ec1983ae243fc6aa28
818−// // 2ae01472317d1935a84797ec1983ae243fc6aa28
819−//
820−// For hashing larger byte slices, or byte streams such as those read from
821−// a file or socket, use Sendto with MSG_MORE to instruct the kernel to update
822−// the hash digest instead of creating a new one for a given chunk and finalizing it.
823−//
824−// // Assume hashfd and addr are already configured using the setup process.
825−// hash := os.NewFile(hashfd, "sha1")
826−// // Hash the contents of a file.
827−// f, _ := os.Open("/tmp/linux-4.10-rc7.tar.xz")
828−// b := make([]byte, 4096)
829−// for {
830−// n, err := f.Read(b)
831−// if err == io.EOF {
832−// break
833−// }
834−// unix.Sendto(hashfd, b[:n], unix.MSG_MORE, addr)
835−// }
836−// hash.Read(b)
837−// fmt.Println(hex.EncodeToString(b))
838−// // Output: 85cdcad0c06eef66f805ecce353bec9accbeecc5
839−//
840−// For more information, see: http://www.chronox.de/crypto-API/crypto/userspace-if.html.
841−type SockaddrALG struct {
842− Type string
843− Name string
844− Feature uint32
845− Mask uint32
846− raw RawSockaddrALG
847−}
848−
849−func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
850− // Leave room for NUL byte terminator.
851− if len(sa.Type) > 13 {
852− return nil, 0, EINVAL
853− }
854− if len(sa.Name) > 63 {
855− return nil, 0, EINVAL
856− }
857−
858− sa.raw.Family = AF_ALG
859− sa.raw.Feat = sa.Feature
860− sa.raw.Mask = sa.Mask
861−
862− typ, err := ByteSliceFromString(sa.Type)
863− if err != nil {
864− return nil, 0, err
865− }
866− name, err := ByteSliceFromString(sa.Name)
867− if err != nil {
868− return nil, 0, err
869− }
870−
871− copy(sa.raw.Type[:], typ)
872− copy(sa.raw.Name[:], name)
873−
874− return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
875−}
876−
877−// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
878−// SockaddrVM provides access to Linux VM sockets: a mechanism that enables
879−// bidirectional communication between a hypervisor and its guest virtual
880−// machines.
881−type SockaddrVM struct {
882− // CID and Port specify a context ID and port address for a VM socket.
883− // Guests have a unique CID, and hosts may have a well-known CID of:
884− // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
885− // - VMADDR_CID_LOCAL: refers to local communication (loopback).
886− // - VMADDR_CID_HOST: refers to other processes on the host.
887− CID uint32
888− Port uint32
889− Flags uint8
890− raw RawSockaddrVM
891−}
892−
893−func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
894− sa.raw.Family = AF_VSOCK
895− sa.raw.Port = sa.Port
896− sa.raw.Cid = sa.CID
897− sa.raw.Flags = sa.Flags
898−
899− return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
900−}
901−
902−type SockaddrXDP struct {
903− Flags uint16
904− Ifindex uint32
905− QueueID uint32
906− SharedUmemFD uint32
907− raw RawSockaddrXDP
908−}
909−
910−func (sa *SockaddrXDP) sockaddr() (unsafe.Pointer, _Socklen, error) {
911− sa.raw.Family = AF_XDP
912− sa.raw.Flags = sa.Flags
913− sa.raw.Ifindex = sa.Ifindex
914− sa.raw.Queue_id = sa.QueueID
915− sa.raw.Shared_umem_fd = sa.SharedUmemFD
916−
917− return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
918−}
919−
920−// This constant mirrors the #define of PX_PROTO_OE in
921−// linux/if_pppox.h. We're defining this by hand here instead of
922−// autogenerating through mkerrors.sh because including
923−// linux/if_pppox.h causes some declaration conflicts with other
924−// includes (linux/if_pppox.h includes linux/in.h, which conflicts
925−// with netinet/in.h). Given that we only need a single zero constant
926−// out of that file, it's cleaner to just define it by hand here.
927−const px_proto_oe = 0
928−
929−type SockaddrPPPoE struct {
930− SID uint16
931− Remote []byte
932− Dev string
933− raw RawSockaddrPPPoX
934−}
935−
936−func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) {
937− if len(sa.Remote) != 6 {
938− return nil, 0, EINVAL
939− }
940− if len(sa.Dev) > IFNAMSIZ-1 {
941− return nil, 0, EINVAL
942− }
943−
944− *(*uint16)(unsafe.Pointer(&sa.raw[0])) = AF_PPPOX
945− // This next field is in host-endian byte order. We can't use the
946− // same unsafe pointer cast as above, because this value is not
947− // 32-bit aligned and some architectures don't allow unaligned
948− // access.
949− //
950− // However, the value of px_proto_oe is 0, so we can use
951− // encoding/binary helpers to write the bytes without worrying
952− // about the ordering.
953− binary.BigEndian.PutUint32(sa.raw[2:6], px_proto_oe)
954− // This field is deliberately big-endian, unlike the previous
955− // one. The kernel expects SID to be in network byte order.
956− binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID)
957− copy(sa.raw[8:14], sa.Remote)
958− for i := 14; i < 14+IFNAMSIZ; i++ {
959− sa.raw[i] = 0
960− }
961− copy(sa.raw[14:], sa.Dev)
962− return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil
963−}
964−
965−// SockaddrTIPC implements the Sockaddr interface for AF_TIPC type sockets.
966−// For more information on TIPC, see: http://tipc.sourceforge.net/.
967−type SockaddrTIPC struct {
968− // Scope is the publication scopes when binding service/service range.
969− // Should be set to TIPC_CLUSTER_SCOPE or TIPC_NODE_SCOPE.
970− Scope int
971−
972− // Addr is the type of address used to manipulate a socket. Addr must be
973− // one of:
974− // - *TIPCSocketAddr: "id" variant in the C addr union
975− // - *TIPCServiceRange: "nameseq" variant in the C addr union
976− // - *TIPCServiceName: "name" variant in the C addr union
977− //
978− // If nil, EINVAL will be returned when the structure is used.
979− Addr TIPCAddr
980−
981− raw RawSockaddrTIPC
982−}
983−
984−// TIPCAddr is implemented by types that can be used as an address for
985−// SockaddrTIPC. It is only implemented by *TIPCSocketAddr, *TIPCServiceRange,
986−// and *TIPCServiceName.
987−type TIPCAddr interface {
988− tipcAddrtype() uint8
989− tipcAddr() [12]byte
990−}
991−
992−func (sa *TIPCSocketAddr) tipcAddr() [12]byte {
993− var out [12]byte
994− copy(out[:], (*(*[unsafe.Sizeof(TIPCSocketAddr{})]byte)(unsafe.Pointer(sa)))[:])
995− return out
996−}
997−
998−func (sa *TIPCSocketAddr) tipcAddrtype() uint8 { return TIPC_SOCKET_ADDR }
999−
1000−func (sa *TIPCServiceRange) tipcAddr() [12]byte {
1001− var out [12]byte
1002− copy(out[:], (*(*[unsafe.Sizeof(TIPCServiceRange{})]byte)(unsafe.Pointer(sa)))[:])
1003− return out
1004−}
1005−
1006−func (sa *TIPCServiceRange) tipcAddrtype() uint8 { return TIPC_SERVICE_RANGE }
1007−
1008−func (sa *TIPCServiceName) tipcAddr() [12]byte {
1009− var out [12]byte
1010− copy(out[:], (*(*[unsafe.Sizeof(TIPCServiceName{})]byte)(unsafe.Pointer(sa)))[:])
1011− return out
1012−}
1013−
1014−func (sa *TIPCServiceName) tipcAddrtype() uint8 { return TIPC_SERVICE_ADDR }
1015−
1016−func (sa *SockaddrTIPC) sockaddr() (unsafe.Pointer, _Socklen, error) {
1017− if sa.Addr == nil {
1018− return nil, 0, EINVAL
1019− }
1020−
1021− sa.raw.Family = AF_TIPC
1022− sa.raw.Scope = int8(sa.Scope)
1023− sa.raw.Addrtype = sa.Addr.tipcAddrtype()
1024− sa.raw.Addr = sa.Addr.tipcAddr()
1025−
1026− return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil
1027−}
1028−
1029−// SockaddrL2TPIP implements the Sockaddr interface for IPPROTO_L2TP/AF_INET sockets.
1030−type SockaddrL2TPIP struct {
1031− Addr [4]byte
1032− ConnId uint32
1033− raw RawSockaddrL2TPIP
1034−}
1035−
1036−func (sa *SockaddrL2TPIP) sockaddr() (unsafe.Pointer, _Socklen, error) {
1037− sa.raw.Family = AF_INET
1038− sa.raw.Conn_id = sa.ConnId
1039− for i := 0; i < len(sa.Addr); i++ {
1040− sa.raw.Addr[i] = sa.Addr[i]
1041− }
1042− return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP, nil
1043−}
1044−
1045−// SockaddrL2TPIP6 implements the Sockaddr interface for IPPROTO_L2TP/AF_INET6 sockets.
1046−type SockaddrL2TPIP6 struct {
1047− Addr [16]byte
1048− ZoneId uint32
1049− ConnId uint32
1050− raw RawSockaddrL2TPIP6
1051−}
1052−
1053−func (sa *SockaddrL2TPIP6) sockaddr() (unsafe.Pointer, _Socklen, error) {
1054− sa.raw.Family = AF_INET6
1055− sa.raw.Conn_id = sa.ConnId
1056− sa.raw.Scope_id = sa.ZoneId
1057− for i := 0; i < len(sa.Addr); i++ {
1058− sa.raw.Addr[i] = sa.Addr[i]
1059− }
1060− return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil
1061−}
1062−
1063−// SockaddrIUCV implements the Sockaddr interface for AF_IUCV sockets.
1064−type SockaddrIUCV struct {
1065− UserID string
1066− Name string
1067− raw RawSockaddrIUCV
1068−}
1069−
1070−func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
1071− sa.raw.Family = AF_IUCV
1072− // These are EBCDIC encoded by the kernel, but we still need to pad them
1073− // with blanks. Initializing with blanks allows the caller to feed in either
1074− // a padded or an unpadded string.
1075− for i := 0; i < 8; i++ {
1076− sa.raw.Nodeid[i] = ' '
1077− sa.raw.User_id[i] = ' '
1078− sa.raw.Name[i] = ' '
1079− }
1080− if len(sa.UserID) > 8 || len(sa.Name) > 8 {
1081− return nil, 0, EINVAL
1082− }
1083− for i, b := range []byte(sa.UserID[:]) {
1084− sa.raw.User_id[i] = int8(b)
1085− }
1086− for i, b := range []byte(sa.Name[:]) {
1087− sa.raw.Name[i] = int8(b)
1088− }
1089− return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
1090−}
1091−
1092−var socketProtocol = func(fd int) (int, error) {
1093− return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
1094−}
1095−
1096−func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
1097− switch rsa.Addr.Family {
1098− case AF_NETLINK:
1099− pp := (*RawSockaddrNetlink)(unsafe.Pointer(rsa))
1100− sa := new(SockaddrNetlink)
1101− sa.Family = pp.Family
1102− sa.Pad = pp.Pad
1103− sa.Pid = pp.Pid
1104− sa.Groups = pp.Groups
1105− return sa, nil
1106−
1107− case AF_PACKET:
1108− pp := (*RawSockaddrLinklayer)(unsafe.Pointer(rsa))
1109− sa := new(SockaddrLinklayer)
1110− sa.Protocol = pp.Protocol
1111− sa.Ifindex = int(pp.Ifindex)
1112− sa.Hatype = pp.Hatype
1113− sa.Pkttype = pp.Pkttype
1114− sa.Halen = pp.Halen
1115− for i := 0; i < len(sa.Addr); i++ {
1116− sa.Addr[i] = pp.Addr[i]
1117− }
1118− return sa, nil
1119−
1120− case AF_UNIX:
1121− pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
1122− sa := new(SockaddrUnix)
1123− if pp.Path[0] == 0 {
1124− // "Abstract" Unix domain socket.
1125− // Rewrite leading NUL as @ for textual display.
1126− // (This is the standard convention.)
1127− // Not friendly to overwrite in place,
1128− // but the callers below don't care.
1129− pp.Path[0] = '@'
1130− }
1131−
1132− // Assume path ends at NUL.
1133− // This is not technically the Linux semantics for
1134− // abstract Unix domain sockets--they are supposed
1135− // to be uninterpreted fixed-size binary blobs--but
1136− // everyone uses this convention.
1137− n := 0
1138− for n < len(pp.Path) && pp.Path[n] != 0 {
1139− n++
1140− }
1141− bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
1142− sa.Name = string(bytes)
1143− return sa, nil
1144−
1145− case AF_INET:
1146− proto, err := socketProtocol(fd)
1147− if err != nil {
1148− return nil, err
1149− }
1150−
1151− switch proto {
1152− case IPPROTO_L2TP:
1153− pp := (*RawSockaddrL2TPIP)(unsafe.Pointer(rsa))
1154− sa := new(SockaddrL2TPIP)
1155− sa.ConnId = pp.Conn_id
1156− for i := 0; i < len(sa.Addr); i++ {
1157− sa.Addr[i] = pp.Addr[i]
1158− }
1159− return sa, nil
1160− default:
1161− pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
1162− sa := new(SockaddrInet4)
1163− p := (*[2]byte)(unsafe.Pointer(&pp.Port))
1164− sa.Port = int(p[0])<<8 + int(p[1])
1165− for i := 0; i < len(sa.Addr); i++ {
1166− sa.Addr[i] = pp.Addr[i]
1167− }
1168− return sa, nil
1169− }
1170−
1171− case AF_INET6:
1172− proto, err := socketProtocol(fd)
1173− if err != nil {
1174− return nil, err
1175− }
1176−
1177− switch proto {
1178− case IPPROTO_L2TP:
1179− pp := (*RawSockaddrL2TPIP6)(unsafe.Pointer(rsa))
1180− sa := new(SockaddrL2TPIP6)
1181− sa.ConnId = pp.Conn_id
1182− sa.ZoneId = pp.Scope_id
1183− for i := 0; i < len(sa.Addr); i++ {
1184− sa.Addr[i] = pp.Addr[i]
1185− }
1186− return sa, nil
1187− default:
1188− pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
1189− sa := new(SockaddrInet6)
1190− p := (*[2]byte)(unsafe.Pointer(&pp.Port))
1191− sa.Port = int(p[0])<<8 + int(p[1])
1192− sa.ZoneId = pp.Scope_id
1193− for i := 0; i < len(sa.Addr); i++ {
1194− sa.Addr[i] = pp.Addr[i]
1195− }
1196− return sa, nil
1197− }
1198−
1199− case AF_VSOCK:
1200− pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
1201− sa := &SockaddrVM{
1202− CID: pp.Cid,
1203− Port: pp.Port,
1204− Flags: pp.Flags,
1205− }
1206− return sa, nil
1207− case AF_BLUETOOTH:
1208− proto, err := socketProtocol(fd)
1209− if err != nil {
1210− return nil, err
1211− }
1212− // only BTPROTO_L2CAP and BTPROTO_RFCOMM can accept connections
1213− switch proto {
1214− case BTPROTO_L2CAP:
1215− pp := (*RawSockaddrL2)(unsafe.Pointer(rsa))
1216− sa := &SockaddrL2{
1217− PSM: pp.Psm,
1218− CID: pp.Cid,
1219− Addr: pp.Bdaddr,
1220− AddrType: pp.Bdaddr_type,
1221− }
1222− return sa, nil
1223− case BTPROTO_RFCOMM:
1224− pp := (*RawSockaddrRFCOMM)(unsafe.Pointer(rsa))
1225− sa := &SockaddrRFCOMM{
1226− Channel: pp.Channel,
1227− Addr: pp.Bdaddr,
1228− }
1229− return sa, nil
1230− }
1231− case AF_XDP:
1232− pp := (*RawSockaddrXDP)(unsafe.Pointer(rsa))
1233− sa := &SockaddrXDP{
1234− Flags: pp.Flags,
1235− Ifindex: pp.Ifindex,
1236− QueueID: pp.Queue_id,
1237− SharedUmemFD: pp.Shared_umem_fd,
1238− }
1239− return sa, nil
1240− case AF_PPPOX:
1241− pp := (*RawSockaddrPPPoX)(unsafe.Pointer(rsa))
1242− if binary.BigEndian.Uint32(pp[2:6]) != px_proto_oe {
1243− return nil, EINVAL
1244− }
1245− sa := &SockaddrPPPoE{
1246− SID: binary.BigEndian.Uint16(pp[6:8]),
1247− Remote: pp[8:14],
1248− }
1249− for i := 14; i < 14+IFNAMSIZ; i++ {
1250− if pp[i] == 0 {
1251− sa.Dev = string(pp[14:i])
1252− break
1253− }
1254− }
1255− return sa, nil
1256− case AF_TIPC:
1257− pp := (*RawSockaddrTIPC)(unsafe.Pointer(rsa))
1258−
1259− sa := &SockaddrTIPC{
1260− Scope: int(pp.Scope),
1261− }
1262−
1263− // Determine which union variant is present in pp.Addr by checking
1264− // pp.Addrtype.
1265− switch pp.Addrtype {
1266− case TIPC_SERVICE_RANGE:
1267− sa.Addr = (*TIPCServiceRange)(unsafe.Pointer(&pp.Addr))
1268− case TIPC_SERVICE_ADDR:
1269− sa.Addr = (*TIPCServiceName)(unsafe.Pointer(&pp.Addr))
1270− case TIPC_SOCKET_ADDR:
1271− sa.Addr = (*TIPCSocketAddr)(unsafe.Pointer(&pp.Addr))
1272− default:
1273− return nil, EINVAL
1274− }
1275−
1276− return sa, nil
1277− case AF_IUCV:
1278− pp := (*RawSockaddrIUCV)(unsafe.Pointer(rsa))
1279−
1280− var user [8]byte
1281− var name [8]byte
1282−
1283− for i := 0; i < 8; i++ {
1284− user[i] = byte(pp.User_id[i])
1285− name[i] = byte(pp.Name[i])
1286− }
1287−
1288− sa := &SockaddrIUCV{
1289− UserID: string(user[:]),
1290− Name: string(name[:]),
1291− }
1292− return sa, nil
1293−
1294− case AF_CAN:
1295− proto, err := socketProtocol(fd)
1296− if err != nil {
1297− return nil, err
1298− }
1299−
1300− pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
1301−
1302− switch proto {
1303− case CAN_J1939:
1304− sa := &SockaddrCANJ1939{
1305− Ifindex: int(pp.Ifindex),
1306− }
1307− name := (*[8]byte)(unsafe.Pointer(&sa.Name))
1308− for i := 0; i < 8; i++ {
1309− name[i] = pp.Addr[i]
1310− }
1311− pgn := (*[4]byte)(unsafe.Pointer(&sa.PGN))
1312− for i := 0; i < 4; i++ {
1313− pgn[i] = pp.Addr[i+8]
1314− }
1315− addr := (*[1]byte)(unsafe.Pointer(&sa.Addr))
1316− addr[0] = pp.Addr[12]
1317− return sa, nil
1318− default:
1319− sa := &SockaddrCAN{
1320− Ifindex: int(pp.Ifindex),
1321− }
1322− rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
1323− for i := 0; i < 4; i++ {
1324− rx[i] = pp.Addr[i]
1325− }
1326− tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
1327− for i := 0; i < 4; i++ {
1328− tx[i] = pp.Addr[i+4]
1329− }
1330− return sa, nil
1331− }
1332− }
1333− return nil, EAFNOSUPPORT
1334−}
1335−
1336−func Accept(fd int) (nfd int, sa Sockaddr, err error) {
1337− var rsa RawSockaddrAny
1338− var len _Socklen = SizeofSockaddrAny
1339− nfd, err = accept(fd, &rsa, &len)
1340− if err != nil {
1341− return
1342− }
1343− sa, err = anyToSockaddr(fd, &rsa)
1344− if err != nil {
1345− Close(nfd)
1346− nfd = 0
1347− }
1348− return
1349−}
1350−
1351−func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
1352− var rsa RawSockaddrAny
1353− var len _Socklen = SizeofSockaddrAny
1354− nfd, err = accept4(fd, &rsa, &len, flags)
1355− if err != nil {
1356− return
1357− }
1358− if len > SizeofSockaddrAny {
1359− panic("RawSockaddrAny too small")
1360− }
1361− sa, err = anyToSockaddr(fd, &rsa)
1362− if err != nil {
1363− Close(nfd)
1364− nfd = 0
1365− }
1366− return
1367−}
1368−
1369−func Getsockname(fd int) (sa Sockaddr, err error) {
1370− var rsa RawSockaddrAny
1371− var len _Socklen = SizeofSockaddrAny
1372− if err = getsockname(fd, &rsa, &len); err != nil {
1373− return
1374− }
1375− return anyToSockaddr(fd, &rsa)
1376−}
1377−
1378−func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
1379− var value IPMreqn
1380− vallen := _Socklen(SizeofIPMreqn)
1381− err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
1382− return &value, err
1383−}
1384−
1385−func GetsockoptUcred(fd, level, opt int) (*Ucred, error) {
1386− var value Ucred
1387− vallen := _Socklen(SizeofUcred)
1388− err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
1389− return &value, err
1390−}
1391−
1392−func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) {
1393− var value TCPInfo
1394− vallen := _Socklen(SizeofTCPInfo)
1395− err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
1396− return &value, err
1397−}
1398−
1399−// GetsockoptString returns the string value of the socket option opt for the
1400−// socket associated with fd at the given socket level.
1401−func GetsockoptString(fd, level, opt int) (string, error) {
1402− buf := make([]byte, 256)
1403− vallen := _Socklen(len(buf))
1404− err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
1405− if err != nil {
1406− if err == ERANGE {
1407− buf = make([]byte, vallen)
1408− err = getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
1409− }
1410− if err != nil {
1411− return "", err
1412− }
1413− }
1414− return string(buf[:vallen-1]), nil
1415−}
1416−
1417−func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
1418− var value TpacketStats
1419− vallen := _Socklen(SizeofTpacketStats)
1420− err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
1421− return &value, err
1422−}
1423−
1424−func GetsockoptTpacketStatsV3(fd, level, opt int) (*TpacketStatsV3, error) {
1425− var value TpacketStatsV3
1426− vallen := _Socklen(SizeofTpacketStatsV3)
1427− err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
1428− return &value, err
1429−}
1430−
1431−func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
1432− return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
1433−}
1434−
1435−func SetsockoptPacketMreq(fd, level, opt int, mreq *PacketMreq) error {
1436− return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
1437−}
1438−
1439−// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a
1440−// socket to filter incoming packets. See 'man 7 socket' for usage information.
1441−func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error {
1442− return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog))
1443−}
1444−
1445−func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error {
1446− var p unsafe.Pointer
1447− if len(filter) > 0 {
1448− p = unsafe.Pointer(&filter[0])
1449− }
1450− return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter))
1451−}
1452−
1453−func SetsockoptTpacketReq(fd, level, opt int, tp *TpacketReq) error {
1454− return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
1455−}
1456−
1457−func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {
1458− return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
1459−}
1460−
1461−// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
1462−
1463−// KeyctlInt calls keyctl commands in which each argument is an int.
1464−// These commands are KEYCTL_REVOKE, KEYCTL_CHOWN, KEYCTL_CLEAR, KEYCTL_LINK,
1465−// KEYCTL_UNLINK, KEYCTL_NEGATE, KEYCTL_SET_REQKEY_KEYRING, KEYCTL_SET_TIMEOUT,
1466−// KEYCTL_ASSUME_AUTHORITY, KEYCTL_SESSION_TO_PARENT, KEYCTL_REJECT,
1467−// KEYCTL_INVALIDATE, and KEYCTL_GET_PERSISTENT.
1468−//sys KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) = SYS_KEYCTL
1469−
1470−// KeyctlBuffer calls keyctl commands in which the third and fourth
1471−// arguments are a buffer and its length, respectively.
1472−// These commands are KEYCTL_UPDATE, KEYCTL_READ, and KEYCTL_INSTANTIATE.
1473−//sys KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) = SYS_KEYCTL
1474−
1475−// KeyctlString calls keyctl commands which return a string.
1476−// These commands are KEYCTL_DESCRIBE and KEYCTL_GET_SECURITY.
1477−func KeyctlString(cmd int, id int) (string, error) {
1478− // We must loop as the string data may change in between the syscalls.
1479− // We could allocate a large buffer here to reduce the chance that the
1480− // syscall needs to be called twice; however, this is unnecessary as
1481− // the performance loss is negligible.
1482− var buffer []byte
1483− for {
1484− // Try to fill the buffer with data
1485− length, err := KeyctlBuffer(cmd, id, buffer, 0)
1486− if err != nil {
1487− return "", err
1488− }
1489−
1490− // Check if the data was written
1491− if length <= len(buffer) {
1492− // Exclude the null terminator
1493− return string(buffer[:length-1]), nil
1494− }
1495−
1496− // Make a bigger buffer if needed
1497− buffer = make([]byte, length)
1498− }
1499−}
1500−
1501−// Keyctl commands with special signatures.
1502−
1503−// KeyctlGetKeyringID implements the KEYCTL_GET_KEYRING_ID command.
1504−// See the full documentation at:
1505−// http://man7.org/linux/man-pages/man3/keyctl_get_keyring_ID.3.html
1506−func KeyctlGetKeyringID(id int, create bool) (ringid int, err error) {
1507− createInt := 0
1508− if create {
1509− createInt = 1
1510− }
1511− return KeyctlInt(KEYCTL_GET_KEYRING_ID, id, createInt, 0, 0)
1512−}
1513−
1514−// KeyctlSetperm implements the KEYCTL_SETPERM command. The perm value is the
1515−// key handle permission mask as described in the "keyctl setperm" section of
1516−// http://man7.org/linux/man-pages/man1/keyctl.1.html.
1517−// See the full documentation at:
1518−// http://man7.org/linux/man-pages/man3/keyctl_setperm.3.html
1519−func KeyctlSetperm(id int, perm uint32) error {
1520− _, err := KeyctlInt(KEYCTL_SETPERM, id, int(perm), 0, 0)
1521− return err
1522−}
1523−
1524−//sys keyctlJoin(cmd int, arg2 string) (ret int, err error) = SYS_KEYCTL
1525−
1526−// KeyctlJoinSessionKeyring implements the KEYCTL_JOIN_SESSION_KEYRING command.
1527−// See the full documentation at:
1528−// http://man7.org/linux/man-pages/man3/keyctl_join_session_keyring.3.html
1529−func KeyctlJoinSessionKeyring(name string) (ringid int, err error) {
1530− return keyctlJoin(KEYCTL_JOIN_SESSION_KEYRING, name)
1531−}
1532−
1533−//sys keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) = SYS_KEYCTL
1534−
1535−// KeyctlSearch implements the KEYCTL_SEARCH command.
1536−// See the full documentation at:
1537−// http://man7.org/linux/man-pages/man3/keyctl_search.3.html
1538−func KeyctlSearch(ringid int, keyType, description string, destRingid int) (id int, err error) {
1539− return keyctlSearch(KEYCTL_SEARCH, ringid, keyType, description, destRingid)
1540−}
1541−
1542−//sys keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) = SYS_KEYCTL
1543−
1544−// KeyctlInstantiateIOV implements the KEYCTL_INSTANTIATE_IOV command. This
1545−// command is similar to KEYCTL_INSTANTIATE, except that the payload is a slice
1546−// of Iovec (each of which represents a buffer) instead of a single buffer.
1547−// See the full documentation at:
1548−// http://man7.org/linux/man-pages/man3/keyctl_instantiate_iov.3.html
1549−func KeyctlInstantiateIOV(id int, payload []Iovec, ringid int) error {
1550− return keyctlIOV(KEYCTL_INSTANTIATE_IOV, id, payload, ringid)
1551−}
1552−
1553−//sys keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) = SYS_KEYCTL
1554−
1555−// KeyctlDHCompute implements the KEYCTL_DH_COMPUTE command. This command
1556−// computes a Diffie-Hellman shared secret based on the provide params. The
1557−// secret is written to the provided buffer and the returned size is the number
1558−// of bytes written (returning an error if there is insufficient space in the
1559−// buffer). If a nil buffer is passed in, this function returns the minimum
1560−// buffer length needed to store the appropriate data. Note that this differs
1561−// from KEYCTL_READ's behavior which always returns the requested payload size.
1562−// See the full documentation at:
1563−// http://man7.org/linux/man-pages/man3/keyctl_dh_compute.3.html
1564−func KeyctlDHCompute(params *KeyctlDHParams, buffer []byte) (size int, err error) {
1565− return keyctlDH(KEYCTL_DH_COMPUTE, params, buffer)
1566−}
1567−
1568−// KeyctlRestrictKeyring implements the KEYCTL_RESTRICT_KEYRING command. This
1569−// command limits the set of keys that can be linked to the keyring, regardless
1570−// of keyring permissions. The command requires the "setattr" permission.
1571−//
1572−// When called with an empty keyType the command locks the keyring, preventing
1573−// any further keys from being linked to the keyring.
1574−//
1575−// The "asymmetric" keyType defines restrictions requiring key payloads to be
1576−// DER encoded X.509 certificates signed by keys in another keyring. Restrictions
1577−// for "asymmetric" include "builtin_trusted", "builtin_and_secondary_trusted",
1578−// "key_or_keyring:<key>", and "key_or_keyring:<key>:chain".
1579−//
1580−// As of Linux 4.12, only the "asymmetric" keyType defines type-specific
1581−// restrictions.
1582−//
1583−// See the full documentation at:
1584−// http://man7.org/linux/man-pages/man3/keyctl_restrict_keyring.3.html
1585−// http://man7.org/linux/man-pages/man2/keyctl.2.html
1586−func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error {
1587− if keyType == "" {
1588− return keyctlRestrictKeyring(KEYCTL_RESTRICT_KEYRING, ringid)
1589− }
1590− return keyctlRestrictKeyringByType(KEYCTL_RESTRICT_KEYRING, ringid, keyType, restriction)
1591−}
1592−
1593−//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
1594−//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
1595−
1596−func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
1597− var msg Msghdr
1598− var rsa RawSockaddrAny
1599− msg.Name = (*byte)(unsafe.Pointer(&rsa))
1600− msg.Namelen = uint32(SizeofSockaddrAny)
1601− var iov Iovec
1602− if len(p) > 0 {
1603− iov.Base = &p[0]
1604− iov.SetLen(len(p))
1605− }
1606− var dummy byte
1607− if len(oob) > 0 {
1608− if len(p) == 0 {
1609− var sockType int
1610− sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
1611− if err != nil {
1612− return
1613− }
1614− // receive at least one normal byte
1615− if sockType != SOCK_DGRAM {
1616− iov.Base = &dummy
1617− iov.SetLen(1)
1618− }
1619− }
1620− msg.Control = &oob[0]
1621− msg.SetControllen(len(oob))
1622− }
1623− msg.Iov = &iov
1624− msg.Iovlen = 1
1625− if n, err = recvmsg(fd, &msg, flags); err != nil {
1626− return
1627− }
1628− oobn = int(msg.Controllen)
1629− recvflags = int(msg.Flags)
1630− // source address is only specified if the socket is unconnected
1631− if rsa.Addr.Family != AF_UNSPEC {
1632− from, err = anyToSockaddr(fd, &rsa)
1633− }
1634− return
1635−}
1636−
1637−func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
1638− _, err = SendmsgN(fd, p, oob, to, flags)
1639− return
1640−}
1641−
1642−func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
1643− var ptr unsafe.Pointer
1644− var salen _Socklen
1645− if to != nil {
1646− var err error
1647− ptr, salen, err = to.sockaddr()
1648− if err != nil {
1649− return 0, err
1650− }
1651− }
1652− var msg Msghdr
1653− msg.Name = (*byte)(ptr)
1654− msg.Namelen = uint32(salen)
1655− var iov Iovec
1656− if len(p) > 0 {
1657− iov.Base = &p[0]
1658− iov.SetLen(len(p))
1659− }
1660− var dummy byte
1661− if len(oob) > 0 {
1662− if len(p) == 0 {
1663− var sockType int
1664− sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
1665− if err != nil {
1666− return 0, err
1667− }
1668− // send at least one normal byte
1669− if sockType != SOCK_DGRAM {
1670− iov.Base = &dummy
1671− iov.SetLen(1)
1672− }
1673− }
1674− msg.Control = &oob[0]
1675− msg.SetControllen(len(oob))
1676− }
1677− msg.Iov = &iov
1678− msg.Iovlen = 1
1679− if n, err = sendmsg(fd, &msg, flags); err != nil {
1680− return 0, err
1681− }
1682− if len(oob) > 0 && len(p) == 0 {
1683− n = 0
1684− }
1685− return n, nil
1686−}
1687−
1688−// BindToDevice binds the socket associated with fd to device.
1689−func BindToDevice(fd int, device string) (err error) {
1690− return SetsockoptString(fd, SOL_SOCKET, SO_BINDTODEVICE, device)
1691−}
1692−
1693−//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
1694−
1695−func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) {
1696− // The peek requests are machine-size oriented, so we wrap it
1697− // to retrieve arbitrary-length data.
1698−
1699− // The ptrace syscall differs from glibc's ptrace.
1700− // Peeks returns the word in *data, not as the return value.
1701−
1702− var buf [SizeofPtr]byte
1703−
1704− // Leading edge. PEEKTEXT/PEEKDATA don't require aligned
1705− // access (PEEKUSER warns that it might), but if we don't
1706− // align our reads, we might straddle an unmapped page
1707− // boundary and not get the bytes leading up to the page
1708− // boundary.
1709− n := 0
1710− if addr%SizeofPtr != 0 {
1711− err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
1712− if err != nil {
1713− return 0, err
1714− }
1715− n += copy(out, buf[addr%SizeofPtr:])
1716− out = out[n:]
1717− }
1718−
1719− // Remainder.
1720− for len(out) > 0 {
1721− // We use an internal buffer to guarantee alignment.
1722− // It's not documented if this is necessary, but we're paranoid.
1723− err = ptrace(req, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
1724− if err != nil {
1725− return n, err
1726− }
1727− copied := copy(out, buf[0:])
1728− n += copied
1729− out = out[copied:]
1730− }
1731−
1732− return n, nil
1733−}
1734−
1735−func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) {
1736− return ptracePeek(PTRACE_PEEKTEXT, pid, addr, out)
1737−}
1738−
1739−func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
1740− return ptracePeek(PTRACE_PEEKDATA, pid, addr, out)
1741−}
1742−
1743−func PtracePeekUser(pid int, addr uintptr, out []byte) (count int, err error) {
1744− return ptracePeek(PTRACE_PEEKUSR, pid, addr, out)
1745−}
1746−
1747−func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (count int, err error) {
1748− // As for ptracePeek, we need to align our accesses to deal
1749− // with the possibility of straddling an invalid page.
1750−
1751− // Leading edge.
1752− n := 0
1753− if addr%SizeofPtr != 0 {
1754− var buf [SizeofPtr]byte
1755− err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
1756− if err != nil {
1757− return 0, err
1758− }
1759− n += copy(buf[addr%SizeofPtr:], data)
1760− word := *((*uintptr)(unsafe.Pointer(&buf[0])))
1761− err = ptrace(pokeReq, pid, addr-addr%SizeofPtr, word)
1762− if err != nil {
1763− return 0, err
1764− }
1765− data = data[n:]
1766− }
1767−
1768− // Interior.
1769− for len(data) > SizeofPtr {
1770− word := *((*uintptr)(unsafe.Pointer(&data[0])))
1771− err = ptrace(pokeReq, pid, addr+uintptr(n), word)
1772− if err != nil {
1773− return n, err
1774− }
1775− n += SizeofPtr
1776− data = data[SizeofPtr:]
1777− }
1778−
1779− // Trailing edge.
1780− if len(data) > 0 {
1781− var buf [SizeofPtr]byte
1782− err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
1783− if err != nil {
1784− return n, err
1785− }
1786− copy(buf[0:], data)
1787− word := *((*uintptr)(unsafe.Pointer(&buf[0])))
1788− err = ptrace(pokeReq, pid, addr+uintptr(n), word)
1789− if err != nil {
1790− return n, err
1791− }
1792− n += len(data)
1793− }
1794−
1795− return n, nil
1796−}
1797−
1798−func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) {
1799− return ptracePoke(PTRACE_POKETEXT, PTRACE_PEEKTEXT, pid, addr, data)
1800−}
1801−
1802−func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) {
1803− return ptracePoke(PTRACE_POKEDATA, PTRACE_PEEKDATA, pid, addr, data)
1804−}
1805−
1806−func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
1807− return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
1808−}
1809−
1810−func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
1811− return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
1812−}
1813−
1814−func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
1815− return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
1816−}
1817−
1818−func PtraceSetOptions(pid int, options int) (err error) {
1819− return ptrace(PTRACE_SETOPTIONS, pid, 0, uintptr(options))
1820−}
1821−
1822−func PtraceGetEventMsg(pid int) (msg uint, err error) {
1823− var data _C_long
1824− err = ptrace(PTRACE_GETEVENTMSG, pid, 0, uintptr(unsafe.Pointer(&data)))
1825− msg = uint(data)
1826− return
1827−}
1828−
1829−func PtraceCont(pid int, signal int) (err error) {
1830− return ptrace(PTRACE_CONT, pid, 0, uintptr(signal))
1831−}
1832−
1833−func PtraceSyscall(pid int, signal int) (err error) {
1834− return ptrace(PTRACE_SYSCALL, pid, 0, uintptr(signal))
1835−}
1836−
1837−func PtraceSingleStep(pid int) (err error) { return ptrace(PTRACE_SINGLESTEP, pid, 0, 0) }
1838−
1839−func PtraceInterrupt(pid int) (err error) { return ptrace(PTRACE_INTERRUPT, pid, 0, 0) }
1840−
1841−func PtraceAttach(pid int) (err error) { return ptrace(PTRACE_ATTACH, pid, 0, 0) }
1842−
1843−func PtraceSeize(pid int) (err error) { return ptrace(PTRACE_SEIZE, pid, 0, 0) }
1844−
1845−func PtraceDetach(pid int) (err error) { return ptrace(PTRACE_DETACH, pid, 0, 0) }
1846−
1847−//sys reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error)
1848−
1849−func Reboot(cmd int) (err error) {
1850− return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "")
1851−}
1852−
1853−func direntIno(buf []byte) (uint64, bool) {
1854− return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
1855−}
1856−
1857−func direntReclen(buf []byte) (uint64, bool) {
1858− return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
1859−}
1860−
1861−func direntNamlen(buf []byte) (uint64, bool) {
1862− reclen, ok := direntReclen(buf)
1863− if !ok {
1864− return 0, false
1865− }
1866− return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
1867−}
1868−
1869−//sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error)
1870−
1871−func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
1872− // Certain file systems get rather angry and EINVAL if you give
1873− // them an empty string of data, rather than NULL.
1874− if data == "" {
1875− return mount(source, target, fstype, flags, nil)
1876− }
1877− datap, err := BytePtrFromString(data)
1878− if err != nil {
1879− return err
1880− }
1881− return mount(source, target, fstype, flags, datap)
1882−}
1883−
1884−func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
1885− if raceenabled {
1886− raceReleaseMerge(unsafe.Pointer(&ioSync))
1887− }
1888− return sendfile(outfd, infd, offset, count)
1889−}
1890−
1891−// Sendto
1892−// Recvfrom
1893−// Socketpair
1894−
1895−/*
1896− * Direct access
1897− */
1898−//sys Acct(path string) (err error)
1899−//sys AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error)
1900−//sys Adjtimex(buf *Timex) (state int, err error)
1901−//sysnb Capget(hdr *CapUserHeader, data *CapUserData) (err error)
1902−//sysnb Capset(hdr *CapUserHeader, data *CapUserData) (err error)
1903−//sys Chdir(path string) (err error)
1904−//sys Chroot(path string) (err error)
1905−//sys ClockGetres(clockid int32, res *Timespec) (err error)
1906−//sys ClockGettime(clockid int32, time *Timespec) (err error)
1907−//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
1908−//sys Close(fd int) (err error)
1909−//sys CloseRange(first uint, last uint, flags uint) (err error)
1910−//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
1911−//sys DeleteModule(name string, flags int) (err error)
1912−//sys Dup(oldfd int) (fd int, err error)
1913−
1914−func Dup2(oldfd, newfd int) error {
1915− // Android O and newer blocks dup2; riscv and arm64 don't implement dup2.
1916− if runtime.GOOS == "android" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "arm64" {
1917− return Dup3(oldfd, newfd, 0)
1918− }
1919− return dup2(oldfd, newfd)
1920−}
1921−
1922−//sys Dup3(oldfd int, newfd int, flags int) (err error)
1923−//sysnb EpollCreate1(flag int) (fd int, err error)
1924−//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
1925−//sys Eventfd(initval uint, flags int) (fd int, err error) = SYS_EVENTFD2
1926−//sys Exit(code int) = SYS_EXIT_GROUP
1927−//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
1928−//sys Fchdir(fd int) (err error)
1929−//sys Fchmod(fd int, mode uint32) (err error)
1930−//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
1931−//sys Fdatasync(fd int) (err error)
1932−//sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error)
1933−//sys FinitModule(fd int, params string, flags int) (err error)
1934−//sys Flistxattr(fd int, dest []byte) (sz int, err error)
1935−//sys Flock(fd int, how int) (err error)
1936−//sys Fremovexattr(fd int, attr string) (err error)
1937−//sys Fsetxattr(fd int, attr string, dest []byte, flags int) (err error)
1938−//sys Fsync(fd int) (err error)
1939−//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
1940−//sysnb Getpgid(pid int) (pgid int, err error)
1941−
1942−func Getpgrp() (pid int) {
1943− pid, _ = Getpgid(0)
1944− return
1945−}
1946−
1947−//sysnb Getpid() (pid int)
1948−//sysnb Getppid() (ppid int)
1949−//sys Getpriority(which int, who int) (prio int, err error)
1950−//sys Getrandom(buf []byte, flags int) (n int, err error)
1951−//sysnb Getrusage(who int, rusage *Rusage) (err error)
1952−//sysnb Getsid(pid int) (sid int, err error)
1953−//sysnb Gettid() (tid int)
1954−//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
1955−//sys InitModule(moduleImage []byte, params string) (err error)
1956−//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
1957−//sysnb InotifyInit1(flags int) (fd int, err error)
1958−//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
1959−//sysnb Kill(pid int, sig syscall.Signal) (err error)
1960−//sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG
1961−//sys Lgetxattr(path string, attr string, dest []byte) (sz int, err error)
1962−//sys Listxattr(path string, dest []byte) (sz int, err error)
1963−//sys Llistxattr(path string, dest []byte) (sz int, err error)
1964−//sys Lremovexattr(path string, attr string) (err error)
1965−//sys Lsetxattr(path string, attr string, data []byte, flags int) (err error)
1966−//sys MemfdCreate(name string, flags int) (fd int, err error)
1967−//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
1968−//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
1969−//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
1970−//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
1971−//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
1972−//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
1973−//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
1974−//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
1975−//sys read(fd int, p []byte) (n int, err error)
1976−//sys Removexattr(path string, attr string) (err error)
1977−//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
1978−//sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
1979−//sys Setdomainname(p []byte) (err error)
1980−//sys Sethostname(p []byte) (err error)
1981−//sysnb Setpgid(pid int, pgid int) (err error)
1982−//sysnb Setsid() (pid int, err error)
1983−//sysnb Settimeofday(tv *Timeval) (err error)
1984−//sys Setns(fd int, nstype int) (err error)
1985−
1986−// PrctlRetInt performs a prctl operation specified by option and further
1987−// optional arguments arg2 through arg5 depending on option. It returns a
1988−// non-negative integer that is returned by the prctl syscall.
1989−func PrctlRetInt(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (int, error) {
1990− ret, _, err := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
1991− if err != 0 {
1992− return 0, err
1993− }
1994− return int(ret), nil
1995−}
1996−
1997−// issue 1435.
1998−// On linux Setuid and Setgid only affects the current thread, not the process.
1999−// This does not match what most callers expect so we must return an error
2000−// here rather than letting the caller think that the call succeeded.
2001−
2002−func Setuid(uid int) (err error) {
2003− return EOPNOTSUPP
2004−}
2005−
2006−func Setgid(uid int) (err error) {
2007− return EOPNOTSUPP
2008−}
2009−
2010−// SetfsgidRetGid sets fsgid for current thread and returns previous fsgid set.
2011−// setfsgid(2) will return a non-nil error only if its caller lacks CAP_SETUID capability.
2012−// If the call fails due to other reasons, current fsgid will be returned.
2013−func SetfsgidRetGid(gid int) (int, error) {
2014− return setfsgid(gid)
2015−}
2016−
2017−// SetfsuidRetUid sets fsuid for current thread and returns previous fsuid set.
2018−// setfsgid(2) will return a non-nil error only if its caller lacks CAP_SETUID capability
2019−// If the call fails due to other reasons, current fsuid will be returned.
2020−func SetfsuidRetUid(uid int) (int, error) {
2021− return setfsuid(uid)
2022−}
2023−
2024−func Setfsgid(gid int) error {
2025− _, err := setfsgid(gid)
2026− return err
2027−}
2028−
2029−func Setfsuid(uid int) error {
2030− _, err := setfsuid(uid)
2031− return err
2032−}
2033−
2034−func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
2035− return signalfd(fd, sigmask, _C__NSIG/8, flags)
2036−}
2037−
2038−//sys Setpriority(which int, who int, prio int) (err error)
2039−//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
2040−//sys signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) = SYS_SIGNALFD4
2041−//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
2042−//sys Sync()
2043−//sys Syncfs(fd int) (err error)
2044−//sysnb Sysinfo(info *Sysinfo_t) (err error)
2045−//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
2046−//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error)
2047−//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error)
2048−//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error)
2049−//sysnb Tgkill(tgid int, tid int, sig syscall.Signal) (err error)
2050−//sysnb Times(tms *Tms) (ticks uintptr, err error)
2051−//sysnb Umask(mask int) (oldmask int)
2052−//sysnb Uname(buf *Utsname) (err error)
2053−//sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2
2054−//sys Unshare(flags int) (err error)
2055−//sys write(fd int, p []byte) (n int, err error)
2056−//sys exitThread(code int) (err error) = SYS_EXIT
2057−//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
2058−//sys writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE
2059−//sys readv(fd int, iovs []Iovec) (n int, err error) = SYS_READV
2060−//sys writev(fd int, iovs []Iovec) (n int, err error) = SYS_WRITEV
2061−//sys preadv(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PREADV
2062−//sys pwritev(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PWRITEV
2063−//sys preadv2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PREADV2
2064−//sys pwritev2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PWRITEV2
2065−
2066−func bytes2iovec(bs [][]byte) []Iovec {
2067− iovecs := make([]Iovec, len(bs))
2068− for i, b := range bs {
2069− iovecs[i].SetLen(len(b))
2070− if len(b) > 0 {
2071− iovecs[i].Base = &b[0]
2072− } else {
2073− iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero))
2074− }
2075− }
2076− return iovecs
2077−}
2078−
2079−// offs2lohi splits offs into its lower and upper unsigned long. On 64-bit
2080−// systems, hi will always be 0. On 32-bit systems, offs will be split in half.
2081−// preadv/pwritev chose this calling convention so they don't need to add a
2082−// padding-register for alignment on ARM.
2083−func offs2lohi(offs int64) (lo, hi uintptr) {
2084− return uintptr(offs), uintptr(uint64(offs) >> SizeofLong)
2085−}
2086−
2087−func Readv(fd int, iovs [][]byte) (n int, err error) {
2088− iovecs := bytes2iovec(iovs)
2089− n, err = readv(fd, iovecs)
2090− readvRacedetect(iovecs, n, err)
2091− return n, err
2092−}
2093−
2094−func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) {
2095− iovecs := bytes2iovec(iovs)
2096− lo, hi := offs2lohi(offset)
2097− n, err = preadv(fd, iovecs, lo, hi)
2098− readvRacedetect(iovecs, n, err)
2099− return n, err
2100−}
2101−
2102−func Preadv2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {
2103− iovecs := bytes2iovec(iovs)
2104− lo, hi := offs2lohi(offset)
2105− n, err = preadv2(fd, iovecs, lo, hi, flags)
2106− readvRacedetect(iovecs, n, err)
2107− return n, err
2108−}
2109−
2110−func readvRacedetect(iovecs []Iovec, n int, err error) {
2111− if !raceenabled {
2112− return
2113− }
2114− for i := 0; n > 0 && i < len(iovecs); i++ {
2115− m := int(iovecs[i].Len)
2116− if m > n {
2117− m = n
2118− }
2119− n -= m
2120− if m > 0 {
2121− raceWriteRange(unsafe.Pointer(iovecs[i].Base), m)
2122− }
2123− }
2124− if err == nil {
2125− raceAcquire(unsafe.Pointer(&ioSync))
2126− }
2127−}
2128−
2129−func Writev(fd int, iovs [][]byte) (n int, err error) {
2130− iovecs := bytes2iovec(iovs)
2131− if raceenabled {
2132− raceReleaseMerge(unsafe.Pointer(&ioSync))
2133− }
2134− n, err = writev(fd, iovecs)
2135− writevRacedetect(iovecs, n)
2136− return n, err
2137−}
2138−
2139−func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) {
2140− iovecs := bytes2iovec(iovs)
2141− if raceenabled {
2142− raceReleaseMerge(unsafe.Pointer(&ioSync))
2143− }
2144− lo, hi := offs2lohi(offset)
2145− n, err = pwritev(fd, iovecs, lo, hi)
2146− writevRacedetect(iovecs, n)
2147− return n, err
2148−}
2149−
2150−func Pwritev2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {
2151− iovecs := bytes2iovec(iovs)
2152− if raceenabled {
2153− raceReleaseMerge(unsafe.Pointer(&ioSync))
2154− }
2155− lo, hi := offs2lohi(offset)
2156− n, err = pwritev2(fd, iovecs, lo, hi, flags)
2157− writevRacedetect(iovecs, n)
2158− return n, err
2159−}
2160−
2161−func writevRacedetect(iovecs []Iovec, n int) {
2162− if !raceenabled {
2163− return
2164− }
2165− for i := 0; n > 0 && i < len(iovecs); i++ {
2166− m := int(iovecs[i].Len)
2167− if m > n {
2168− m = n
2169− }
2170− n -= m
2171− if m > 0 {
2172− raceReadRange(unsafe.Pointer(iovecs[i].Base), m)
2173− }
2174− }
2175−}
2176−
2177−// mmap varies by architecture; see syscall_linux_*.go.
2178−//sys munmap(addr uintptr, length uintptr) (err error)
2179−
2180−var mapper = &mmapper{
2181− active: make(map[*byte][]byte),
2182− mmap: mmap,
2183− munmap: munmap,
2184−}
2185−
2186−func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
2187− return mapper.Mmap(fd, offset, length, prot, flags)
2188−}
2189−
2190−func Munmap(b []byte) (err error) {
2191− return mapper.Munmap(b)
2192−}
2193−
2194−//sys Madvise(b []byte, advice int) (err error)
2195−//sys Mprotect(b []byte, prot int) (err error)
2196−//sys Mlock(b []byte) (err error)
2197−//sys Mlockall(flags int) (err error)
2198−//sys Msync(b []byte, flags int) (err error)
2199−//sys Munlock(b []byte) (err error)
2200−//sys Munlockall() (err error)
2201−
2202−// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
2203−// using the specified flags.
2204−func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
2205− var p unsafe.Pointer
2206− if len(iovs) > 0 {
2207− p = unsafe.Pointer(&iovs[0])
2208− }
2209−
2210− n, _, errno := Syscall6(SYS_VMSPLICE, uintptr(fd), uintptr(p), uintptr(len(iovs)), uintptr(flags), 0, 0)
2211− if errno != 0 {
2212− return 0, syscall.Errno(errno)
2213− }
2214−
2215− return int(n), nil
2216−}
2217−
2218−func isGroupMember(gid int) bool {
2219− groups, err := Getgroups()
2220− if err != nil {
2221− return false
2222− }
2223−
2224− for _, g := range groups {
2225− if g == gid {
2226− return true
2227− }
2228− }
2229− return false
2230−}
2231−
2232−//sys faccessat(dirfd int, path string, mode uint32) (err error)
2233−//sys Faccessat2(dirfd int, path string, mode uint32, flags int) (err error)
2234−
2235−func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
2236− if flags == 0 {
2237− return faccessat(dirfd, path, mode)
2238− }
2239−
2240− if err := Faccessat2(dirfd, path, mode, flags); err != ENOSYS && err != EPERM {
2241− return err
2242− }
2243−
2244− // The Linux kernel faccessat system call does not take any flags.
2245− // The glibc faccessat implements the flags itself; see
2246− // https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/faccessat.c;hb=HEAD
2247− // Because people naturally expect syscall.Faccessat to act
2248− // like C faccessat, we do the same.
2249−
2250− if flags & ^(AT_SYMLINK_NOFOLLOW|AT_EACCESS) != 0 {
2251− return EINVAL
2252− }
2253−
2254− var st Stat_t
2255− if err := Fstatat(dirfd, path, &st, flags&AT_SYMLINK_NOFOLLOW); err != nil {
2256− return err
2257− }
2258−
2259− mode &= 7
2260− if mode == 0 {
2261− return nil
2262− }
2263−
2264− var uid int
2265− if flags&AT_EACCESS != 0 {
2266− uid = Geteuid()
2267− } else {
2268− uid = Getuid()
2269− }
2270−
2271− if uid == 0 {
2272− if mode&1 == 0 {
2273− // Root can read and write any file.
2274− return nil
2275− }
2276− if st.Mode&0111 != 0 {
2277− // Root can execute any file that anybody can execute.
2278− return nil
2279− }
2280− return EACCES
2281− }
2282−
2283− var fmode uint32
2284− if uint32(uid) == st.Uid {
2285− fmode = (st.Mode >> 6) & 7
2286− } else {
2287− var gid int
2288− if flags&AT_EACCESS != 0 {
2289− gid = Getegid()
2290− } else {
2291− gid = Getgid()
2292− }
2293−
2294− if uint32(gid) == st.Gid || isGroupMember(gid) {
2295− fmode = (st.Mode >> 3) & 7
2296− } else {
2297− fmode = st.Mode & 7
2298− }
2299− }
2300−
2301− if fmode&mode == mode {
2302− return nil
2303− }
2304−
2305− return EACCES
2306−}
2307−
2308−//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT
2309−//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT
2310−
2311−// fileHandle is the argument to nameToHandleAt and openByHandleAt. We
2312−// originally tried to generate it via unix/linux/types.go with "type
2313−// fileHandle C.struct_file_handle" but that generated empty structs
2314−// for mips64 and mips64le. Instead, hard code it for now (it's the
2315−// same everywhere else) until the mips64 generator issue is fixed.
2316−type fileHandle struct {
2317− Bytes uint32
2318− Type int32
2319−}
2320−
2321−// FileHandle represents the C struct file_handle used by
2322−// name_to_handle_at (see NameToHandleAt) and open_by_handle_at (see
2323−// OpenByHandleAt).
2324−type FileHandle struct {
2325− *fileHandle
2326−}
2327−
2328−// NewFileHandle constructs a FileHandle.
2329−func NewFileHandle(handleType int32, handle []byte) FileHandle {
2330− const hdrSize = unsafe.Sizeof(fileHandle{})
2331− buf := make([]byte, hdrSize+uintptr(len(handle)))
2332− copy(buf[hdrSize:], handle)
2333− fh := (*fileHandle)(unsafe.Pointer(&buf[0]))
2334− fh.Type = handleType
2335− fh.Bytes = uint32(len(handle))
2336− return FileHandle{fh}
2337−}
2338−
2339−func (fh *FileHandle) Size() int { return int(fh.fileHandle.Bytes) }
2340−func (fh *FileHandle) Type() int32 { return fh.fileHandle.Type }
2341−func (fh *FileHandle) Bytes() []byte {
2342− n := fh.Size()
2343− if n == 0 {
2344− return nil
2345− }
2346− return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n]
2347−}
2348−
2349−// NameToHandleAt wraps the name_to_handle_at system call; it obtains
2350−// a handle for a path name.
2351−func NameToHandleAt(dirfd int, path string, flags int) (handle FileHandle, mountID int, err error) {
2352− var mid _C_int
2353− // Try first with a small buffer, assuming the handle will
2354− // only be 32 bytes.
2355− size := uint32(32 + unsafe.Sizeof(fileHandle{}))
2356− didResize := false
2357− for {
2358− buf := make([]byte, size)
2359− fh := (*fileHandle)(unsafe.Pointer(&buf[0]))
2360− fh.Bytes = size - uint32(unsafe.Sizeof(fileHandle{}))
2361− err = nameToHandleAt(dirfd, path, fh, &mid, flags)
2362− if err == EOVERFLOW {
2363− if didResize {
2364− // We shouldn't need to resize more than once
2365− return
2366− }
2367− didResize = true
2368− size = fh.Bytes + uint32(unsafe.Sizeof(fileHandle{}))
2369− continue
2370− }
2371− if err != nil {
2372− return
2373− }
2374− return FileHandle{fh}, int(mid), nil
2375− }
2376−}
2377−
2378−// OpenByHandleAt wraps the open_by_handle_at system call; it opens a
2379−// file via a handle as previously returned by NameToHandleAt.
2380−func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err error) {
2381− return openByHandleAt(mountFD, handle.fileHandle, flags)
2382−}
2383−
2384−// Klogset wraps the sys_syslog system call; it sets console_loglevel to
2385−// the value specified by arg and passes a dummy pointer to bufp.
2386−func Klogset(typ int, arg int) (err error) {
2387− var p unsafe.Pointer
2388− _, _, errno := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(p), uintptr(arg))
2389− if errno != 0 {
2390− return errnoErr(errno)
2391− }
2392− return nil
2393−}
2394−
2395−// RemoteIovec is Iovec with the pointer replaced with an integer.
2396−// It is used for ProcessVMReadv and ProcessVMWritev, where the pointer
2397−// refers to a location in a different process' address space, which
2398−// would confuse the Go garbage collector.
2399−type RemoteIovec struct {
2400− Base uintptr
2401− Len int
2402−}
2403−
2404−//sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV
2405−//sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV
2406−
2407−/*
2408− * Unimplemented
2409− */
2410−// AfsSyscall
2411−// Alarm
2412−// ArchPrctl
2413−// Brk
2414−// ClockNanosleep
2415−// ClockSettime
2416−// Clone
2417−// EpollCtlOld
2418−// EpollPwait
2419−// EpollWaitOld
2420−// Execve
2421−// Fork
2422−// Futex
2423−// GetKernelSyms
2424−// GetMempolicy
2425−// GetRobustList
2426−// GetThreadArea
2427−// Getitimer
2428−// Getpmsg
2429−// IoCancel
2430−// IoDestroy
2431−// IoGetevents
2432−// IoSetup
2433−// IoSubmit
2434−// IoprioGet
2435−// IoprioSet
2436−// KexecLoad
2437−// LookupDcookie
2438−// Mbind
2439−// MigratePages
2440−// Mincore
2441−// ModifyLdt
2442−// Mount
2443−// MovePages
2444−// MqGetsetattr
2445−// MqNotify
2446−// MqOpen
2447−// MqTimedreceive
2448−// MqTimedsend
2449−// MqUnlink
2450−// Mremap
2451−// Msgctl
2452−// Msgget
2453−// Msgrcv
2454−// Msgsnd
2455−// Nfsservctl
2456−// Personality
2457−// Pselect6
2458−// Ptrace
2459−// Putpmsg
2460−// Quotactl
2461−// Readahead
2462−// Readv
2463−// RemapFilePages
2464−// RestartSyscall
2465−// RtSigaction
2466−// RtSigpending
2467−// RtSigprocmask
2468−// RtSigqueueinfo
2469−// RtSigreturn
2470−// RtSigsuspend
2471−// RtSigtimedwait
2472−// SchedGetPriorityMax
2473−// SchedGetPriorityMin
2474−// SchedGetparam
2475−// SchedGetscheduler
2476−// SchedRrGetInterval
2477−// SchedSetparam
2478−// SchedYield
2479−// Security
2480−// Semctl
2481−// Semget
2482−// Semop
2483−// Semtimedop
2484−// SetMempolicy
2485−// SetRobustList
2486−// SetThreadArea
2487−// SetTidAddress
2488−// Shmat
2489−// Shmctl
2490−// Shmdt
2491−// Shmget
2492−// Sigaltstack
2493−// Swapoff
2494−// Swapon
2495−// Sysfs
2496−// TimerCreate
2497−// TimerDelete
2498−// TimerGetoverrun
2499−// TimerGettime
2500−// TimerSettime
2501−// Tkill (obsolete)
2502−// Tuxcall
2503−// Umount2
2504−// Uselib
2505−// Utimensat
2506−// Vfork
2507−// Vhangup
2508−// Vserver
2509−// Waitid
2510−// _Sysctl
vendor/golang.org/x/sys/unix/syscall_linux_386.godeleted−388
@@ -1,388 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build 386 && linux
6−// +build 386,linux
7−
8−package unix
9−
10−import (
11− "unsafe"
12−)
13−
14−func setTimespec(sec, nsec int64) Timespec {
15− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
16−}
17−
18−func setTimeval(sec, usec int64) Timeval {
19− return Timeval{Sec: int32(sec), Usec: int32(usec)}
20−}
21−
22−//sysnb pipe(p *[2]_C_int) (err error)
23−
24−func Pipe(p []int) (err error) {
25− if len(p) != 2 {
26− return EINVAL
27− }
28− var pp [2]_C_int
29− err = pipe(&pp)
30− p[0] = int(pp[0])
31− p[1] = int(pp[1])
32− return
33−}
34−
35−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
36−
37−func Pipe2(p []int, flags int) (err error) {
38− if len(p) != 2 {
39− return EINVAL
40− }
41− var pp [2]_C_int
42− err = pipe2(&pp, flags)
43− p[0] = int(pp[0])
44− p[1] = int(pp[1])
45− return
46−}
47−
48−// 64-bit file system and 32-bit uid calls
49−// (386 default is 32-bit file system and 16-bit uid).
50−//sys dup2(oldfd int, newfd int) (err error)
51−//sysnb EpollCreate(size int) (fd int, err error)
52−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
53−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
54−//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
55−//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
56−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
57−//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
58−//sysnb Getegid() (egid int) = SYS_GETEGID32
59−//sysnb Geteuid() (euid int) = SYS_GETEUID32
60−//sysnb Getgid() (gid int) = SYS_GETGID32
61−//sysnb Getuid() (uid int) = SYS_GETUID32
62−//sysnb InotifyInit() (fd int, err error)
63−//sys Ioperm(from int, num int, on int) (err error)
64−//sys Iopl(level int) (err error)
65−//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
66−//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
67−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
68−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
69−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
70−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
71−//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
72−//sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32
73−//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32
74−//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32
75−//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32
76−//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32
77−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
78−//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
79−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
80−//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
81−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
82−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32
83−//sysnb setgroups(n int, list *_Gid_t) (err error) = SYS_SETGROUPS32
84−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
85−
86−//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
87−//sys Pause() (err error)
88−
89−func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
90− page := uintptr(offset / 4096)
91− if offset != int64(page)*4096 {
92− return 0, EINVAL
93− }
94− return mmap2(addr, length, prot, flags, fd, page)
95−}
96−
97−type rlimit32 struct {
98− Cur uint32
99− Max uint32
100−}
101−
102−//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
103−
104−const rlimInf32 = ^uint32(0)
105−const rlimInf64 = ^uint64(0)
106−
107−func Getrlimit(resource int, rlim *Rlimit) (err error) {
108− err = prlimit(0, resource, nil, rlim)
109− if err != ENOSYS {
110− return err
111− }
112−
113− rl := rlimit32{}
114− err = getrlimit(resource, &rl)
115− if err != nil {
116− return
117− }
118−
119− if rl.Cur == rlimInf32 {
120− rlim.Cur = rlimInf64
121− } else {
122− rlim.Cur = uint64(rl.Cur)
123− }
124−
125− if rl.Max == rlimInf32 {
126− rlim.Max = rlimInf64
127− } else {
128− rlim.Max = uint64(rl.Max)
129− }
130− return
131−}
132−
133−//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
134−
135−func Setrlimit(resource int, rlim *Rlimit) (err error) {
136− err = prlimit(0, resource, rlim, nil)
137− if err != ENOSYS {
138− return err
139− }
140−
141− rl := rlimit32{}
142− if rlim.Cur == rlimInf64 {
143− rl.Cur = rlimInf32
144− } else if rlim.Cur < uint64(rlimInf32) {
145− rl.Cur = uint32(rlim.Cur)
146− } else {
147− return EINVAL
148− }
149− if rlim.Max == rlimInf64 {
150− rl.Max = rlimInf32
151− } else if rlim.Max < uint64(rlimInf32) {
152− rl.Max = uint32(rlim.Max)
153− } else {
154− return EINVAL
155− }
156−
157− return setrlimit(resource, &rl)
158−}
159−
160−func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
161− newoffset, errno := seek(fd, offset, whence)
162− if errno != 0 {
163− return 0, errno
164− }
165− return newoffset, nil
166−}
167−
168−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
169−//sysnb Gettimeofday(tv *Timeval) (err error)
170−//sysnb Time(t *Time_t) (tt Time_t, err error)
171−//sys Utime(path string, buf *Utimbuf) (err error)
172−//sys utimes(path string, times *[2]Timeval) (err error)
173−
174−// On x86 Linux, all the socket calls go through an extra indirection,
175−// I think because the 5-register system call interface can't handle
176−// the 6-argument calls like sendto and recvfrom. Instead the
177−// arguments to the underlying system call are the number below
178−// and a pointer to an array of uintptr. We hide the pointer in the
179−// socketcall assembly to avoid allocation on every system call.
180−
181−const (
182− // see linux/net.h
183− _SOCKET = 1
184− _BIND = 2
185− _CONNECT = 3
186− _LISTEN = 4
187− _ACCEPT = 5
188− _GETSOCKNAME = 6
189− _GETPEERNAME = 7
190− _SOCKETPAIR = 8
191− _SEND = 9
192− _RECV = 10
193− _SENDTO = 11
194− _RECVFROM = 12
195− _SHUTDOWN = 13
196− _SETSOCKOPT = 14
197− _GETSOCKOPT = 15
198− _SENDMSG = 16
199− _RECVMSG = 17
200− _ACCEPT4 = 18
201− _RECVMMSG = 19
202− _SENDMMSG = 20
203−)
204−
205−func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
206− fd, e := socketcall(_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
207− if e != 0 {
208− err = e
209− }
210− return
211−}
212−
213−func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
214− fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
215− if e != 0 {
216− err = e
217− }
218− return
219−}
220−
221−func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
222− _, e := rawsocketcall(_GETSOCKNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
223− if e != 0 {
224− err = e
225− }
226− return
227−}
228−
229−func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
230− _, e := rawsocketcall(_GETPEERNAME, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
231− if e != 0 {
232− err = e
233− }
234− return
235−}
236−
237−func socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
238− _, e := rawsocketcall(_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd)), 0, 0)
239− if e != 0 {
240− err = e
241− }
242− return
243−}
244−
245−func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
246− _, e := socketcall(_BIND, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
247− if e != 0 {
248− err = e
249− }
250− return
251−}
252−
253−func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
254− _, e := socketcall(_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
255− if e != 0 {
256− err = e
257− }
258− return
259−}
260−
261−func socket(domain int, typ int, proto int) (fd int, err error) {
262− fd, e := rawsocketcall(_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
263− if e != 0 {
264− err = e
265− }
266− return
267−}
268−
269−func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
270− _, e := socketcall(_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
271− if e != 0 {
272− err = e
273− }
274− return
275−}
276−
277−func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
278− _, e := socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen, 0)
279− if e != 0 {
280− err = e
281− }
282− return
283−}
284−
285−func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
286− var base uintptr
287− if len(p) > 0 {
288− base = uintptr(unsafe.Pointer(&p[0]))
289− }
290− n, e := socketcall(_RECVFROM, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
291− if e != 0 {
292− err = e
293− }
294− return
295−}
296−
297−func sendto(s int, p []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
298− var base uintptr
299− if len(p) > 0 {
300− base = uintptr(unsafe.Pointer(&p[0]))
301− }
302− _, e := socketcall(_SENDTO, uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen))
303− if e != 0 {
304− err = e
305− }
306− return
307−}
308−
309−func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
310− n, e := socketcall(_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
311− if e != 0 {
312− err = e
313− }
314− return
315−}
316−
317−func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
318− n, e := socketcall(_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
319− if e != 0 {
320− err = e
321− }
322− return
323−}
324−
325−func Listen(s int, n int) (err error) {
326− _, e := socketcall(_LISTEN, uintptr(s), uintptr(n), 0, 0, 0, 0)
327− if e != 0 {
328− err = e
329− }
330− return
331−}
332−
333−func Shutdown(s, how int) (err error) {
334− _, e := socketcall(_SHUTDOWN, uintptr(s), uintptr(how), 0, 0, 0, 0)
335− if e != 0 {
336− err = e
337− }
338− return
339−}
340−
341−func Fstatfs(fd int, buf *Statfs_t) (err error) {
342− _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
343− if e != 0 {
344− err = e
345− }
346− return
347−}
348−
349−func Statfs(path string, buf *Statfs_t) (err error) {
350− pathp, err := BytePtrFromString(path)
351− if err != nil {
352− return err
353− }
354− _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
355− if e != 0 {
356− err = e
357− }
358− return
359−}
360−
361−func (r *PtraceRegs) PC() uint64 { return uint64(uint32(r.Eip)) }
362−
363−func (r *PtraceRegs) SetPC(pc uint64) { r.Eip = int32(pc) }
364−
365−func (iov *Iovec) SetLen(length int) {
366− iov.Len = uint32(length)
367−}
368−
369−func (msghdr *Msghdr) SetControllen(length int) {
370− msghdr.Controllen = uint32(length)
371−}
372−
373−func (msghdr *Msghdr) SetIovlen(length int) {
374− msghdr.Iovlen = uint32(length)
375−}
376−
377−func (cmsg *Cmsghdr) SetLen(length int) {
378− cmsg.Len = uint32(length)
379−}
380−
381−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
382−
383−func Poll(fds []PollFd, timeout int) (n int, err error) {
384− if len(fds) == 0 {
385− return poll(nil, 0, timeout)
386− }
387− return poll(&fds[0], len(fds), timeout)
388−}
vendor/golang.org/x/sys/unix/syscall_linux_amd64.godeleted−195
@@ -1,195 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build amd64 && linux
6−// +build amd64,linux
7−
8−package unix
9−
10−//sys dup2(oldfd int, newfd int) (err error)
11−//sysnb EpollCreate(size int) (fd int, err error)
12−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
13−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
14−//sys Fchown(fd int, uid int, gid int) (err error)
15−//sys Fstat(fd int, stat *Stat_t) (err error)
16−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
17−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
18−//sys Ftruncate(fd int, length int64) (err error)
19−//sysnb Getegid() (egid int)
20−//sysnb Geteuid() (euid int)
21−//sysnb Getgid() (gid int)
22−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
23−//sysnb Getuid() (uid int)
24−//sysnb inotifyInit() (fd int, err error)
25−
26−func InotifyInit() (fd int, err error) {
27− // First try inotify_init1, because Android's seccomp policy blocks the latter.
28− fd, err = InotifyInit1(0)
29− if err == ENOSYS {
30− fd, err = inotifyInit()
31− }
32− return
33−}
34−
35−//sys Ioperm(from int, num int, on int) (err error)
36−//sys Iopl(level int) (err error)
37−//sys Lchown(path string, uid int, gid int) (err error)
38−//sys Listen(s int, n int) (err error)
39−
40−func Lstat(path string, stat *Stat_t) (err error) {
41− return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
42−}
43−
44−//sys Pause() (err error)
45−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
46−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
47−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
48−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
49−
50−func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
51− var ts *Timespec
52− if timeout != nil {
53− ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
54− }
55− return Pselect(nfd, r, w, e, ts, nil)
56−}
57−
58−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
59−//sys setfsgid(gid int) (prev int, err error)
60−//sys setfsuid(uid int) (prev int, err error)
61−//sysnb Setregid(rgid int, egid int) (err error)
62−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
63−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
64−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
65−//sysnb Setreuid(ruid int, euid int) (err error)
66−//sys Shutdown(fd int, how int) (err error)
67−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
68−
69−func Stat(path string, stat *Stat_t) (err error) {
70− // Use fstatat, because Android's seccomp policy blocks stat.
71− return Fstatat(AT_FDCWD, path, stat, 0)
72−}
73−
74−//sys Statfs(path string, buf *Statfs_t) (err error)
75−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
76−//sys Truncate(path string, length int64) (err error)
77−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
78−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
79−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
80−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
81−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
82−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
83−//sysnb setgroups(n int, list *_Gid_t) (err error)
84−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
85−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
86−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
87−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
88−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
89−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
90−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
91−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
92−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
93−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
94−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
95−
96−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
97−
98−func Gettimeofday(tv *Timeval) (err error) {
99− errno := gettimeofday(tv)
100− if errno != 0 {
101− return errno
102− }
103− return nil
104−}
105−
106−func Time(t *Time_t) (tt Time_t, err error) {
107− var tv Timeval
108− errno := gettimeofday(&tv)
109− if errno != 0 {
110− return 0, errno
111− }
112− if t != nil {
113− *t = Time_t(tv.Sec)
114− }
115− return Time_t(tv.Sec), nil
116−}
117−
118−//sys Utime(path string, buf *Utimbuf) (err error)
119−//sys utimes(path string, times *[2]Timeval) (err error)
120−
121−func setTimespec(sec, nsec int64) Timespec {
122− return Timespec{Sec: sec, Nsec: nsec}
123−}
124−
125−func setTimeval(sec, usec int64) Timeval {
126− return Timeval{Sec: sec, Usec: usec}
127−}
128−
129−//sysnb pipe(p *[2]_C_int) (err error)
130−
131−func Pipe(p []int) (err error) {
132− if len(p) != 2 {
133− return EINVAL
134− }
135− var pp [2]_C_int
136− err = pipe(&pp)
137− p[0] = int(pp[0])
138− p[1] = int(pp[1])
139− return
140−}
141−
142−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
143−
144−func Pipe2(p []int, flags int) (err error) {
145− if len(p) != 2 {
146− return EINVAL
147− }
148− var pp [2]_C_int
149− err = pipe2(&pp, flags)
150− p[0] = int(pp[0])
151− p[1] = int(pp[1])
152− return
153−}
154−
155−func (r *PtraceRegs) PC() uint64 { return r.Rip }
156−
157−func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc }
158−
159−func (iov *Iovec) SetLen(length int) {
160− iov.Len = uint64(length)
161−}
162−
163−func (msghdr *Msghdr) SetControllen(length int) {
164− msghdr.Controllen = uint64(length)
165−}
166−
167−func (msghdr *Msghdr) SetIovlen(length int) {
168− msghdr.Iovlen = uint64(length)
169−}
170−
171−func (cmsg *Cmsghdr) SetLen(length int) {
172− cmsg.Len = uint64(length)
173−}
174−
175−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
176−
177−func Poll(fds []PollFd, timeout int) (n int, err error) {
178− if len(fds) == 0 {
179− return poll(nil, 0, timeout)
180− }
181− return poll(&fds[0], len(fds), timeout)
182−}
183−
184−//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
185−
186−func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
187− cmdlineLen := len(cmdline)
188− if cmdlineLen > 0 {
189− // Account for the additional NULL byte added by
190− // BytePtrFromString in kexecFileLoad. The kexec_file_load
191− // syscall expects a NULL-terminated string.
192− cmdlineLen++
193− }
194− return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
195−}
vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.godeleted−13
@@ -1,13 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build amd64 && linux && gc
6−// +build amd64,linux,gc
7−
8−package unix
9−
10−import "syscall"
11−
12−//go:noescape
13−func gettimeofday(tv *Timeval) (err syscall.Errno)
vendor/golang.org/x/sys/unix/syscall_linux_arm.godeleted−287
@@ -1,287 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build arm && linux
6−// +build arm,linux
7−
8−package unix
9−
10−import (
11− "unsafe"
12−)
13−
14−func setTimespec(sec, nsec int64) Timespec {
15− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
16−}
17−
18−func setTimeval(sec, usec int64) Timeval {
19− return Timeval{Sec: int32(sec), Usec: int32(usec)}
20−}
21−
22−//sysnb pipe(p *[2]_C_int) (err error)
23−
24−func Pipe(p []int) (err error) {
25− if len(p) != 2 {
26− return EINVAL
27− }
28− var pp [2]_C_int
29− // Try pipe2 first for Android O, then try pipe for kernel 2.6.23.
30− err = pipe2(&pp, 0)
31− if err == ENOSYS {
32− err = pipe(&pp)
33− }
34− p[0] = int(pp[0])
35− p[1] = int(pp[1])
36− return
37−}
38−
39−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
40−
41−func Pipe2(p []int, flags int) (err error) {
42− if len(p) != 2 {
43− return EINVAL
44− }
45− var pp [2]_C_int
46− err = pipe2(&pp, flags)
47− p[0] = int(pp[0])
48− p[1] = int(pp[1])
49− return
50−}
51−
52−func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
53− newoffset, errno := seek(fd, offset, whence)
54− if errno != 0 {
55− return 0, errno
56− }
57− return newoffset, nil
58−}
59−
60−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
61−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
62−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
63−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
64−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32
65−//sysnb setgroups(n int, list *_Gid_t) (err error) = SYS_SETGROUPS32
66−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
67−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
68−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
69−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
70−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
71−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
72−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
73−//sysnb socketpair(domain int, typ int, flags int, fd *[2]int32) (err error)
74−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
75−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
76−
77−// 64-bit file system and 32-bit uid calls
78−// (16-bit uid calls are not always supported in newer kernels)
79−//sys dup2(oldfd int, newfd int) (err error)
80−//sysnb EpollCreate(size int) (fd int, err error)
81−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
82−//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
83−//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
84−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
85−//sysnb Getegid() (egid int) = SYS_GETEGID32
86−//sysnb Geteuid() (euid int) = SYS_GETEUID32
87−//sysnb Getgid() (gid int) = SYS_GETGID32
88−//sysnb Getuid() (uid int) = SYS_GETUID32
89−//sysnb InotifyInit() (fd int, err error)
90−//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
91−//sys Listen(s int, n int) (err error)
92−//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
93−//sys Pause() (err error)
94−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
95−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
96−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
97−//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
98−//sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32
99−//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32
100−//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32
101−//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32
102−//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32
103−//sys Shutdown(fd int, how int) (err error)
104−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
105−//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
106−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
107−
108−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
109−//sysnb Gettimeofday(tv *Timeval) (err error)
110−
111−func Time(t *Time_t) (Time_t, error) {
112− var tv Timeval
113− err := Gettimeofday(&tv)
114− if err != nil {
115− return 0, err
116− }
117− if t != nil {
118− *t = Time_t(tv.Sec)
119− }
120− return Time_t(tv.Sec), nil
121−}
122−
123−func Utime(path string, buf *Utimbuf) error {
124− tv := []Timeval{
125− {Sec: buf.Actime},
126− {Sec: buf.Modtime},
127− }
128− return Utimes(path, tv)
129−}
130−
131−//sys utimes(path string, times *[2]Timeval) (err error)
132−
133−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
134−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
135−//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
136−//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
137−
138−func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
139− _, _, e1 := Syscall6(SYS_ARM_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32))
140− if e1 != 0 {
141− err = errnoErr(e1)
142− }
143− return
144−}
145−
146−//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
147−
148−func Fstatfs(fd int, buf *Statfs_t) (err error) {
149− _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
150− if e != 0 {
151− err = e
152− }
153− return
154−}
155−
156−func Statfs(path string, buf *Statfs_t) (err error) {
157− pathp, err := BytePtrFromString(path)
158− if err != nil {
159− return err
160− }
161− _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
162− if e != 0 {
163− err = e
164− }
165− return
166−}
167−
168−func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
169− page := uintptr(offset / 4096)
170− if offset != int64(page)*4096 {
171− return 0, EINVAL
172− }
173− return mmap2(addr, length, prot, flags, fd, page)
174−}
175−
176−type rlimit32 struct {
177− Cur uint32
178− Max uint32
179−}
180−
181−//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT
182−
183−const rlimInf32 = ^uint32(0)
184−const rlimInf64 = ^uint64(0)
185−
186−func Getrlimit(resource int, rlim *Rlimit) (err error) {
187− err = prlimit(0, resource, nil, rlim)
188− if err != ENOSYS {
189− return err
190− }
191−
192− rl := rlimit32{}
193− err = getrlimit(resource, &rl)
194− if err != nil {
195− return
196− }
197−
198− if rl.Cur == rlimInf32 {
199− rlim.Cur = rlimInf64
200− } else {
201− rlim.Cur = uint64(rl.Cur)
202− }
203−
204− if rl.Max == rlimInf32 {
205− rlim.Max = rlimInf64
206− } else {
207− rlim.Max = uint64(rl.Max)
208− }
209− return
210−}
211−
212−//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
213−
214−func Setrlimit(resource int, rlim *Rlimit) (err error) {
215− err = prlimit(0, resource, rlim, nil)
216− if err != ENOSYS {
217− return err
218− }
219−
220− rl := rlimit32{}
221− if rlim.Cur == rlimInf64 {
222− rl.Cur = rlimInf32
223− } else if rlim.Cur < uint64(rlimInf32) {
224− rl.Cur = uint32(rlim.Cur)
225− } else {
226− return EINVAL
227− }
228− if rlim.Max == rlimInf64 {
229− rl.Max = rlimInf32
230− } else if rlim.Max < uint64(rlimInf32) {
231− rl.Max = uint32(rlim.Max)
232− } else {
233− return EINVAL
234− }
235−
236− return setrlimit(resource, &rl)
237−}
238−
239−func (r *PtraceRegs) PC() uint64 { return uint64(r.Uregs[15]) }
240−
241−func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) }
242−
243−func (iov *Iovec) SetLen(length int) {
244− iov.Len = uint32(length)
245−}
246−
247−func (msghdr *Msghdr) SetControllen(length int) {
248− msghdr.Controllen = uint32(length)
249−}
250−
251−func (msghdr *Msghdr) SetIovlen(length int) {
252− msghdr.Iovlen = uint32(length)
253−}
254−
255−func (cmsg *Cmsghdr) SetLen(length int) {
256− cmsg.Len = uint32(length)
257−}
258−
259−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
260−
261−func Poll(fds []PollFd, timeout int) (n int, err error) {
262− if len(fds) == 0 {
263− return poll(nil, 0, timeout)
264− }
265− return poll(&fds[0], len(fds), timeout)
266−}
267−
268−//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE
269−
270−func SyncFileRange(fd int, off int64, n int64, flags int) error {
271− // The sync_file_range and arm_sync_file_range syscalls differ only in the
272− // order of their arguments.
273− return armSyncFileRange(fd, flags, off, n)
274−}
275−
276−//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
277−
278−func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
279− cmdlineLen := len(cmdline)
280− if cmdlineLen > 0 {
281− // Account for the additional NULL byte added by
282− // BytePtrFromString in kexecFileLoad. The kexec_file_load
283− // syscall expects a NULL-terminated string.
284− cmdlineLen++
285− }
286− return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
287−}
vendor/golang.org/x/sys/unix/syscall_linux_arm64.godeleted−246
@@ -1,246 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build arm64 && linux
6−// +build arm64,linux
7−
8−package unix
9−
10−import "unsafe"
11−
12−func EpollCreate(size int) (fd int, err error) {
13− if size <= 0 {
14− return -1, EINVAL
15− }
16− return EpollCreate1(0)
17−}
18−
19−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
20−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
21−//sys Fchown(fd int, uid int, gid int) (err error)
22−//sys Fstat(fd int, stat *Stat_t) (err error)
23−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
24−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
25−//sys Ftruncate(fd int, length int64) (err error)
26−//sysnb Getegid() (egid int)
27−//sysnb Geteuid() (euid int)
28−//sysnb Getgid() (gid int)
29−//sysnb getrlimit(resource int, rlim *Rlimit) (err error)
30−//sysnb Getuid() (uid int)
31−//sys Listen(s int, n int) (err error)
32−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
33−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
34−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
35−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
36−
37−func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
38− var ts *Timespec
39− if timeout != nil {
40− ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
41− }
42− return Pselect(nfd, r, w, e, ts, nil)
43−}
44−
45−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
46−//sys setfsgid(gid int) (prev int, err error)
47−//sys setfsuid(uid int) (prev int, err error)
48−//sysnb Setregid(rgid int, egid int) (err error)
49−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
50−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
51−//sysnb setrlimit(resource int, rlim *Rlimit) (err error)
52−//sysnb Setreuid(ruid int, euid int) (err error)
53−//sys Shutdown(fd int, how int) (err error)
54−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
55−
56−func Stat(path string, stat *Stat_t) (err error) {
57− return Fstatat(AT_FDCWD, path, stat, 0)
58−}
59−
60−func Lchown(path string, uid int, gid int) (err error) {
61− return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
62−}
63−
64−func Lstat(path string, stat *Stat_t) (err error) {
65− return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
66−}
67−
68−//sys Statfs(path string, buf *Statfs_t) (err error)
69−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
70−//sys Truncate(path string, length int64) (err error)
71−
72−func Ustat(dev int, ubuf *Ustat_t) (err error) {
73− return ENOSYS
74−}
75−
76−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
77−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
78−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
79−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
80−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
81−//sysnb setgroups(n int, list *_Gid_t) (err error)
82−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
83−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
84−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
85−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
86−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
87−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
88−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
89−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
90−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
91−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
92−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
93−
94−//sysnb Gettimeofday(tv *Timeval) (err error)
95−
96−func setTimespec(sec, nsec int64) Timespec {
97− return Timespec{Sec: sec, Nsec: nsec}
98−}
99−
100−func setTimeval(sec, usec int64) Timeval {
101− return Timeval{Sec: sec, Usec: usec}
102−}
103−
104−func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
105− if tv == nil {
106− return utimensat(dirfd, path, nil, 0)
107− }
108−
109− ts := []Timespec{
110− NsecToTimespec(TimevalToNsec(tv[0])),
111− NsecToTimespec(TimevalToNsec(tv[1])),
112− }
113− return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
114−}
115−
116−func Time(t *Time_t) (Time_t, error) {
117− var tv Timeval
118− err := Gettimeofday(&tv)
119− if err != nil {
120− return 0, err
121− }
122− if t != nil {
123− *t = Time_t(tv.Sec)
124− }
125− return Time_t(tv.Sec), nil
126−}
127−
128−func Utime(path string, buf *Utimbuf) error {
129− tv := []Timeval{
130− {Sec: buf.Actime},
131− {Sec: buf.Modtime},
132− }
133− return Utimes(path, tv)
134−}
135−
136−func utimes(path string, tv *[2]Timeval) (err error) {
137− if tv == nil {
138− return utimensat(AT_FDCWD, path, nil, 0)
139− }
140−
141− ts := []Timespec{
142− NsecToTimespec(TimevalToNsec(tv[0])),
143− NsecToTimespec(TimevalToNsec(tv[1])),
144− }
145− return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
146−}
147−
148−func Pipe(p []int) (err error) {
149− if len(p) != 2 {
150− return EINVAL
151− }
152− var pp [2]_C_int
153− err = pipe2(&pp, 0)
154− p[0] = int(pp[0])
155− p[1] = int(pp[1])
156− return
157−}
158−
159−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
160−
161−func Pipe2(p []int, flags int) (err error) {
162− if len(p) != 2 {
163− return EINVAL
164− }
165− var pp [2]_C_int
166− err = pipe2(&pp, flags)
167− p[0] = int(pp[0])
168− p[1] = int(pp[1])
169− return
170−}
171−
172−// Getrlimit prefers the prlimit64 system call. See issue 38604.
173−func Getrlimit(resource int, rlim *Rlimit) error {
174− err := prlimit(0, resource, nil, rlim)
175− if err != ENOSYS {
176− return err
177− }
178− return getrlimit(resource, rlim)
179−}
180−
181−// Setrlimit prefers the prlimit64 system call. See issue 38604.
182−func Setrlimit(resource int, rlim *Rlimit) error {
183− err := prlimit(0, resource, rlim, nil)
184− if err != ENOSYS {
185− return err
186− }
187− return setrlimit(resource, rlim)
188−}
189−
190−func (r *PtraceRegs) PC() uint64 { return r.Pc }
191−
192−func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
193−
194−func (iov *Iovec) SetLen(length int) {
195− iov.Len = uint64(length)
196−}
197−
198−func (msghdr *Msghdr) SetControllen(length int) {
199− msghdr.Controllen = uint64(length)
200−}
201−
202−func (msghdr *Msghdr) SetIovlen(length int) {
203− msghdr.Iovlen = uint64(length)
204−}
205−
206−func (cmsg *Cmsghdr) SetLen(length int) {
207− cmsg.Len = uint64(length)
208−}
209−
210−func InotifyInit() (fd int, err error) {
211− return InotifyInit1(0)
212−}
213−
214−// dup2 exists because func Dup3 in syscall_linux.go references
215−// it in an unreachable path. dup2 isn't available on arm64.
216−func dup2(oldfd int, newfd int) error
217−
218−func Pause() error {
219− _, err := ppoll(nil, 0, nil, nil)
220− return err
221−}
222−
223−func Poll(fds []PollFd, timeout int) (n int, err error) {
224− var ts *Timespec
225− if timeout >= 0 {
226− ts = new(Timespec)
227− *ts = NsecToTimespec(int64(timeout) * 1e6)
228− }
229− if len(fds) == 0 {
230− return ppoll(nil, 0, ts, nil)
231− }
232− return ppoll(&fds[0], len(fds), ts, nil)
233−}
234−
235−//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
236−
237−func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
238− cmdlineLen := len(cmdline)
239− if cmdlineLen > 0 {
240− // Account for the additional NULL byte added by
241− // BytePtrFromString in kexecFileLoad. The kexec_file_load
242− // syscall expects a NULL-terminated string.
243− cmdlineLen++
244− }
245− return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
246−}
vendor/golang.org/x/sys/unix/syscall_linux_gc.godeleted−15
@@ -1,15 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && gc
6−// +build linux,gc
7−
8−package unix
9−
10−// SyscallNoError may be used instead of Syscall for syscalls that don't fail.
11−func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
12−
13−// RawSyscallNoError may be used instead of RawSyscall for syscalls that don't
14−// fail.
15−func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
vendor/golang.org/x/sys/unix/syscall_linux_gc_386.godeleted−17
@@ -1,17 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && gc && 386
6−// +build linux,gc,386
7−
8−package unix
9−
10−import "syscall"
11−
12−// Underlying system call writes to newoffset via pointer.
13−// Implemented in assembly to avoid allocation.
14−func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
15−
16−func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
17−func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.godeleted−14
@@ -1,14 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build arm && gc && linux
6−// +build arm,gc,linux
7−
8−package unix
9−
10−import "syscall"
11−
12−// Underlying system call writes to newoffset via pointer.
13−// Implemented in assembly to avoid allocation.
14−func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.godeleted−31
@@ -1,31 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && gccgo && 386
6−// +build linux,gccgo,386
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func seek(fd int, offset int64, whence int) (int64, syscall.Errno) {
16− var newoffset int64
17− offsetLow := uint32(offset & 0xffffffff)
18− offsetHigh := uint32((offset >> 32) & 0xffffffff)
19− _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0)
20− return newoffset, err
21−}
22−
23−func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) {
24− fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0)
25− return int(fd), err
26−}
27−
28−func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) {
29− fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0)
30− return int(fd), err
31−}
vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.godeleted−21
@@ -1,21 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && gccgo && arm
6−// +build linux,gccgo,arm
7−
8−package unix
9−
10−import (
11− "syscall"
12− "unsafe"
13−)
14−
15−func seek(fd int, offset int64, whence int) (int64, syscall.Errno) {
16− var newoffset int64
17− offsetLow := uint32(offset & 0xffffffff)
18− offsetHigh := uint32((offset >> 32) & 0xffffffff)
19− _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0)
20− return newoffset, err
21−}
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.godeleted−231
@@ -1,231 +0,0 @@
1−// Copyright 2015 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && (mips64 || mips64le)
6−// +build linux
7−// +build mips64 mips64le
8−
9−package unix
10−
11−//sys dup2(oldfd int, newfd int) (err error)
12−//sysnb EpollCreate(size int) (fd int, err error)
13−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
14−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
15−//sys Fchown(fd int, uid int, gid int) (err error)
16−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
17−//sys Ftruncate(fd int, length int64) (err error)
18−//sysnb Getegid() (egid int)
19−//sysnb Geteuid() (euid int)
20−//sysnb Getgid() (gid int)
21−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
22−//sysnb Getuid() (uid int)
23−//sys Lchown(path string, uid int, gid int) (err error)
24−//sys Listen(s int, n int) (err error)
25−//sys Pause() (err error)
26−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
27−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
28−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
29−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
30−
31−func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
32− var ts *Timespec
33− if timeout != nil {
34− ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
35− }
36− return Pselect(nfd, r, w, e, ts, nil)
37−}
38−
39−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
40−//sys setfsgid(gid int) (prev int, err error)
41−//sys setfsuid(uid int) (prev int, err error)
42−//sysnb Setregid(rgid int, egid int) (err error)
43−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
44−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
45−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
46−//sysnb Setreuid(ruid int, euid int) (err error)
47−//sys Shutdown(fd int, how int) (err error)
48−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
49−//sys Statfs(path string, buf *Statfs_t) (err error)
50−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
51−//sys Truncate(path string, length int64) (err error)
52−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
53−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
54−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
55−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
56−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
57−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
58−//sysnb setgroups(n int, list *_Gid_t) (err error)
59−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
60−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
61−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
62−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
63−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
64−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
65−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
66−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
67−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
68−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
69−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
70−
71−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
72−//sysnb Gettimeofday(tv *Timeval) (err error)
73−
74−func Time(t *Time_t) (tt Time_t, err error) {
75− var tv Timeval
76− err = Gettimeofday(&tv)
77− if err != nil {
78− return 0, err
79− }
80− if t != nil {
81− *t = Time_t(tv.Sec)
82− }
83− return Time_t(tv.Sec), nil
84−}
85−
86−//sys Utime(path string, buf *Utimbuf) (err error)
87−//sys utimes(path string, times *[2]Timeval) (err error)
88−
89−func setTimespec(sec, nsec int64) Timespec {
90− return Timespec{Sec: sec, Nsec: nsec}
91−}
92−
93−func setTimeval(sec, usec int64) Timeval {
94− return Timeval{Sec: sec, Usec: usec}
95−}
96−
97−func Pipe(p []int) (err error) {
98− if len(p) != 2 {
99− return EINVAL
100− }
101− var pp [2]_C_int
102− err = pipe2(&pp, 0)
103− p[0] = int(pp[0])
104− p[1] = int(pp[1])
105− return
106−}
107−
108−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
109−
110−func Pipe2(p []int, flags int) (err error) {
111− if len(p) != 2 {
112− return EINVAL
113− }
114− var pp [2]_C_int
115− err = pipe2(&pp, flags)
116− p[0] = int(pp[0])
117− p[1] = int(pp[1])
118− return
119−}
120−
121−func Ioperm(from int, num int, on int) (err error) {
122− return ENOSYS
123−}
124−
125−func Iopl(level int) (err error) {
126− return ENOSYS
127−}
128−
129−type stat_t struct {
130− Dev uint32
131− Pad0 [3]int32
132− Ino uint64
133− Mode uint32
134− Nlink uint32
135− Uid uint32
136− Gid uint32
137− Rdev uint32
138− Pad1 [3]uint32
139− Size int64
140− Atime uint32
141− Atime_nsec uint32
142− Mtime uint32
143− Mtime_nsec uint32
144− Ctime uint32
145− Ctime_nsec uint32
146− Blksize uint32
147− Pad2 uint32
148− Blocks int64
149−}
150−
151−//sys fstat(fd int, st *stat_t) (err error)
152−//sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT
153−//sys lstat(path string, st *stat_t) (err error)
154−//sys stat(path string, st *stat_t) (err error)
155−
156−func Fstat(fd int, s *Stat_t) (err error) {
157− st := &stat_t{}
158− err = fstat(fd, st)
159− fillStat_t(s, st)
160− return
161−}
162−
163−func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) {
164− st := &stat_t{}
165− err = fstatat(dirfd, path, st, flags)
166− fillStat_t(s, st)
167− return
168−}
169−
170−func Lstat(path string, s *Stat_t) (err error) {
171− st := &stat_t{}
172− err = lstat(path, st)
173− fillStat_t(s, st)
174− return
175−}
176−
177−func Stat(path string, s *Stat_t) (err error) {
178− st := &stat_t{}
179− err = stat(path, st)
180− fillStat_t(s, st)
181− return
182−}
183−
184−func fillStat_t(s *Stat_t, st *stat_t) {
185− s.Dev = st.Dev
186− s.Ino = st.Ino
187− s.Mode = st.Mode
188− s.Nlink = st.Nlink
189− s.Uid = st.Uid
190− s.Gid = st.Gid
191− s.Rdev = st.Rdev
192− s.Size = st.Size
193− s.Atim = Timespec{int64(st.Atime), int64(st.Atime_nsec)}
194− s.Mtim = Timespec{int64(st.Mtime), int64(st.Mtime_nsec)}
195− s.Ctim = Timespec{int64(st.Ctime), int64(st.Ctime_nsec)}
196− s.Blksize = st.Blksize
197− s.Blocks = st.Blocks
198−}
199−
200−func (r *PtraceRegs) PC() uint64 { return r.Epc }
201−
202−func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
203−
204−func (iov *Iovec) SetLen(length int) {
205− iov.Len = uint64(length)
206−}
207−
208−func (msghdr *Msghdr) SetControllen(length int) {
209− msghdr.Controllen = uint64(length)
210−}
211−
212−func (msghdr *Msghdr) SetIovlen(length int) {
213− msghdr.Iovlen = uint64(length)
214−}
215−
216−func (cmsg *Cmsghdr) SetLen(length int) {
217− cmsg.Len = uint64(length)
218−}
219−
220−func InotifyInit() (fd int, err error) {
221− return InotifyInit1(0)
222−}
223−
224−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
225−
226−func Poll(fds []PollFd, timeout int) (n int, err error) {
227− if len(fds) == 0 {
228− return poll(nil, 0, timeout)
229− }
230− return poll(&fds[0], len(fds), timeout)
231−}
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.godeleted−239
@@ -1,239 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && (mips || mipsle)
6−// +build linux
7−// +build mips mipsle
8−
9−package unix
10−
11−import (
12− "syscall"
13− "unsafe"
14−)
15−
16−func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
17−
18−//sys dup2(oldfd int, newfd int) (err error)
19−//sysnb EpollCreate(size int) (fd int, err error)
20−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
21−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
22−//sys Fchown(fd int, uid int, gid int) (err error)
23−//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
24−//sysnb Getegid() (egid int)
25−//sysnb Geteuid() (euid int)
26−//sysnb Getgid() (gid int)
27−//sysnb Getuid() (uid int)
28−//sys Lchown(path string, uid int, gid int) (err error)
29−//sys Listen(s int, n int) (err error)
30−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
31−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
32−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
33−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
34−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
35−//sys setfsgid(gid int) (prev int, err error)
36−//sys setfsuid(uid int) (prev int, err error)
37−//sysnb Setregid(rgid int, egid int) (err error)
38−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
39−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
40−//sysnb Setreuid(ruid int, euid int) (err error)
41−//sys Shutdown(fd int, how int) (err error)
42−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
43−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
44−//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
45−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
46−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
47−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
48−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
49−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
50−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
51−//sysnb setgroups(n int, list *_Gid_t) (err error)
52−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
53−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
54−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
55−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
56−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
57−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
58−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
59−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
60−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
61−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
62−
63−//sysnb InotifyInit() (fd int, err error)
64−//sys Ioperm(from int, num int, on int) (err error)
65−//sys Iopl(level int) (err error)
66−
67−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
68−//sysnb Gettimeofday(tv *Timeval) (err error)
69−//sysnb Time(t *Time_t) (tt Time_t, err error)
70−//sys Utime(path string, buf *Utimbuf) (err error)
71−//sys utimes(path string, times *[2]Timeval) (err error)
72−
73−//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
74−//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
75−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
76−//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
77−
78−//sys Pause() (err error)
79−
80−func Fstatfs(fd int, buf *Statfs_t) (err error) {
81− _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
82− if e != 0 {
83− err = errnoErr(e)
84− }
85− return
86−}
87−
88−func Statfs(path string, buf *Statfs_t) (err error) {
89− p, err := BytePtrFromString(path)
90− if err != nil {
91− return err
92− }
93− _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
94− if e != 0 {
95− err = errnoErr(e)
96− }
97− return
98−}
99−
100−func Seek(fd int, offset int64, whence int) (off int64, err error) {
101− _, _, e := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), uintptr(unsafe.Pointer(&off)), uintptr(whence), 0)
102− if e != 0 {
103− err = errnoErr(e)
104− }
105− return
106−}
107−
108−func setTimespec(sec, nsec int64) Timespec {
109− return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
110−}
111−
112−func setTimeval(sec, usec int64) Timeval {
113− return Timeval{Sec: int32(sec), Usec: int32(usec)}
114−}
115−
116−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
117−
118−func Pipe2(p []int, flags int) (err error) {
119− if len(p) != 2 {
120− return EINVAL
121− }
122− var pp [2]_C_int
123− err = pipe2(&pp, flags)
124− p[0] = int(pp[0])
125− p[1] = int(pp[1])
126− return
127−}
128−
129−//sysnb pipe() (p1 int, p2 int, err error)
130−
131−func Pipe(p []int) (err error) {
132− if len(p) != 2 {
133− return EINVAL
134− }
135− p[0], p[1], err = pipe()
136− return
137−}
138−
139−//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
140−
141−func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
142− page := uintptr(offset / 4096)
143− if offset != int64(page)*4096 {
144− return 0, EINVAL
145− }
146− return mmap2(addr, length, prot, flags, fd, page)
147−}
148−
149−const rlimInf32 = ^uint32(0)
150−const rlimInf64 = ^uint64(0)
151−
152−type rlimit32 struct {
153− Cur uint32
154− Max uint32
155−}
156−
157−//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
158−
159−func Getrlimit(resource int, rlim *Rlimit) (err error) {
160− err = prlimit(0, resource, nil, rlim)
161− if err != ENOSYS {
162− return err
163− }
164−
165− rl := rlimit32{}
166− err = getrlimit(resource, &rl)
167− if err != nil {
168− return
169− }
170−
171− if rl.Cur == rlimInf32 {
172− rlim.Cur = rlimInf64
173− } else {
174− rlim.Cur = uint64(rl.Cur)
175− }
176−
177− if rl.Max == rlimInf32 {
178− rlim.Max = rlimInf64
179− } else {
180− rlim.Max = uint64(rl.Max)
181− }
182− return
183−}
184−
185−//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
186−
187−func Setrlimit(resource int, rlim *Rlimit) (err error) {
188− err = prlimit(0, resource, rlim, nil)
189− if err != ENOSYS {
190− return err
191− }
192−
193− rl := rlimit32{}
194− if rlim.Cur == rlimInf64 {
195− rl.Cur = rlimInf32
196− } else if rlim.Cur < uint64(rlimInf32) {
197− rl.Cur = uint32(rlim.Cur)
198− } else {
199− return EINVAL
200− }
201− if rlim.Max == rlimInf64 {
202− rl.Max = rlimInf32
203− } else if rlim.Max < uint64(rlimInf32) {
204− rl.Max = uint32(rlim.Max)
205− } else {
206− return EINVAL
207− }
208−
209− return setrlimit(resource, &rl)
210−}
211−
212−func (r *PtraceRegs) PC() uint64 { return r.Epc }
213−
214−func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
215−
216−func (iov *Iovec) SetLen(length int) {
217− iov.Len = uint32(length)
218−}
219−
220−func (msghdr *Msghdr) SetControllen(length int) {
221− msghdr.Controllen = uint32(length)
222−}
223−
224−func (msghdr *Msghdr) SetIovlen(length int) {
225− msghdr.Iovlen = uint32(length)
226−}
227−
228−func (cmsg *Cmsghdr) SetLen(length int) {
229− cmsg.Len = uint32(length)
230−}
231−
232−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
233−
234−func Poll(fds []PollFd, timeout int) (n int, err error) {
235− if len(fds) == 0 {
236− return poll(nil, 0, timeout)
237− }
238− return poll(&fds[0], len(fds), timeout)
239−}
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.godeleted−157
@@ -1,157 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build linux && (ppc64 || ppc64le)
6−// +build linux
7−// +build ppc64 ppc64le
8−
9−package unix
10−
11−//sys dup2(oldfd int, newfd int) (err error)
12−//sysnb EpollCreate(size int) (fd int, err error)
13−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
14−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
15−//sys Fchown(fd int, uid int, gid int) (err error)
16−//sys Fstat(fd int, stat *Stat_t) (err error)
17−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
18−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
19−//sys Ftruncate(fd int, length int64) (err error)
20−//sysnb Getegid() (egid int)
21−//sysnb Geteuid() (euid int)
22−//sysnb Getgid() (gid int)
23−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
24−//sysnb Getuid() (uid int)
25−//sysnb InotifyInit() (fd int, err error)
26−//sys Ioperm(from int, num int, on int) (err error)
27−//sys Iopl(level int) (err error)
28−//sys Lchown(path string, uid int, gid int) (err error)
29−//sys Listen(s int, n int) (err error)
30−//sys Lstat(path string, stat *Stat_t) (err error)
31−//sys Pause() (err error)
32−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
33−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
34−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
35−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
36−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
37−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
38−//sys setfsgid(gid int) (prev int, err error)
39−//sys setfsuid(uid int) (prev int, err error)
40−//sysnb Setregid(rgid int, egid int) (err error)
41−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
42−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
43−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
44−//sysnb Setreuid(ruid int, euid int) (err error)
45−//sys Shutdown(fd int, how int) (err error)
46−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
47−//sys Stat(path string, stat *Stat_t) (err error)
48−//sys Statfs(path string, buf *Statfs_t) (err error)
49−//sys Truncate(path string, length int64) (err error)
50−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
51−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
52−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
53−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
54−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
55−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
56−//sysnb setgroups(n int, list *_Gid_t) (err error)
57−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
58−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
59−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
60−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
61−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
62−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
63−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
64−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
65−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
66−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
67−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
68−
69−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
70−//sysnb Gettimeofday(tv *Timeval) (err error)
71−//sysnb Time(t *Time_t) (tt Time_t, err error)
72−//sys Utime(path string, buf *Utimbuf) (err error)
73−//sys utimes(path string, times *[2]Timeval) (err error)
74−
75−func setTimespec(sec, nsec int64) Timespec {
76− return Timespec{Sec: sec, Nsec: nsec}
77−}
78−
79−func setTimeval(sec, usec int64) Timeval {
80− return Timeval{Sec: sec, Usec: usec}
81−}
82−
83−func (r *PtraceRegs) PC() uint64 { return r.Nip }
84−
85−func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
86−
87−func (iov *Iovec) SetLen(length int) {
88− iov.Len = uint64(length)
89−}
90−
91−func (msghdr *Msghdr) SetControllen(length int) {
92− msghdr.Controllen = uint64(length)
93−}
94−
95−func (msghdr *Msghdr) SetIovlen(length int) {
96− msghdr.Iovlen = uint64(length)
97−}
98−
99−func (cmsg *Cmsghdr) SetLen(length int) {
100− cmsg.Len = uint64(length)
101−}
102−
103−//sysnb pipe(p *[2]_C_int) (err error)
104−
105−func Pipe(p []int) (err error) {
106− if len(p) != 2 {
107− return EINVAL
108− }
109− var pp [2]_C_int
110− err = pipe(&pp)
111− p[0] = int(pp[0])
112− p[1] = int(pp[1])
113− return
114−}
115−
116−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
117−
118−func Pipe2(p []int, flags int) (err error) {
119− if len(p) != 2 {
120− return EINVAL
121− }
122− var pp [2]_C_int
123− err = pipe2(&pp, flags)
124− p[0] = int(pp[0])
125− p[1] = int(pp[1])
126− return
127−}
128−
129−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
130−
131−func Poll(fds []PollFd, timeout int) (n int, err error) {
132− if len(fds) == 0 {
133− return poll(nil, 0, timeout)
134− }
135− return poll(&fds[0], len(fds), timeout)
136−}
137−
138−//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
139−
140−func SyncFileRange(fd int, off int64, n int64, flags int) error {
141− // The sync_file_range and sync_file_range2 syscalls differ only in the
142− // order of their arguments.
143− return syncFileRange2(fd, flags, off, n)
144−}
145−
146−//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
147−
148−func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
149− cmdlineLen := len(cmdline)
150− if cmdlineLen > 0 {
151− // Account for the additional NULL byte added by
152− // BytePtrFromString in kexecFileLoad. The kexec_file_load
153− // syscall expects a NULL-terminated string.
154− cmdlineLen++
155− }
156− return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
157−}
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.godeleted−231
@@ -1,231 +0,0 @@
1−// Copyright 2018 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build riscv64 && linux
6−// +build riscv64,linux
7−
8−package unix
9−
10−import "unsafe"
11−
12−func EpollCreate(size int) (fd int, err error) {
13− if size <= 0 {
14− return -1, EINVAL
15− }
16− return EpollCreate1(0)
17−}
18−
19−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
20−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
21−//sys Fchown(fd int, uid int, gid int) (err error)
22−//sys Fstat(fd int, stat *Stat_t) (err error)
23−//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
24−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
25−//sys Ftruncate(fd int, length int64) (err error)
26−//sysnb Getegid() (egid int)
27−//sysnb Geteuid() (euid int)
28−//sysnb Getgid() (gid int)
29−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
30−//sysnb Getuid() (uid int)
31−//sys Listen(s int, n int) (err error)
32−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
33−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
34−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
35−
36−func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
37− var ts *Timespec
38− if timeout != nil {
39− ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
40− }
41− return Pselect(nfd, r, w, e, ts, nil)
42−}
43−
44−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
45−//sys setfsgid(gid int) (prev int, err error)
46−//sys setfsuid(uid int) (prev int, err error)
47−//sysnb Setregid(rgid int, egid int) (err error)
48−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
49−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
50−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
51−//sysnb Setreuid(ruid int, euid int) (err error)
52−//sys Shutdown(fd int, how int) (err error)
53−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
54−
55−func Stat(path string, stat *Stat_t) (err error) {
56− return Fstatat(AT_FDCWD, path, stat, 0)
57−}
58−
59−func Lchown(path string, uid int, gid int) (err error) {
60− return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
61−}
62−
63−func Lstat(path string, stat *Stat_t) (err error) {
64− return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
65−}
66−
67−//sys Statfs(path string, buf *Statfs_t) (err error)
68−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
69−//sys Truncate(path string, length int64) (err error)
70−
71−func Ustat(dev int, ubuf *Ustat_t) (err error) {
72− return ENOSYS
73−}
74−
75−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
76−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
77−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
78−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
79−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
80−//sysnb setgroups(n int, list *_Gid_t) (err error)
81−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
82−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
83−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
84−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
85−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
86−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
87−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
88−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
89−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
90−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
91−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
92−
93−//sysnb Gettimeofday(tv *Timeval) (err error)
94−
95−func setTimespec(sec, nsec int64) Timespec {
96− return Timespec{Sec: sec, Nsec: nsec}
97−}
98−
99−func setTimeval(sec, usec int64) Timeval {
100− return Timeval{Sec: sec, Usec: usec}
101−}
102−
103−func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
104− if tv == nil {
105− return utimensat(dirfd, path, nil, 0)
106− }
107−
108− ts := []Timespec{
109− NsecToTimespec(TimevalToNsec(tv[0])),
110− NsecToTimespec(TimevalToNsec(tv[1])),
111− }
112− return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
113−}
114−
115−func Time(t *Time_t) (Time_t, error) {
116− var tv Timeval
117− err := Gettimeofday(&tv)
118− if err != nil {
119− return 0, err
120− }
121− if t != nil {
122− *t = Time_t(tv.Sec)
123− }
124− return Time_t(tv.Sec), nil
125−}
126−
127−func Utime(path string, buf *Utimbuf) error {
128− tv := []Timeval{
129− {Sec: buf.Actime},
130− {Sec: buf.Modtime},
131− }
132− return Utimes(path, tv)
133−}
134−
135−func utimes(path string, tv *[2]Timeval) (err error) {
136− if tv == nil {
137− return utimensat(AT_FDCWD, path, nil, 0)
138− }
139−
140− ts := []Timespec{
141− NsecToTimespec(TimevalToNsec(tv[0])),
142− NsecToTimespec(TimevalToNsec(tv[1])),
143− }
144− return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
145−}
146−
147−func Pipe(p []int) (err error) {
148− if len(p) != 2 {
149− return EINVAL
150− }
151− var pp [2]_C_int
152− err = pipe2(&pp, 0)
153− p[0] = int(pp[0])
154− p[1] = int(pp[1])
155− return
156−}
157−
158−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
159−
160−func Pipe2(p []int, flags int) (err error) {
161− if len(p) != 2 {
162− return EINVAL
163− }
164− var pp [2]_C_int
165− err = pipe2(&pp, flags)
166− p[0] = int(pp[0])
167− p[1] = int(pp[1])
168− return
169−}
170−
171−func (r *PtraceRegs) PC() uint64 { return r.Pc }
172−
173−func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
174−
175−func (iov *Iovec) SetLen(length int) {
176− iov.Len = uint64(length)
177−}
178−
179−func (msghdr *Msghdr) SetControllen(length int) {
180− msghdr.Controllen = uint64(length)
181−}
182−
183−func (msghdr *Msghdr) SetIovlen(length int) {
184− msghdr.Iovlen = uint64(length)
185−}
186−
187−func (cmsg *Cmsghdr) SetLen(length int) {
188− cmsg.Len = uint64(length)
189−}
190−
191−func InotifyInit() (fd int, err error) {
192− return InotifyInit1(0)
193−}
194−
195−func Pause() error {
196− _, err := ppoll(nil, 0, nil, nil)
197− return err
198−}
199−
200−func Poll(fds []PollFd, timeout int) (n int, err error) {
201− var ts *Timespec
202− if timeout >= 0 {
203− ts = new(Timespec)
204− *ts = NsecToTimespec(int64(timeout) * 1e6)
205− }
206− if len(fds) == 0 {
207− return ppoll(nil, 0, ts, nil)
208− }
209− return ppoll(&fds[0], len(fds), ts, nil)
210−}
211−
212−func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
213− return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
214−}
215−
216−//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
217−
218−func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
219− cmdlineLen := len(cmdline)
220− if cmdlineLen > 0 {
221− // Account for the additional NULL byte added by
222− // BytePtrFromString in kexecFileLoad. The kexec_file_load
223− // syscall expects a NULL-terminated string.
224− cmdlineLen++
225− }
226− return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
227−}
228−
229−// dup2 exists because func Dup3 in syscall_linux.go references
230−// it in an unreachable path. dup2 isn't available on arm64.
231−func dup2(oldfd int, newfd int) error
vendor/golang.org/x/sys/unix/syscall_linux_s390x.godeleted−343
@@ -1,343 +0,0 @@
1−// Copyright 2016 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build s390x && linux
6−// +build s390x,linux
7−
8−package unix
9−
10−import (
11− "unsafe"
12−)
13−
14−//sys dup2(oldfd int, newfd int) (err error)
15−//sysnb EpollCreate(size int) (fd int, err error)
16−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
17−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
18−//sys Fchown(fd int, uid int, gid int) (err error)
19−//sys Fstat(fd int, stat *Stat_t) (err error)
20−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
21−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
22−//sys Ftruncate(fd int, length int64) (err error)
23−//sysnb Getegid() (egid int)
24−//sysnb Geteuid() (euid int)
25−//sysnb Getgid() (gid int)
26−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
27−//sysnb Getuid() (uid int)
28−//sysnb InotifyInit() (fd int, err error)
29−//sys Lchown(path string, uid int, gid int) (err error)
30−//sys Lstat(path string, stat *Stat_t) (err error)
31−//sys Pause() (err error)
32−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
33−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
34−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
35−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
36−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
37−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
38−//sys setfsgid(gid int) (prev int, err error)
39−//sys setfsuid(uid int) (prev int, err error)
40−//sysnb Setregid(rgid int, egid int) (err error)
41−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
42−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
43−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
44−//sysnb Setreuid(ruid int, euid int) (err error)
45−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
46−//sys Stat(path string, stat *Stat_t) (err error)
47−//sys Statfs(path string, buf *Statfs_t) (err error)
48−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
49−//sys Truncate(path string, length int64) (err error)
50−//sys Ustat(dev int, ubuf *Ustat_t) (err error)
51−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
52−//sysnb setgroups(n int, list *_Gid_t) (err error)
53−
54−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
55−//sysnb Gettimeofday(tv *Timeval) (err error)
56−
57−func Time(t *Time_t) (tt Time_t, err error) {
58− var tv Timeval
59− err = Gettimeofday(&tv)
60− if err != nil {
61− return 0, err
62− }
63− if t != nil {
64− *t = Time_t(tv.Sec)
65− }
66− return Time_t(tv.Sec), nil
67−}
68−
69−//sys Utime(path string, buf *Utimbuf) (err error)
70−//sys utimes(path string, times *[2]Timeval) (err error)
71−
72−func setTimespec(sec, nsec int64) Timespec {
73− return Timespec{Sec: sec, Nsec: nsec}
74−}
75−
76−func setTimeval(sec, usec int64) Timeval {
77− return Timeval{Sec: sec, Usec: usec}
78−}
79−
80−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
81−
82−func Pipe(p []int) (err error) {
83− if len(p) != 2 {
84− return EINVAL
85− }
86− var pp [2]_C_int
87− err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0.
88− p[0] = int(pp[0])
89− p[1] = int(pp[1])
90− return
91−}
92−
93−func Pipe2(p []int, flags int) (err error) {
94− if len(p) != 2 {
95− return EINVAL
96− }
97− var pp [2]_C_int
98− err = pipe2(&pp, flags)
99− p[0] = int(pp[0])
100− p[1] = int(pp[1])
101− return
102−}
103−
104−func Ioperm(from int, num int, on int) (err error) {
105− return ENOSYS
106−}
107−
108−func Iopl(level int) (err error) {
109− return ENOSYS
110−}
111−
112−func (r *PtraceRegs) PC() uint64 { return r.Psw.Addr }
113−
114−func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = pc }
115−
116−func (iov *Iovec) SetLen(length int) {
117− iov.Len = uint64(length)
118−}
119−
120−func (msghdr *Msghdr) SetControllen(length int) {
121− msghdr.Controllen = uint64(length)
122−}
123−
124−func (msghdr *Msghdr) SetIovlen(length int) {
125− msghdr.Iovlen = uint64(length)
126−}
127−
128−func (cmsg *Cmsghdr) SetLen(length int) {
129− cmsg.Len = uint64(length)
130−}
131−
132−// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
133−// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
134−func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
135− mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
136− r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
137− xaddr = uintptr(r0)
138− if e1 != 0 {
139− err = errnoErr(e1)
140− }
141− return
142−}
143−
144−// On s390x Linux, all the socket calls go through an extra indirection.
145−// The arguments to the underlying system call (SYS_SOCKETCALL) are the
146−// number below and a pointer to an array of uintptr.
147−const (
148− // see linux/net.h
149− netSocket = 1
150− netBind = 2
151− netConnect = 3
152− netListen = 4
153− netAccept = 5
154− netGetSockName = 6
155− netGetPeerName = 7
156− netSocketPair = 8
157− netSend = 9
158− netRecv = 10
159− netSendTo = 11
160− netRecvFrom = 12
161− netShutdown = 13
162− netSetSockOpt = 14
163− netGetSockOpt = 15
164− netSendMsg = 16
165− netRecvMsg = 17
166− netAccept4 = 18
167− netRecvMMsg = 19
168− netSendMMsg = 20
169−)
170−
171−func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (int, error) {
172− args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
173− fd, _, err := Syscall(SYS_SOCKETCALL, netAccept, uintptr(unsafe.Pointer(&args)), 0)
174− if err != 0 {
175− return 0, err
176− }
177− return int(fd), nil
178−}
179−
180−func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (int, error) {
181− args := [4]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags)}
182− fd, _, err := Syscall(SYS_SOCKETCALL, netAccept4, uintptr(unsafe.Pointer(&args)), 0)
183− if err != 0 {
184− return 0, err
185− }
186− return int(fd), nil
187−}
188−
189−func getsockname(s int, rsa *RawSockaddrAny, addrlen *_Socklen) error {
190− args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
191− _, _, err := RawSyscall(SYS_SOCKETCALL, netGetSockName, uintptr(unsafe.Pointer(&args)), 0)
192− if err != 0 {
193− return err
194− }
195− return nil
196−}
197−
198−func getpeername(s int, rsa *RawSockaddrAny, addrlen *_Socklen) error {
199− args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))}
200− _, _, err := RawSyscall(SYS_SOCKETCALL, netGetPeerName, uintptr(unsafe.Pointer(&args)), 0)
201− if err != 0 {
202− return err
203− }
204− return nil
205−}
206−
207−func socketpair(domain int, typ int, flags int, fd *[2]int32) error {
208− args := [4]uintptr{uintptr(domain), uintptr(typ), uintptr(flags), uintptr(unsafe.Pointer(fd))}
209− _, _, err := RawSyscall(SYS_SOCKETCALL, netSocketPair, uintptr(unsafe.Pointer(&args)), 0)
210− if err != 0 {
211− return err
212− }
213− return nil
214−}
215−
216−func bind(s int, addr unsafe.Pointer, addrlen _Socklen) error {
217− args := [3]uintptr{uintptr(s), uintptr(addr), uintptr(addrlen)}
218− _, _, err := Syscall(SYS_SOCKETCALL, netBind, uintptr(unsafe.Pointer(&args)), 0)
219− if err != 0 {
220− return err
221− }
222− return nil
223−}
224−
225−func connect(s int, addr unsafe.Pointer, addrlen _Socklen) error {
226− args := [3]uintptr{uintptr(s), uintptr(addr), uintptr(addrlen)}
227− _, _, err := Syscall(SYS_SOCKETCALL, netConnect, uintptr(unsafe.Pointer(&args)), 0)
228− if err != 0 {
229− return err
230− }
231− return nil
232−}
233−
234−func socket(domain int, typ int, proto int) (int, error) {
235− args := [3]uintptr{uintptr(domain), uintptr(typ), uintptr(proto)}
236− fd, _, err := RawSyscall(SYS_SOCKETCALL, netSocket, uintptr(unsafe.Pointer(&args)), 0)
237− if err != 0 {
238− return 0, err
239− }
240− return int(fd), nil
241−}
242−
243−func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) error {
244− args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen))}
245− _, _, err := Syscall(SYS_SOCKETCALL, netGetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
246− if err != 0 {
247− return err
248− }
249− return nil
250−}
251−
252−func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error {
253− args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen}
254− _, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
255− if err != 0 {
256− return err
257− }
258− return nil
259−}
260−
261−func recvfrom(s int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (int, error) {
262− var base uintptr
263− if len(p) > 0 {
264− base = uintptr(unsafe.Pointer(&p[0]))
265− }
266− args := [6]uintptr{uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))}
267− n, _, err := Syscall(SYS_SOCKETCALL, netRecvFrom, uintptr(unsafe.Pointer(&args)), 0)
268− if err != 0 {
269− return 0, err
270− }
271− return int(n), nil
272−}
273−
274−func sendto(s int, p []byte, flags int, to unsafe.Pointer, addrlen _Socklen) error {
275− var base uintptr
276− if len(p) > 0 {
277− base = uintptr(unsafe.Pointer(&p[0]))
278− }
279− args := [6]uintptr{uintptr(s), base, uintptr(len(p)), uintptr(flags), uintptr(to), uintptr(addrlen)}
280− _, _, err := Syscall(SYS_SOCKETCALL, netSendTo, uintptr(unsafe.Pointer(&args)), 0)
281− if err != 0 {
282− return err
283− }
284− return nil
285−}
286−
287−func recvmsg(s int, msg *Msghdr, flags int) (int, error) {
288− args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)}
289− n, _, err := Syscall(SYS_SOCKETCALL, netRecvMsg, uintptr(unsafe.Pointer(&args)), 0)
290− if err != 0 {
291− return 0, err
292− }
293− return int(n), nil
294−}
295−
296−func sendmsg(s int, msg *Msghdr, flags int) (int, error) {
297− args := [3]uintptr{uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)}
298− n, _, err := Syscall(SYS_SOCKETCALL, netSendMsg, uintptr(unsafe.Pointer(&args)), 0)
299− if err != 0 {
300− return 0, err
301− }
302− return int(n), nil
303−}
304−
305−func Listen(s int, n int) error {
306− args := [2]uintptr{uintptr(s), uintptr(n)}
307− _, _, err := Syscall(SYS_SOCKETCALL, netListen, uintptr(unsafe.Pointer(&args)), 0)
308− if err != 0 {
309− return err
310− }
311− return nil
312−}
313−
314−func Shutdown(s, how int) error {
315− args := [2]uintptr{uintptr(s), uintptr(how)}
316− _, _, err := Syscall(SYS_SOCKETCALL, netShutdown, uintptr(unsafe.Pointer(&args)), 0)
317− if err != 0 {
318− return err
319− }
320− return nil
321−}
322−
323−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
324−
325−func Poll(fds []PollFd, timeout int) (n int, err error) {
326− if len(fds) == 0 {
327− return poll(nil, 0, timeout)
328− }
329− return poll(&fds[0], len(fds), timeout)
330−}
331−
332−//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
333−
334−func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
335− cmdlineLen := len(cmdline)
336− if cmdlineLen > 0 {
337− // Account for the additional NULL byte added by
338− // BytePtrFromString in kexecFileLoad. The kexec_file_load
339− // syscall expects a NULL-terminated string.
340− cmdlineLen++
341− }
342− return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
343−}
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.godeleted−152
@@ -1,152 +0,0 @@
1−// Copyright 2009 The Go Authors. All rights reserved.
2−// Use of this source code is governed by a BSD-style
3−// license that can be found in the LICENSE file.
4−
5−//go:build sparc64 && linux
6−// +build sparc64,linux
7−
8−package unix
9−
10−//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
11−//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
12−//sys dup2(oldfd int, newfd int) (err error)
13−//sys Fchown(fd int, uid int, gid int) (err error)
14−//sys Fstat(fd int, stat *Stat_t) (err error)
15−//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
16−//sys Fstatfs(fd int, buf *Statfs_t) (err error)
17−//sys Ftruncate(fd int, length int64) (err error)
18−//sysnb Getegid() (egid int)
19−//sysnb Geteuid() (euid int)
20−//sysnb Getgid() (gid int)
21−//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
22−//sysnb Getuid() (uid int)
23−//sysnb InotifyInit() (fd int, err error)
24−//sys Lchown(path string, uid int, gid int) (err error)
25−//sys Listen(s int, n int) (err error)
26−//sys Lstat(path string, stat *Stat_t) (err error)
27−//sys Pause() (err error)
28−//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
29−//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
30−//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
31−//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
32−//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
33−//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
34−//sys setfsgid(gid int) (prev int, err error)
35−//sys setfsuid(uid int) (prev int, err error)
36−//sysnb Setregid(rgid int, egid int) (err error)
37−//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
38−//sysnb Setresuid(ruid int, euid int, suid int) (err error)
39−//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
40−//sysnb Setreuid(ruid int, euid int) (err error)
41−//sys Shutdown(fd int, how int) (err error)
42−//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
43−//sys Stat(path string, stat *Stat_t) (err error)
44−//sys Statfs(path string, buf *Statfs_t) (err error)
45−//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
46−//sys Truncate(path string, length int64) (err error)
47−//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
48−//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
49−//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
50−//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
51−//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
52−//sysnb setgroups(n int, list *_Gid_t) (err error)
53−//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
54−//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
55−//sysnb socket(domain int, typ int, proto int) (fd int, err error)
56−//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
57−//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
58−//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
59−//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
60−//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
61−//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
62−//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
63−//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
64−
65−func Ioperm(from int, num int, on int) (err error) {
66− return ENOSYS
67−}
68−
69−func Iopl(level int) (err error) {
70− return ENOSYS
71−}
72−
73−//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
74−//sysnb Gettimeofday(tv *Timeval) (err error)
75−
76−func Time(t *Time_t) (tt Time_t, err error) {
77− var tv Timeval
78− err = Gettimeofday(&tv)
79− if err != nil {
80− return 0, err
81− }
82− if t != nil {
83− *t = Time_t(tv.Sec)
84− }
85− return Time_t(tv.Sec), nil
86−}
87−
88−//sys Utime(path string, buf *Utimbuf) (err error)
89−//sys utimes(path string, times *[2]Timeval) (err error)
90−
91−func setTimespec(sec, nsec int64) Timespec {
92− return Timespec{Sec: sec, Nsec: nsec}
93−}
94−
95−func setTimeval(sec, usec int64) Timeval {
96− return Timeval{Sec: sec, Usec: int32(usec)}
97−}
98−
99−func (r *PtraceRegs) PC() uint64 { return r.Tpc }
100−
101−func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc }
102−
103−func (iov *Iovec) SetLen(length int) {
104− iov.Len = uint64(length)
105−}
106−
107−func (msghdr *Msghdr) SetControllen(length int) {
108− msghdr.Controllen = uint64(length)
109−}
110−
111−func (msghdr *Msghdr) SetIovlen(length int) {
112− msghdr.Iovlen = uint64(length)
113−}
114−
115−func (cmsg *Cmsghdr) SetLen(length int) {
116− cmsg.Len = uint64(length)
117−}
118−
119−//sysnb pipe(p *[2]_C_int) (err error)
120−
121−func Pipe(p []int) (err error) {
122− if len(p) != 2 {
123− return EINVAL
124− }
125− var pp [2]_C_int
126− err = pipe(&pp)
127− p[0] = int(pp[0])
128− p[1] = int(pp[1])
129− return
130−}
131−
132−//sysnb pipe2(p *[2]_C_int, flags int) (err error)
133−
134−func Pipe2(p []int, flags int) (err error) {
135− if len(p) != 2 {
136− return EINVAL
137− }
138− var pp [2]_C_int
139− err = pipe2(&pp, flags)
140− p[0] = int(pp[0])
141− p[1] = int(pp[1])
142− return
143−}
144−
145−//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
146−
147−func Poll(fds []PollFd, timeout int) (n int, err error) {
148− if len(fds) == 0 {
149− return poll(nil, 0, timeout)
150− }
151− return poll(&fds[0], len(fds), timeout)
152−}
vendor/golang.org/x/sys/unix/syscall_netbsd.godeleted−618

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_netbsd_386.godeleted−38

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.godeleted−38

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_netbsd_arm.godeleted−38

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.godeleted−38

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_openbsd.godeleted−390

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_openbsd_386.godeleted−42

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.godeleted−42

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_openbsd_arm.godeleted−42

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.godeleted−42

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.godeleted−35

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_solaris.godeleted−746

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_solaris_amd64.godeleted−28

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_unix.godeleted−431

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_unix_gc.godeleted−18

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.godeleted−25

This diff is too big to show here.

vendor/golang.org/x/sys/unix/syscall_zos_s390x.godeleted−1781

This diff is too big to show here.

vendor/golang.org/x/sys/unix/timestruct.godeleted−77

This diff is too big to show here.

vendor/golang.org/x/sys/unix/unveil_openbsd.godeleted−42

This diff is too big to show here.

vendor/golang.org/x/sys/unix/xattr_bsd.godeleted−241

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_aix_ppc.godeleted−1385

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.godeleted−1386

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_darwin_386.godeleted−1789

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.godeleted−1860

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_darwin_arm.godeleted−1789

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.godeleted−1860

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.godeleted−1738

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_freebsd_386.godeleted−1943

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.godeleted−1942

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.godeleted−1841

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.godeleted−1943

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux.godeleted−2808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_386.godeleted−801

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_amd64.godeleted−801

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_arm.godeleted−807

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_arm64.godeleted−798

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_mips.godeleted−808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_mips64.godeleted−808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.godeleted−808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.godeleted−808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.godeleted−864

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.godeleted−864

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.godeleted−788

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_s390x.godeleted−861

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.godeleted−858

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_netbsd_386.godeleted−1780

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.godeleted−1770

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.godeleted−1759

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.godeleted−1770

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_openbsd_386.godeleted−1665

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.godeleted−1775

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.godeleted−1667

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.godeleted−1798

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.godeleted−1863

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.godeleted−1557

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zerrors_zos_s390x.godeleted−832

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zptrace_armnn_linux.godeleted−42

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zptrace_linux_arm64.godeleted−17

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.godeleted−51

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.godeleted−51

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zptrace_x86_linux.godeleted−81

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.godeleted−1485

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.godeleted−1443

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.godeleted−1192

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.godeleted−1070

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.godeleted−40

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.sdeleted−12

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_386.godeleted−2431

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_386.sdeleted−290

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.godeleted−40

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.sdeleted−12

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.godeleted−2431

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.sdeleted−290

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.godeleted−40

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.sdeleted−12

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.godeleted−2417

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.sdeleted−288

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.godeleted−40

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.sdeleted−12

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.godeleted−2431

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.sdeleted−290

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.godeleted−1679

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.godeleted−2016

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.godeleted−2016

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.godeleted−2016

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.godeleted−2016

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.godeleted−128

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux.godeleted−1944

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_386.godeleted−579

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.godeleted−746

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_arm.godeleted−716

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.godeleted−603

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_mips.godeleted−759

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.godeleted−730

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.godeleted−730

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.godeleted−759

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.godeleted−808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.godeleted−808

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.godeleted−583

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.godeleted−578

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.godeleted−741

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.godeleted−1862

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.godeleted−1862

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.godeleted−1862

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.godeleted−1862

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.godeleted−1693

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.godeleted−1693

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.godeleted−1693

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.godeleted−1693

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.godeleted−1693

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.godeleted−1983

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.godeleted−1217

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.godeleted−274

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.godeleted−272

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.godeleted−274

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.godeleted−276

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.godeleted−280

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_darwin_386.godeleted−438

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.godeleted−440

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.godeleted−438

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.godeleted−438

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.godeleted−317

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.godeleted−397

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.godeleted−397

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.godeleted−397

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.godeleted−397

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_386.godeleted−441

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.godeleted−363

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_arm.godeleted−405

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.godeleted−308

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_mips.godeleted−426

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.godeleted−356

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.godeleted−356

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.godeleted−426

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.godeleted−405

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.godeleted−405

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.godeleted−307

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.godeleted−370

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.godeleted−384

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.godeleted−275

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.godeleted−275

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.godeleted−275

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.godeleted−275

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.godeleted−219

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.godeleted−219

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.godeleted−219

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.godeleted−218

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.godeleted−221

This diff is too big to show here.

vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.godeleted−2670

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_aix_ppc.godeleted−354

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.godeleted−358

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_darwin_386.godeleted−517

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.godeleted−530

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_darwin_arm.godeleted−517

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.godeleted−530

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.godeleted−471

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_freebsd_386.godeleted−720

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.godeleted−723

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.godeleted−704

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.godeleted−701

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.godeleted−40

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux.godeleted−3737

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_386.godeleted−620

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_amd64.godeleted−638

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_arm.godeleted−615

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_arm64.godeleted−617

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_mips.godeleted−621

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_mips64.godeleted−620

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.godeleted−620

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.godeleted−621

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.godeleted−627

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.godeleted−627

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.godeleted−645

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_s390x.godeleted−641

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.godeleted−622

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_netbsd_386.godeleted−500

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.godeleted−508

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.godeleted−505

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.godeleted−508

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_openbsd_386.godeleted−573

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.godeleted−573

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.godeleted−574

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.godeleted−567

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.godeleted−567

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.godeleted−442

This diff is too big to show here.

vendor/golang.org/x/sys/unix/ztypes_zos_s390x.godeleted−402

This diff is too big to show here.

vendor/modules.txtdeleted−11

This diff is too big to show here.