├── .dockerignore ├── .gitignore ├── LICENSE ├── README.md ├── docker ├── dockerfile.ancestor ├── dockerfile.build.rtorrent ├── dockerfile.build.rtorrent.alpine ├── dockerfile.build.rtorrent.ubuntu ├── dockerfile.entrypoint ├── dockerfile.run.dns ├── dockerfile.run.mktorrent ├── dockerfile.run.opentracker ├── dockerfile.run.router └── dockerfile.stage ├── entrypoint ├── go.mod ├── go.sum ├── main.go ├── update-vendor.sh ├── utils.go └── vendor │ ├── golang.org │ └── x │ │ └── sys │ │ ├── AUTHORS │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── internal │ │ └── unsafeheader │ │ │ └── unsafeheader.go │ │ └── unix │ │ ├── .gitignore │ │ ├── README.md │ │ ├── affinity_linux.go │ │ ├── aliases.go │ │ ├── asm_aix_ppc64.s │ │ ├── asm_bsd_386.s │ │ ├── asm_bsd_amd64.s │ │ ├── asm_bsd_arm.s │ │ ├── asm_bsd_arm64.s │ │ ├── asm_linux_386.s │ │ ├── asm_linux_amd64.s │ │ ├── asm_linux_arm.s │ │ ├── asm_linux_arm64.s │ │ ├── asm_linux_mips64x.s │ │ ├── asm_linux_mipsx.s │ │ ├── asm_linux_ppc64x.s │ │ ├── asm_linux_riscv64.s │ │ ├── asm_linux_s390x.s │ │ ├── asm_openbsd_mips64.s │ │ ├── asm_solaris_amd64.s │ │ ├── asm_zos_s390x.s │ │ ├── bluetooth_linux.go │ │ ├── cap_freebsd.go │ │ ├── constants.go │ │ ├── dev_aix_ppc.go │ │ ├── dev_aix_ppc64.go │ │ ├── dev_darwin.go │ │ ├── dev_dragonfly.go │ │ ├── dev_freebsd.go │ │ ├── dev_linux.go │ │ ├── dev_netbsd.go │ │ ├── dev_openbsd.go │ │ ├── dev_zos.go │ │ ├── dirent.go │ │ ├── endian_big.go │ │ ├── endian_little.go │ │ ├── env_unix.go │ │ ├── epoll_zos.go │ │ ├── errors_freebsd_386.go │ │ ├── errors_freebsd_amd64.go │ │ ├── errors_freebsd_arm.go │ │ ├── errors_freebsd_arm64.go │ │ ├── fcntl.go │ │ ├── fcntl_darwin.go │ │ ├── fcntl_linux_32bit.go │ │ ├── fdset.go │ │ ├── fstatfs_zos.go │ │ ├── gccgo.go │ │ ├── gccgo_c.c │ │ ├── gccgo_linux_amd64.go │ │ ├── ioctl.go │ │ ├── ioctl_linux.go │ │ ├── ioctl_zos.go │ │ ├── mkall.sh │ │ ├── mkerrors.sh │ │ ├── pagesize_unix.go │ │ ├── pledge_openbsd.go │ │ ├── ptrace_darwin.go │ │ ├── ptrace_ios.go │ │ ├── race.go │ │ ├── race0.go │ │ ├── readdirent_getdents.go │ │ ├── readdirent_getdirentries.go │ │ ├── sockcmsg_dragonfly.go │ │ ├── sockcmsg_linux.go │ │ ├── sockcmsg_unix.go │ │ ├── sockcmsg_unix_other.go │ │ ├── str.go │ │ ├── syscall.go │ │ ├── syscall_aix.go │ │ ├── syscall_aix_ppc.go │ │ ├── syscall_aix_ppc64.go │ │ ├── syscall_bsd.go │ │ ├── syscall_darwin.1_12.go │ │ ├── syscall_darwin.1_13.go │ │ ├── syscall_darwin.go │ │ ├── syscall_darwin_amd64.go │ │ ├── syscall_darwin_arm64.go │ │ ├── syscall_darwin_libSystem.go │ │ ├── syscall_dragonfly.go │ │ ├── syscall_dragonfly_amd64.go │ │ ├── syscall_freebsd.go │ │ ├── syscall_freebsd_386.go │ │ ├── syscall_freebsd_amd64.go │ │ ├── syscall_freebsd_arm.go │ │ ├── syscall_freebsd_arm64.go │ │ ├── syscall_illumos.go │ │ ├── syscall_linux.go │ │ ├── syscall_linux_386.go │ │ ├── syscall_linux_amd64.go │ │ ├── syscall_linux_amd64_gc.go │ │ ├── syscall_linux_arm.go │ │ ├── syscall_linux_arm64.go │ │ ├── syscall_linux_gc.go │ │ ├── syscall_linux_gc_386.go │ │ ├── syscall_linux_gc_arm.go │ │ ├── syscall_linux_gccgo_386.go │ │ ├── syscall_linux_gccgo_arm.go │ │ ├── syscall_linux_mips64x.go │ │ ├── syscall_linux_mipsx.go │ │ ├── syscall_linux_ppc.go │ │ ├── syscall_linux_ppc64x.go │ │ ├── syscall_linux_riscv64.go │ │ ├── syscall_linux_s390x.go │ │ ├── syscall_linux_sparc64.go │ │ ├── syscall_netbsd.go │ │ ├── syscall_netbsd_386.go │ │ ├── syscall_netbsd_amd64.go │ │ ├── syscall_netbsd_arm.go │ │ ├── syscall_netbsd_arm64.go │ │ ├── syscall_openbsd.go │ │ ├── syscall_openbsd_386.go │ │ ├── syscall_openbsd_amd64.go │ │ ├── syscall_openbsd_arm.go │ │ ├── syscall_openbsd_arm64.go │ │ ├── syscall_openbsd_mips64.go │ │ ├── syscall_solaris.go │ │ ├── syscall_solaris_amd64.go │ │ ├── syscall_unix.go │ │ ├── syscall_unix_gc.go │ │ ├── syscall_unix_gc_ppc64x.go │ │ ├── syscall_zos_s390x.go │ │ ├── timestruct.go │ │ ├── unveil_openbsd.go │ │ ├── xattr_bsd.go │ │ ├── zerrors_aix_ppc.go │ │ ├── zerrors_aix_ppc64.go │ │ ├── zerrors_darwin_amd64.go │ │ ├── zerrors_darwin_arm64.go │ │ ├── zerrors_dragonfly_amd64.go │ │ ├── zerrors_freebsd_386.go │ │ ├── zerrors_freebsd_amd64.go │ │ ├── zerrors_freebsd_arm.go │ │ ├── zerrors_freebsd_arm64.go │ │ ├── zerrors_linux.go │ │ ├── zerrors_linux_386.go │ │ ├── zerrors_linux_amd64.go │ │ ├── zerrors_linux_arm.go │ │ ├── zerrors_linux_arm64.go │ │ ├── zerrors_linux_mips.go │ │ ├── zerrors_linux_mips64.go │ │ ├── zerrors_linux_mips64le.go │ │ ├── zerrors_linux_mipsle.go │ │ ├── zerrors_linux_ppc.go │ │ ├── zerrors_linux_ppc64.go │ │ ├── zerrors_linux_ppc64le.go │ │ ├── zerrors_linux_riscv64.go │ │ ├── zerrors_linux_s390x.go │ │ ├── zerrors_linux_sparc64.go │ │ ├── zerrors_netbsd_386.go │ │ ├── zerrors_netbsd_amd64.go │ │ ├── zerrors_netbsd_arm.go │ │ ├── zerrors_netbsd_arm64.go │ │ ├── zerrors_openbsd_386.go │ │ ├── zerrors_openbsd_amd64.go │ │ ├── zerrors_openbsd_arm.go │ │ ├── zerrors_openbsd_arm64.go │ │ ├── zerrors_openbsd_mips64.go │ │ ├── zerrors_solaris_amd64.go │ │ ├── zerrors_zos_s390x.go │ │ ├── zptrace_armnn_linux.go │ │ ├── zptrace_linux_arm64.go │ │ ├── zptrace_mipsnn_linux.go │ │ ├── zptrace_mipsnnle_linux.go │ │ ├── zptrace_x86_linux.go │ │ ├── zsyscall_aix_ppc.go │ │ ├── zsyscall_aix_ppc64.go │ │ ├── zsyscall_aix_ppc64_gc.go │ │ ├── zsyscall_aix_ppc64_gccgo.go │ │ ├── zsyscall_darwin_amd64.1_13.go │ │ ├── zsyscall_darwin_amd64.1_13.s │ │ ├── zsyscall_darwin_amd64.go │ │ ├── zsyscall_darwin_amd64.s │ │ ├── zsyscall_darwin_arm64.1_13.go │ │ ├── zsyscall_darwin_arm64.1_13.s │ │ ├── zsyscall_darwin_arm64.go │ │ ├── zsyscall_darwin_arm64.s │ │ ├── zsyscall_dragonfly_amd64.go │ │ ├── zsyscall_freebsd_386.go │ │ ├── zsyscall_freebsd_amd64.go │ │ ├── zsyscall_freebsd_arm.go │ │ ├── zsyscall_freebsd_arm64.go │ │ ├── zsyscall_illumos_amd64.go │ │ ├── zsyscall_linux.go │ │ ├── zsyscall_linux_386.go │ │ ├── zsyscall_linux_amd64.go │ │ ├── zsyscall_linux_arm.go │ │ ├── zsyscall_linux_arm64.go │ │ ├── zsyscall_linux_mips.go │ │ ├── zsyscall_linux_mips64.go │ │ ├── zsyscall_linux_mips64le.go │ │ ├── zsyscall_linux_mipsle.go │ │ ├── zsyscall_linux_ppc.go │ │ ├── zsyscall_linux_ppc64.go │ │ ├── zsyscall_linux_ppc64le.go │ │ ├── zsyscall_linux_riscv64.go │ │ ├── zsyscall_linux_s390x.go │ │ ├── zsyscall_linux_sparc64.go │ │ ├── zsyscall_netbsd_386.go │ │ ├── zsyscall_netbsd_amd64.go │ │ ├── zsyscall_netbsd_arm.go │ │ ├── zsyscall_netbsd_arm64.go │ │ ├── zsyscall_openbsd_386.go │ │ ├── zsyscall_openbsd_amd64.go │ │ ├── zsyscall_openbsd_arm.go │ │ ├── zsyscall_openbsd_arm64.go │ │ ├── zsyscall_openbsd_mips64.go │ │ ├── zsyscall_solaris_amd64.go │ │ ├── zsyscall_zos_s390x.go │ │ ├── zsysctl_openbsd_386.go │ │ ├── zsysctl_openbsd_amd64.go │ │ ├── zsysctl_openbsd_arm.go │ │ ├── zsysctl_openbsd_arm64.go │ │ ├── zsysctl_openbsd_mips64.go │ │ ├── zsysnum_darwin_amd64.go │ │ ├── zsysnum_darwin_arm64.go │ │ ├── zsysnum_dragonfly_amd64.go │ │ ├── zsysnum_freebsd_386.go │ │ ├── zsysnum_freebsd_amd64.go │ │ ├── zsysnum_freebsd_arm.go │ │ ├── zsysnum_freebsd_arm64.go │ │ ├── zsysnum_linux_386.go │ │ ├── zsysnum_linux_amd64.go │ │ ├── zsysnum_linux_arm.go │ │ ├── zsysnum_linux_arm64.go │ │ ├── zsysnum_linux_mips.go │ │ ├── zsysnum_linux_mips64.go │ │ ├── zsysnum_linux_mips64le.go │ │ ├── zsysnum_linux_mipsle.go │ │ ├── zsysnum_linux_ppc.go │ │ ├── zsysnum_linux_ppc64.go │ │ ├── zsysnum_linux_ppc64le.go │ │ ├── zsysnum_linux_riscv64.go │ │ ├── zsysnum_linux_s390x.go │ │ ├── zsysnum_linux_sparc64.go │ │ ├── zsysnum_netbsd_386.go │ │ ├── zsysnum_netbsd_amd64.go │ │ ├── zsysnum_netbsd_arm.go │ │ ├── zsysnum_netbsd_arm64.go │ │ ├── zsysnum_openbsd_386.go │ │ ├── zsysnum_openbsd_amd64.go │ │ ├── zsysnum_openbsd_arm.go │ │ ├── zsysnum_openbsd_arm64.go │ │ ├── zsysnum_openbsd_mips64.go │ │ ├── zsysnum_zos_s390x.go │ │ ├── ztypes_aix_ppc.go │ │ ├── ztypes_aix_ppc64.go │ │ ├── ztypes_darwin_amd64.go │ │ ├── ztypes_darwin_arm64.go │ │ ├── ztypes_dragonfly_amd64.go │ │ ├── ztypes_freebsd_386.go │ │ ├── ztypes_freebsd_amd64.go │ │ ├── ztypes_freebsd_arm.go │ │ ├── ztypes_freebsd_arm64.go │ │ ├── ztypes_illumos_amd64.go │ │ ├── ztypes_linux.go │ │ ├── ztypes_linux_386.go │ │ ├── ztypes_linux_amd64.go │ │ ├── ztypes_linux_arm.go │ │ ├── ztypes_linux_arm64.go │ │ ├── ztypes_linux_mips.go │ │ ├── ztypes_linux_mips64.go │ │ ├── ztypes_linux_mips64le.go │ │ ├── ztypes_linux_mipsle.go │ │ ├── ztypes_linux_ppc.go │ │ ├── ztypes_linux_ppc64.go │ │ ├── ztypes_linux_ppc64le.go │ │ ├── ztypes_linux_riscv64.go │ │ ├── ztypes_linux_s390x.go │ │ ├── ztypes_linux_sparc64.go │ │ ├── ztypes_netbsd_386.go │ │ ├── ztypes_netbsd_amd64.go │ │ ├── ztypes_netbsd_arm.go │ │ ├── ztypes_netbsd_arm64.go │ │ ├── ztypes_openbsd_386.go │ │ ├── ztypes_openbsd_amd64.go │ │ ├── ztypes_openbsd_arm.go │ │ ├── ztypes_openbsd_arm64.go │ │ ├── ztypes_openbsd_mips64.go │ │ ├── ztypes_solaris_amd64.go │ │ └── ztypes_zos_s390x.go │ └── modules.txt ├── functions ├── TODO.md ├── _args │ ├── rdo_docker │ ├── rdo_stage │ ├── rdo_stage_append_rc │ ├── rdo_stage_dns │ ├── rdo_stage_network │ ├── rdo_stage_rtorrent │ └── rdo_stage_tracker ├── build ├── build.context ├── common.container ├── common.image ├── common.init ├── common.system ├── common │ ├── args │ ├── init │ └── utils ├── docker ├── docker.clean ├── git ├── init ├── machine ├── network ├── run ├── stage ├── tags ├── torrent └── torrent.wait ├── misc ├── docker-machine.bash ├── docker.bash ├── entrypoint.sh ├── gen-bash-profile ├── opentracker.diff ├── pkg-add ├── pkg-copy ├── rancheros │ └── os-service-docker-engine-20.10.8.yaml ├── rdo-file-move ├── rdo-find-move ├── rdo-iptables-flush ├── rsync-stage-compile ├── rtorrent-docker.bash ├── stat-list-mtime └── stat-update-mtime ├── rdo ├── templates ├── rc │ └── rt-default └── run │ ├── dns-default │ ├── empty │ ├── rt-default │ └── tracker-default └── tests ├── ci-all ├── ci-choke-groups ├── ci-default ├── ci-low-diskspace ├── ci-nat ├── ci-options ├── ci-priority ├── ci-throttle ├── ci-torrents ├── ci-tracker └── unit-all /.dockerignore: -------------------------------------------------------------------------------- 1 | # Git itnore for rtorrent docker project. 2 | 3 | .dockerignore 4 | .git 5 | context/* 6 | data/*/.git 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Editor poo # 2 | ############## 3 | .#* 4 | \#*# 5 | *~ 6 | *.orig 7 | 8 | # OS generated files # 9 | ###################### 10 | .DS_Store? 11 | .dirstamp 12 | ehthumbs.db 13 | Icon? 14 | Thumbs.db 15 | TAGS 16 | 17 | context/* 18 | data/* 19 | run/* 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | RTorrent Docker Test Environment 2 | ================================ 3 | 4 | Getting Started 5 | --------------- 6 | 7 | ```bash 8 | # On linux systems: 9 | ./rdo init default 10 | 11 | # On non-linux systems: 12 | ./rdo init machine 13 | 14 | ./rdo bash 15 | ``` 16 | 17 | Initialize the environment and start a custom bash session. 18 | 19 | All commands assume you are working within the custom bash session. 20 | 21 | 22 | Clone Repositories 23 | ------------------ 24 | 25 | ```bash 26 | rdo git clone 27 | ``` 28 | 29 | Clones the git repositories. 30 | 31 | 32 | Prepare Autoconf Scripts 33 | ------------------------ 34 | 35 | ```bash 36 | # This will fail when attempting to build libtorrent due to missing autoconf scripts. 37 | rdo build all 38 | 39 | docker run --rm -it --mount "type=bind,source=${PWD}/data,target=/data/" rdo/build/rtorrent/compiler:alpine-3 /bin/bash 40 | ``` 41 | 42 | While in the docker container, run the following: 43 | 44 | ```bash 45 | cd /data/libtorrent 46 | 47 | libtoolize 48 | aclocal -I scripts 49 | autoconf -i 50 | autoheader 51 | automake --add-missing 52 | 53 | cd /data/rtorrent 54 | 55 | libtoolize 56 | aclocal -I scripts 57 | autoconf -i 58 | autoheader 59 | automake --add-missing 60 | ``` 61 | 62 | 63 | Build Docker Images 64 | ------------------- 65 | 66 | ```bash 67 | rdo build all 68 | ``` 69 | 70 | 71 | Run CI tests 72 | ------------ 73 | 74 | ```bash 75 | rdo batch tests/ci-all 76 | ``` 77 | 78 | 79 | Cleanup for Release 80 | ------------------- 81 | 82 | ``` 83 | make maintainer-clean 84 | autoreconf --force --install 85 | ``` 86 | -------------------------------------------------------------------------------- /docker/dockerfile.ancestor: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:experimental 2 | # 3 | # A common ancestor image that allows for easy deletion of all images 4 | # created by this project. 5 | # 6 | # /build - use this for any intermediate processing 7 | # /deploy - use copy only relevant files here 8 | # /empty - empty file allowing docker copy of possibly missing files 9 | # /prefix - install resulting builds here 10 | # /stage - initially copy docker context here 11 | 12 | ARG BASE_IMAGE 13 | 14 | 15 | FROM "${BASE_IMAGE}" 16 | 17 | ENV RDO_RSYNC_ADD_ARGS="-rlpgoD -muc -t" 18 | ENV RDO_RSYNC_UPDATE_ARGS="-rlpgoD -muc -t --delete-after" 19 | 20 | ENV RDO_CP_A_ARGS="-a" 21 | ENV RDO_TAR_C_ARGS="--warning=no-unknown-keyword --format pax --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime --sort=name -cf" 22 | ENV RDO_TAR_X_ARGS="--warning=no-unknown-keyword --format pax --sort=name -xf" 23 | 24 | WORKDIR /run/self 25 | 26 | COPY bin/* /usr/bin/ 27 | 28 | RUN mkdir -p /build /deploy /prefix /stage 29 | 30 | RUN \ 31 | --mount=type=cache,id=rdo-apk-cache,sharing=locked,target=/var/cache/apk/ \ 32 | --mount=type=cache,id=rdo-ubuntu-apt-cache,sharing=locked,target=/var/lib/apt/lists/ \ 33 | \ 34 | if [ -f "/etc/alpine-release" ]; then \ 35 | apk add \ 36 | bash \ 37 | bind-tools \ 38 | coreutils \ 39 | diffutils \ 40 | findutils \ 41 | iproute2 \ 42 | iptables \ 43 | ip6tables \ 44 | netcat-openbsd \ 45 | tar \ 46 | tmux; \ 47 | elif [ -f "/etc/debian_version" ]; then \ 48 | apt-get update; \ 49 | apt-get install -y \ 50 | tmux; \ 51 | else \ 52 | echo "unknown distrobution"; \ 53 | exit 1; \ 54 | fi 55 | 56 | ARG ANCESTOR_PROJECT 57 | 58 | LABEL ancestor_project_root="rdo" 59 | LABEL ancestor_project="${ANCESTOR_PROJECT}" 60 | -------------------------------------------------------------------------------- /docker/dockerfile.build.rtorrent.alpine: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:experimental 2 | 3 | ARG REPOSITORY 4 | 5 | 6 | FROM "${REPOSITORY}/ancestor/build:alpine-3" AS compiler 7 | 8 | ARG RDO_COMPILER="clang" 9 | ENV RDO_COMPILER="${RDO_COMPILER}" 10 | 11 | ARG ADD_PACKAGES="" 12 | ENV ADD_PACKAGES="${ADD_PACKAGES}" 13 | 14 | ENV LD_LIBRARY_PATH="/prefix/lib" 15 | 16 | RUN --mount=type=cache,id=rdo-apk-cache,sharing=locked,target=/var/cache/apk/ \ 17 | \ 18 | apk add \ 19 | autoconf \ 20 | autoconf-archive \ 21 | automake \ 22 | binutils \ 23 | file \ 24 | libtool \ 25 | linux-headers \ 26 | make \ 27 | pkgconf \ 28 | \ 29 | cppunit-dev \ 30 | curl-dev \ 31 | libc-dev \ 32 | musl-dev \ 33 | ncurses-dev \ 34 | openssl-dev \ 35 | zlib-dev \ 36 | ${ADD_PACKAGES}; \ 37 | \ 38 | echo -e "\033[0;32musing compiler family ${RDO_COMPILER}\033[0m"; set -xe; \ 39 | \ 40 | if [ "${RDO_COMPILER}" = "clang" ]; then \ 41 | # clang requires crtbeginS.o from gcc and std headers from g++ \ 42 | echo "export CC=clang CXX=clang++" >> /env.configure; \ 43 | apk add \ 44 | gcc \ 45 | g++ \ 46 | gdb \ 47 | clang; \ 48 | \ 49 | elif [ "${RDO_COMPILER}" = "gcc" ]; then \ 50 | echo "export CC=gcc CXX=g++" >> /env.configure; \ 51 | apk add \ 52 | gcc \ 53 | g++ \ 54 | gdb; \ 55 | \ 56 | else \ 57 | echo -e "\033[0;31munknown compiler family: ${RDO_COMPILER}\033[0m"; \ 58 | exit 1; \ 59 | fi 60 | 61 | RUN echo -e "\033[0;32msetting configure flags\033[0m"; set -xe; \ 62 | \ 63 | echo "export PKG_CONFIG_PATH=\"/prefix/lib/pkgconfig:/usr/lib/pkgconfig\"" >> /env.configure; \ 64 | echo "export CXXFLAGS=\"-Wno-exceptions -Wno-pessimizing-move\"" >> /env.configure 65 | 66 | 67 | FROM "${REPOSITORY}/ancestor/run:alpine-3" AS run 68 | 69 | ARG ADD_PACKAGES="" 70 | ENV ADD_PACKAGES="${ADD_PACKAGES}" 71 | 72 | ENV LD_LIBRARY_PATH="/prefix/lib" 73 | 74 | RUN --mount=type=cache,id=rdo-apk-cache,sharing=locked,target=/var/cache/apk/ \ 75 | \ 76 | apk add \ 77 | curl \ 78 | cppunit \ 79 | libgcc \ 80 | libstdc++ \ 81 | lldb \ 82 | musl \ 83 | ncurses \ 84 | openssl \ 85 | tcpdump \ 86 | zlib \ 87 | ${ADD_PACKAGES} 88 | 89 | 90 | # Fake endpoint: 91 | FROM "scratch" 92 | -------------------------------------------------------------------------------- /docker/dockerfile.build.rtorrent.ubuntu: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:experimental 2 | 3 | ARG DISTRO_VERSION 4 | ARG REPOSITORY 5 | 6 | FROM "${REPOSITORY}/ancestor/build:${DISTRO_VERSION}" AS compiler 7 | 8 | ARG RDO_COMPILER="clang" 9 | ENV RDO_COMPILER="${RDO_COMPILER}" 10 | 11 | RUN chsh -s /bin/bash 12 | 13 | RUN --mount=type=cache,id=rdo-ubuntu-apt-cache,sharing=locked,target=/var/lib/apt/lists/; set -eux; \ 14 | \ 15 | apt-get update; \ 16 | \ 17 | apt-get install -y \ 18 | autoconf \ 19 | automake \ 20 | binutils \ 21 | file \ 22 | libtool \ 23 | linux-headers-generic \ 24 | make \ 25 | pkgconf \ 26 | \ 27 | libc-dev \ 28 | libcppunit-dev \ 29 | libcurl4-openssl-dev \ 30 | ncurses-dev \ 31 | libssl-dev \ 32 | zlib1g-dev; \ 33 | \ 34 | echo -e "\033[0;32musing compiler family ${RDO_COMPILER}\033[0m"; set -xe; \ 35 | \ 36 | if [ "${RDO_COMPILER}" = "clang" ]; then \ 37 | # clang requires crtbeginS.o from gcc and std headers from g++ \ 38 | echo "export CC=clang CXX=clang++" >> /env.configure; \ 39 | DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ 40 | apt-get install -y \ 41 | gcc \ 42 | g++ \ 43 | gdb \ 44 | clang; \ 45 | \ 46 | elif [ "${RDO_COMPILER}" = "gcc" ]; then \ 47 | echo "export CC=gcc CXX=g++" >> /env.configure; \ 48 | DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ 49 | apt-get install -y \ 50 | gcc \ 51 | g++ \ 52 | gdb; \ 53 | \ 54 | else \ 55 | echo -e "\033[0;31munknown compiler family: ${RDO_COMPILER}\033[0m"; \ 56 | exit 1; \ 57 | fi; \ 58 | \ 59 | apt list --installed 60 | 61 | RUN echo -e "\033[0;32msetting configure flags\033[0m"; set -eux; \ 62 | \ 63 | echo "export PKG_CONFIG_PATH=\"/prefix/lib/pkgconfig:/usr/lib/pkgconfig\"" >> /env.configure; \ 64 | echo "export CXXFLAGS=\"-Wno-exceptions -Wno-pessimizing-move\"" >> /env.configure 65 | 66 | 67 | FROM "${REPOSITORY}/ancestor/run:${DISTRO_VERSION}" AS run 68 | 69 | ARG DISTRO_VERSION 70 | ENV DISTRO_VERSION="${DISTRO_VERSION}" 71 | 72 | RUN chsh -s /bin/bash 73 | 74 | RUN --mount=type=cache,id=rdo-ubuntu-apt-cache,sharing=locked,target=/var/lib/apt/lists/; set -eux; \ 75 | \ 76 | apt-get update; \ 77 | apt-cache search --names-only '^libcppunit'; \ 78 | \ 79 | apt-get install -y \ 80 | libcurl4 \ 81 | zlib1g \ 82 | \ 83 | libgcc-s1 \ 84 | libstdc++6 \ 85 | lldb \ 86 | musl \ 87 | ncurses-base \ 88 | tcpdump; \ 89 | \ 90 | if [ "${DISTRO_VERSION}" = "ubuntu-20.04" ]; then \ 91 | apt-get install -y \ 92 | libssl1.1; \ 93 | elif [ "${DISTRO_VERSION}" = "ubuntu-22.04" ]; then \ 94 | apt-get install -y \ 95 | libssl3; \ 96 | fi; 97 | 98 | 99 | # Fake endpoint: 100 | FROM "scratch" 101 | -------------------------------------------------------------------------------- /docker/dockerfile.entrypoint: -------------------------------------------------------------------------------- 1 | FROM golang:1.16.4-alpine3.13 AS builder 2 | 3 | WORKDIR /build 4 | 5 | RUN set -xe; \ 6 | apk add --no-cache \ 7 | curl \ 8 | gcc \ 9 | musl-dev 10 | 11 | ENV CGO_ENABLED=0 12 | ENV GO111MODULE=on 13 | ENV GOARCH=amd64 14 | ENV GOOS=linux 15 | 16 | COPY . ./ 17 | 18 | RUN go build \ 19 | -v \ 20 | -mod=readonly \ 21 | -mod=vendor \ 22 | -ldflags "-linkmode external -extldflags '-static -fno-PIC' -s -w" 23 | 24 | 25 | FROM scratch 26 | 27 | COPY --from=builder /build/entrypoint / 28 | -------------------------------------------------------------------------------- /docker/dockerfile.run.dns: -------------------------------------------------------------------------------- 1 | ARG REPOSITORY 2 | 3 | 4 | FROM "${REPOSITORY}/build/entrypoint:global" AS entrypoint 5 | 6 | 7 | FROM "rtdo/docker-container-dns:latest" 8 | 9 | COPY --from=entrypoint /entrypoint / 10 | 11 | ENTRYPOINT ["/entrypoint"] 12 | -------------------------------------------------------------------------------- /docker/dockerfile.run.mktorrent: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:experimental 2 | 3 | ARG REPOSITORY 4 | ARG TAG_APPEND 5 | 6 | 7 | FROM "${REPOSITORY}/ancestor/utils:alpine-3" 8 | 9 | RUN --mount=type=cache,id=rdo-apk-cache,sharing=locked,target=/var/cache/apk/ \ 10 | \ 11 | apk add \ 12 | mktorrent 13 | 14 | CMD tail -f /dev/null 15 | -------------------------------------------------------------------------------- /docker/dockerfile.run.router: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:experimental 2 | 3 | ARG REPOSITORY 4 | ARG TAG_APPEND 5 | 6 | 7 | FROM "${REPOSITORY}/ancestor/run:alpine-3" 8 | 9 | COPY entrypoint.sh / 10 | 11 | ENTRYPOINT /entrypoint.sh 12 | -------------------------------------------------------------------------------- /docker/dockerfile.stage: -------------------------------------------------------------------------------- 1 | # Stage build files in a separate container so as to ensure caches 2 | # work when no relevant files have been changed. 3 | # 4 | # The docker cache works by matching that both build instructions and 5 | # volume content match at each step, while docker context is 6 | # ignored. 7 | # 8 | # Thus while this container is always rebuilt on changes in the 9 | # project directory, the container that pulls the content from 10 | # '/deploy' only invalidates its cache if the content of 11 | # '/deploy' changed. 12 | 13 | ARG REPOSITORY 14 | 15 | FROM "${REPOSITORY}/ancestor/build:alpine-3" 16 | 17 | WORKDIR /stage 18 | -------------------------------------------------------------------------------- /entrypoint/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/rakshasa/rdo/entrypoint 2 | 3 | go 1.16 4 | 5 | require golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 6 | -------------------------------------------------------------------------------- /entrypoint/go.sum: -------------------------------------------------------------------------------- 1 | golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8= 2 | golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 3 | -------------------------------------------------------------------------------- /entrypoint/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | // "context" 5 | "io/ioutil" 6 | "log" 7 | "os" 8 | "os/exec" 9 | "path/filepath" 10 | ) 11 | 12 | var ( 13 | statePath = filepath.Join("/", "run", "self", "state") 14 | ) 15 | 16 | func init() { 17 | } 18 | 19 | func writeState(state string) { 20 | if err := ioutil.WriteFile(statePath, []byte(state+"\n"), 0644); err != nil { 21 | log.Fatalf("entrypoint: failed to update state file: %v", err) 22 | } 23 | } 24 | 25 | func main() { 26 | log.Printf("entrypoint: starting") 27 | 28 | if err := checkRegularAccess(statePath); err != nil { 29 | log.Fatalf("entrypoint: failed to verify state file: %v", err) 30 | } 31 | 32 | log.Printf("entrypoint: staging") 33 | 34 | writeState("staging") 35 | 36 | // ctx, cancel := context.WithCancel(context.Background()) 37 | // ctx := context.Background() 38 | 39 | success := make(chan int, 1) 40 | failed := make(chan error, 1) 41 | 42 | go func() { 43 | log.Printf("executing: /run/self/run") 44 | cmd := exec.Command("/bin/sh", "/run/self/run") 45 | 46 | cmd.Stdout = os.Stdout 47 | cmd.Stderr = os.Stderr 48 | 49 | err := cmd.Run() 50 | if err != nil { 51 | failed <- err 52 | return 53 | } 54 | 55 | success <- 0 56 | }() 57 | 58 | writeState("running") 59 | 60 | select { 61 | case <-success: 62 | log.Printf("entrypoint: done") 63 | case err := <-failed: 64 | log.Printf("entrypoint: execution error: %v", err) 65 | } 66 | 67 | log.Printf("entrypoint: terminating") 68 | 69 | writeState("exited") 70 | } 71 | -------------------------------------------------------------------------------- /entrypoint/update-vendor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROJECT_PATH="$(cd "$(cd "$( dirname "${BASH_SOURCE[0]}" )" && git rev-parse --show-toplevel)" >/dev/null 2>&1 && pwd)/entrypoint" 4 | 5 | MODULE_PATH="github.com/rakshasa/rdo/entrypoint" 6 | 7 | GO_MODULES=( 8 | ) 9 | 10 | set -xeu 11 | 12 | cd "${PROJECT_PATH}" 13 | 14 | rm -f ./go.{mod,sum} 15 | go clean -cache 16 | 17 | go mod init "${MODULE_PATH}" 18 | 19 | for mod in "${GO_MODULES[@]}"; do 20 | go get -u -v "${mod}" 21 | done 22 | 23 | go mod tidy -v 24 | go mod vendor -v 25 | -------------------------------------------------------------------------------- /entrypoint/utils.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | func checkDirectoryExistsAndAccess(path string) (bool, error) { 12 | fileInfo, err := checkAccessAndFileInfo(path, unix.R_OK|unix.W_OK|unix.X_OK) 13 | if err != nil { 14 | if !os.IsNotExist(err) { 15 | return false, err 16 | } 17 | 18 | return false, nil 19 | } 20 | if !fileInfo.Mode().IsDir() { 21 | return false, fmt.Errorf("is not a directory: %s", path) 22 | } 23 | 24 | return true, nil 25 | } 26 | 27 | func checkDirectoryAccess(path string) error { 28 | exists, err := checkDirectoryExistsAndAccess(path) 29 | if err != nil { 30 | return err 31 | } 32 | if !exists { 33 | return fmt.Errorf("does not exist: %s", path) 34 | } 35 | 36 | return nil 37 | } 38 | 39 | func checkRegularExistsAndAccess(path string) (bool, error) { 40 | fileInfo, err := checkAccessAndFileInfo(path, unix.R_OK|unix.W_OK) 41 | if err != nil { 42 | if !os.IsNotExist(err) { 43 | return false, err 44 | } 45 | 46 | return false, nil 47 | } 48 | if !fileInfo.Mode().IsRegular() { 49 | return false, fmt.Errorf("is not a regular file: %s", path) 50 | } 51 | 52 | return true, nil 53 | } 54 | 55 | func checkRegularAccess(path string) error { 56 | exists, err := checkRegularExistsAndAccess(path) 57 | if err != nil { 58 | return err 59 | } 60 | if !exists { 61 | return fmt.Errorf("does not exist: %s", path) 62 | } 63 | 64 | return nil 65 | } 66 | 67 | func checkAccessAndFileInfo(path string, mode uint32) (os.FileInfo, error) { 68 | fileInfo, err := os.Stat(path) 69 | if err != nil { 70 | if !os.IsNotExist(err) { 71 | return nil, fmt.Errorf("stat failed: %v", err) 72 | } 73 | 74 | return nil, err 75 | } 76 | if err = unix.Access(path, mode); err != nil { 77 | return nil, fmt.Errorf("insufficient permission: %v", err) 78 | } 79 | 80 | return fileInfo, nil 81 | } 82 | 83 | func checkParentDirectoryAndMkdir(path string) error { 84 | dirPath := filepath.Dir(path) 85 | 86 | exists, err := checkDirectoryExistsAndAccess(dirPath) 87 | if err != nil { 88 | return err 89 | } 90 | if !exists { 91 | return fmt.Errorf("does not exist: %s", dirPath) 92 | } 93 | 94 | if err := os.Mkdir(path, os.ModePerm); err != nil { 95 | return err 96 | } 97 | 98 | return nil 99 | } 100 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 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. 4 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 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. 4 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 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. 28 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 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. 23 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go: -------------------------------------------------------------------------------- 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 | } 31 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/affinity_linux.go: -------------------------------------------------------------------------------- 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 | } 87 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 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 16 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 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 gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 12 | // 13 | 14 | TEXT ·syscall6(SB),NOSPLIT,$0-88 15 | JMP syscall·syscall6(SB) 16 | 17 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 18 | JMP syscall·rawSyscall6(SB) 19 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_bsd_386.s: -------------------------------------------------------------------------------- 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 (freebsd || netbsd || openbsd) && gc 6 | // +build 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) 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s: -------------------------------------------------------------------------------- 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) 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_bsd_arm.s: -------------------------------------------------------------------------------- 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 (freebsd || netbsd || openbsd) && gc 6 | // +build 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) 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s: -------------------------------------------------------------------------------- 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) 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 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 gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for 386, Linux 12 | // 13 | 14 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 15 | // instead of the glibc-specific "CALL 0x10(GS)". 16 | #define INVOKE_SYSCALL INT $0x80 17 | 18 | // Just jump to package syscall's implementation for all these functions. 19 | // The runtime may know about them. 20 | 21 | TEXT ·Syscall(SB),NOSPLIT,$0-28 22 | JMP syscall·Syscall(SB) 23 | 24 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 25 | JMP syscall·Syscall6(SB) 26 | 27 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 28 | CALL runtime·entersyscall(SB) 29 | MOVL trap+0(FP), AX // syscall entry 30 | MOVL a1+4(FP), BX 31 | MOVL a2+8(FP), CX 32 | MOVL a3+12(FP), DX 33 | MOVL $0, SI 34 | MOVL $0, DI 35 | INVOKE_SYSCALL 36 | MOVL AX, r1+16(FP) 37 | MOVL DX, r2+20(FP) 38 | CALL runtime·exitsyscall(SB) 39 | RET 40 | 41 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 42 | JMP syscall·RawSyscall(SB) 43 | 44 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 45 | JMP syscall·RawSyscall6(SB) 46 | 47 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 48 | MOVL trap+0(FP), AX // syscall entry 49 | MOVL a1+4(FP), BX 50 | MOVL a2+8(FP), CX 51 | MOVL a3+12(FP), DX 52 | MOVL $0, SI 53 | MOVL $0, DI 54 | INVOKE_SYSCALL 55 | MOVL AX, r1+16(FP) 56 | MOVL DX, r2+20(FP) 57 | RET 58 | 59 | TEXT ·socketcall(SB),NOSPLIT,$0-36 60 | JMP syscall·socketcall(SB) 61 | 62 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 63 | JMP syscall·rawsocketcall(SB) 64 | 65 | TEXT ·seek(SB),NOSPLIT,$0-28 66 | JMP syscall·seek(SB) 67 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 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 gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for AMD64, Linux 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | JMP syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | JMP syscall·Syscall6(SB) 22 | 23 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 24 | CALL runtime·entersyscall(SB) 25 | MOVQ a1+8(FP), DI 26 | MOVQ a2+16(FP), SI 27 | MOVQ a3+24(FP), DX 28 | MOVQ $0, R10 29 | MOVQ $0, R8 30 | MOVQ $0, R9 31 | MOVQ trap+0(FP), AX // syscall entry 32 | SYSCALL 33 | MOVQ AX, r1+32(FP) 34 | MOVQ DX, r2+40(FP) 35 | CALL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 39 | JMP syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 42 | JMP syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 45 | MOVQ a1+8(FP), DI 46 | MOVQ a2+16(FP), SI 47 | MOVQ a3+24(FP), DX 48 | MOVQ $0, R10 49 | MOVQ $0, R8 50 | MOVQ $0, R9 51 | MOVQ trap+0(FP), AX // syscall entry 52 | SYSCALL 53 | MOVQ AX, r1+32(FP) 54 | MOVQ DX, r2+40(FP) 55 | RET 56 | 57 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 58 | JMP syscall·gettimeofday(SB) 59 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 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 gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for arm, Linux 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 24 | BL runtime·entersyscall(SB) 25 | MOVW trap+0(FP), R7 26 | MOVW a1+4(FP), R0 27 | MOVW a2+8(FP), R1 28 | MOVW a3+12(FP), R2 29 | MOVW $0, R3 30 | MOVW $0, R4 31 | MOVW $0, R5 32 | SWI $0 33 | MOVW R0, r1+16(FP) 34 | MOVW $0, R0 35 | MOVW R0, r2+20(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 40 | B syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 43 | B syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 46 | MOVW trap+0(FP), R7 // syscall entry 47 | MOVW a1+4(FP), R0 48 | MOVW a2+8(FP), R1 49 | MOVW a3+12(FP), R2 50 | SWI $0 51 | MOVW R0, r1+16(FP) 52 | MOVW $0, R0 53 | MOVW R0, r2+20(FP) 54 | RET 55 | 56 | TEXT ·seek(SB),NOSPLIT,$0-28 57 | B syscall·seek(SB) 58 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 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 && arm64 && gc 6 | // +build linux 7 | // +build arm64 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // Just jump to package syscall's implementation for all these functions. 13 | // The runtime may know about them. 14 | 15 | TEXT ·Syscall(SB),NOSPLIT,$0-56 16 | B syscall·Syscall(SB) 17 | 18 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 19 | B syscall·Syscall6(SB) 20 | 21 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 22 | BL runtime·entersyscall(SB) 23 | MOVD a1+8(FP), R0 24 | MOVD a2+16(FP), R1 25 | MOVD a3+24(FP), R2 26 | MOVD $0, R3 27 | MOVD $0, R4 28 | MOVD $0, R5 29 | MOVD trap+0(FP), R8 // syscall entry 30 | SVC 31 | MOVD R0, r1+32(FP) // r1 32 | MOVD R1, r2+40(FP) // r2 33 | BL runtime·exitsyscall(SB) 34 | RET 35 | 36 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 37 | B syscall·RawSyscall(SB) 38 | 39 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 40 | B syscall·RawSyscall6(SB) 41 | 42 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 43 | MOVD a1+8(FP), R0 44 | MOVD a2+16(FP), R1 45 | MOVD a3+24(FP), R2 46 | MOVD $0, R3 47 | MOVD $0, R4 48 | MOVD $0, R5 49 | MOVD trap+0(FP), R8 // syscall entry 50 | SVC 51 | MOVD R0, r1+32(FP) 52 | MOVD R1, r2+40(FP) 53 | RET 54 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 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) && gc 6 | // +build linux 7 | // +build mips64 mips64le 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for mips64, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·Syscall(SB),NOSPLIT,$0-56 20 | JMP syscall·Syscall(SB) 21 | 22 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 23 | JMP syscall·Syscall6(SB) 24 | 25 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 26 | JAL runtime·entersyscall(SB) 27 | MOVV a1+8(FP), R4 28 | MOVV a2+16(FP), R5 29 | MOVV a3+24(FP), R6 30 | MOVV R0, R7 31 | MOVV R0, R8 32 | MOVV R0, R9 33 | MOVV trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVV R2, r1+32(FP) 36 | MOVV R3, r2+40(FP) 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 47 | MOVV a1+8(FP), R4 48 | MOVV a2+16(FP), R5 49 | MOVV a3+24(FP), R6 50 | MOVV R0, R7 51 | MOVV R0, R8 52 | MOVV R0, R9 53 | MOVV trap+0(FP), R2 // syscall entry 54 | SYSCALL 55 | MOVV R2, r1+32(FP) 56 | MOVV R3, r2+40(FP) 57 | RET 58 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 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) && gc 6 | // +build linux 7 | // +build mips mipsle 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for mips, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·Syscall(SB),NOSPLIT,$0-28 20 | JMP syscall·Syscall(SB) 21 | 22 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 23 | JMP syscall·Syscall6(SB) 24 | 25 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 26 | JMP syscall·Syscall9(SB) 27 | 28 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 29 | JAL runtime·entersyscall(SB) 30 | MOVW a1+4(FP), R4 31 | MOVW a2+8(FP), R5 32 | MOVW a3+12(FP), R6 33 | MOVW R0, R7 34 | MOVW trap+0(FP), R2 // syscall entry 35 | SYSCALL 36 | MOVW R2, r1+16(FP) // r1 37 | MOVW R3, r2+20(FP) // r2 38 | JAL runtime·exitsyscall(SB) 39 | RET 40 | 41 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 42 | JMP syscall·RawSyscall(SB) 43 | 44 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 45 | JMP syscall·RawSyscall6(SB) 46 | 47 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 48 | MOVW a1+4(FP), R4 49 | MOVW a2+8(FP), R5 50 | MOVW a3+12(FP), R6 51 | MOVW trap+0(FP), R2 // syscall entry 52 | SYSCALL 53 | MOVW R2, r1+16(FP) 54 | MOVW R3, r2+20(FP) 55 | RET 56 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 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 && (ppc64 || ppc64le) && gc 6 | // +build linux 7 | // +build ppc64 ppc64le 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for ppc64, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 20 | BL runtime·entersyscall(SB) 21 | MOVD a1+8(FP), R3 22 | MOVD a2+16(FP), R4 23 | MOVD a3+24(FP), R5 24 | MOVD R0, R6 25 | MOVD R0, R7 26 | MOVD R0, R8 27 | MOVD trap+0(FP), R9 // syscall entry 28 | SYSCALL R9 29 | MOVD R3, r1+32(FP) 30 | MOVD R4, r2+40(FP) 31 | BL runtime·exitsyscall(SB) 32 | RET 33 | 34 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 35 | MOVD a1+8(FP), R3 36 | MOVD a2+16(FP), R4 37 | MOVD a3+24(FP), R5 38 | MOVD R0, R6 39 | MOVD R0, R7 40 | MOVD R0, R8 41 | MOVD trap+0(FP), R9 // syscall entry 42 | SYSCALL R9 43 | MOVD R3, r1+32(FP) 44 | MOVD R4, r2+40(FP) 45 | RET 46 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s: -------------------------------------------------------------------------------- 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 riscv64 && gc 6 | // +build riscv64 7 | // +build gc 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for linux/riscv64. 13 | // 14 | // Where available, just jump to package syscall's implementation of 15 | // these functions. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | JMP syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | JMP syscall·Syscall6(SB) 22 | 23 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 24 | CALL runtime·entersyscall(SB) 25 | MOV a1+8(FP), A0 26 | MOV a2+16(FP), A1 27 | MOV a3+24(FP), A2 28 | MOV trap+0(FP), A7 // syscall entry 29 | ECALL 30 | MOV A0, r1+32(FP) // r1 31 | MOV A1, r2+40(FP) // r2 32 | CALL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | JMP syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | JMP syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOV a1+8(FP), A0 43 | MOV a2+16(FP), A1 44 | MOV a3+24(FP), A2 45 | MOV trap+0(FP), A7 // syscall entry 46 | ECALL 47 | MOV A0, r1+32(FP) 48 | MOV A1, r2+40(FP) 49 | RET 50 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 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 && s390x && gc 6 | // +build linux 7 | // +build s390x 8 | // +build gc 9 | 10 | #include "textflag.h" 11 | 12 | // 13 | // System calls for s390x, Linux 14 | // 15 | 16 | // Just jump to package syscall's implementation for all these functions. 17 | // The runtime may know about them. 18 | 19 | TEXT ·Syscall(SB),NOSPLIT,$0-56 20 | BR syscall·Syscall(SB) 21 | 22 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 23 | BR syscall·Syscall6(SB) 24 | 25 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 26 | BL runtime·entersyscall(SB) 27 | MOVD a1+8(FP), R2 28 | MOVD a2+16(FP), R3 29 | MOVD a3+24(FP), R4 30 | MOVD $0, R5 31 | MOVD $0, R6 32 | MOVD $0, R7 33 | MOVD trap+0(FP), R1 // syscall entry 34 | SYSCALL 35 | MOVD R2, r1+32(FP) 36 | MOVD R3, r2+40(FP) 37 | BL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 41 | BR syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 44 | BR syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 47 | MOVD a1+8(FP), R2 48 | MOVD a2+16(FP), R3 49 | MOVD a3+24(FP), R4 50 | MOVD $0, R5 51 | MOVD $0, R6 52 | MOVD $0, R7 53 | MOVD trap+0(FP), R1 // syscall entry 54 | SYSCALL 55 | MOVD R2, r1+32(FP) 56 | MOVD R3, r2+40(FP) 57 | RET 58 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s: -------------------------------------------------------------------------------- 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 gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for mips64, OpenBSD 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | JMP syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | JMP syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | JMP syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | JMP syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | JMP syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 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 gc 6 | // +build gc 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 12 | // 13 | 14 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 15 | JMP syscall·sysvicall6(SB) 16 | 17 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 18 | JMP syscall·rawSysvicall6(SB) 19 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 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 | ) 37 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 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 | ) 15 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 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 | } 28 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 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 | } 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 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 | } 25 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 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 | } 31 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 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 | } 31 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 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 | } 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 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 | } 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 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 | } 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/dev_zos.go: -------------------------------------------------------------------------------- 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 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 | } 30 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 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 11 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 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 11 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 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 | } 33 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go: -------------------------------------------------------------------------------- 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 | ) 18 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 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 | } 38 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 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 | } 25 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 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) || (linux && ppc) 6 | // +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc 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 | } 15 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/fdset.go: -------------------------------------------------------------------------------- 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 || zos 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos 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 | } 31 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 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 | } 61 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 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 9 | #include 10 | #include 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 | } 46 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 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 | } 22 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 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 | } 76 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/ioctl_zos.go: -------------------------------------------------------------------------------- 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 | } 75 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 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 | } 17 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/ptrace_darwin.go: -------------------------------------------------------------------------------- 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 | } 13 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/ptrace_ios.go: -------------------------------------------------------------------------------- 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 | } 13 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 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 | } 32 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 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 | } 27 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/readdirent_getdents.go: -------------------------------------------------------------------------------- 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 | } 14 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go: -------------------------------------------------------------------------------- 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 | } 21 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go: -------------------------------------------------------------------------------- 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 | } 17 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 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 | } 37 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/sockcmsg_unix.go: -------------------------------------------------------------------------------- 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 | } 94 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go: -------------------------------------------------------------------------------- 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 | } 48 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 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 | } 28 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall.go: -------------------------------------------------------------------------------- 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 96 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go: -------------------------------------------------------------------------------- 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 | } 55 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go: -------------------------------------------------------------------------------- 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 | } 86 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go: -------------------------------------------------------------------------------- 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 | } 33 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go: -------------------------------------------------------------------------------- 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(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0) 21 | dir = uintptr(r0) 22 | if e1 != 0 { 23 | err = errnoErr(e1) 24 | } 25 | return 26 | } 27 | 28 | var libc_fdopendir_trampoline_addr uintptr 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 | } 109 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 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 52 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 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) 52 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 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) 58 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 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 | } 68 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 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 | } 68 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 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 | } 64 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go: -------------------------------------------------------------------------------- 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 | } 64 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 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) 14 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 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) 16 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 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) 18 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go: -------------------------------------------------------------------------------- 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) 15 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 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 | } 32 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 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 | } 22 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 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 && netbsd 6 | // +build 386,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 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 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 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 && netbsd 6 | // +build amd64,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 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 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 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 | //go:build arm && netbsd 6 | // +build arm,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 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 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 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 arm64 && netbsd 6 | // +build arm64,netbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = uint32(mode) 21 | k.Flags = uint32(flags) 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 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 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 && openbsd 6 | // +build 386,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 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 = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 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 && openbsd 6 | // +build amd64,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 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 = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 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 arm && openbsd 6 | // +build arm,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: int32(nsec)} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: int32(usec)} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint32(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 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 = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/arm the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go: -------------------------------------------------------------------------------- 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 arm64 && openbsd 6 | // +build arm64,openbsd 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 19 | k.Ident = uint64(fd) 20 | k.Filter = int16(mode) 21 | k.Flags = uint16(flags) 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 = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 41 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 42 | const SYS___SYSCTL = SYS_SYSCTL 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go: -------------------------------------------------------------------------------- 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 | func setTimespec(sec, nsec int64) Timespec { 8 | return Timespec{Sec: sec, Nsec: nsec} 9 | } 10 | 11 | func setTimeval(sec, usec int64) Timeval { 12 | return Timeval{Sec: sec, Usec: usec} 13 | } 14 | 15 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 16 | k.Ident = uint64(fd) 17 | k.Filter = int16(mode) 18 | k.Flags = uint16(flags) 19 | } 20 | 21 | func (iov *Iovec) SetLen(length int) { 22 | iov.Len = uint64(length) 23 | } 24 | 25 | func (msghdr *Msghdr) SetControllen(length int) { 26 | msghdr.Controllen = uint32(length) 27 | } 28 | 29 | func (cmsg *Cmsghdr) SetLen(length int) { 30 | cmsg.Len = uint32(length) 31 | } 32 | 33 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 34 | // of OpenBSD the syscall is called sysctl instead of __sysctl. 35 | const SYS___SYSCTL = SYS_SYSCTL 36 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 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 && solaris 6 | // +build amd64,solaris 7 | 8 | package unix 9 | 10 | func setTimespec(sec, nsec int64) Timespec { 11 | return Timespec{Sec: sec, Nsec: nsec} 12 | } 13 | 14 | func setTimeval(sec, usec int64) Timeval { 15 | return Timeval{Sec: sec, Usec: usec} 16 | } 17 | 18 | func (iov *Iovec) SetLen(length int) { 19 | iov.Len = uint64(length) 20 | } 21 | 22 | func (msghdr *Msghdr) SetIovlen(length int) { 23 | msghdr.Iovlen = int32(length) 24 | } 25 | 26 | func (cmsg *Cmsghdr) SetLen(length int) { 27 | cmsg.Len = uint32(length) 28 | } 29 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 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 (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc && !ppc64le && !ppc64 6 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 7 | // +build gc 8 | // +build !ppc64le 9 | // +build !ppc64 10 | 11 | package unix 12 | 13 | import "syscall" 14 | 15 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 17 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 18 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 19 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 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 && (ppc64le || ppc64) && gc 6 | // +build linux 7 | // +build ppc64le ppc64 8 | // +build gc 9 | 10 | package unix 11 | 12 | import "syscall" 13 | 14 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 15 | return syscall.Syscall(trap, a1, a2, a3) 16 | } 17 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 18 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 19 | } 20 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 21 | return syscall.RawSyscall(trap, a1, a2, a3) 22 | } 23 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 24 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 25 | } 26 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/timestruct.go: -------------------------------------------------------------------------------- 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 || zos 6 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos 7 | 8 | package unix 9 | 10 | import "time" 11 | 12 | // TimespecToNSec returns the time stored in ts as nanoseconds. 13 | func TimespecToNsec(ts Timespec) int64 { return ts.Nano() } 14 | 15 | // NsecToTimespec converts a number of nanoseconds into a Timespec. 16 | func NsecToTimespec(nsec int64) Timespec { 17 | sec := nsec / 1e9 18 | nsec = nsec % 1e9 19 | if nsec < 0 { 20 | nsec += 1e9 21 | sec-- 22 | } 23 | return setTimespec(sec, nsec) 24 | } 25 | 26 | // TimeToTimespec converts t into a Timespec. 27 | // On some 32-bit systems the range of valid Timespec values are smaller 28 | // than that of time.Time values. So if t is out of the valid range of 29 | // Timespec, it returns a zero Timespec and ERANGE. 30 | func TimeToTimespec(t time.Time) (Timespec, error) { 31 | sec := t.Unix() 32 | nsec := int64(t.Nanosecond()) 33 | ts := setTimespec(sec, nsec) 34 | 35 | // Currently all targets have either int32 or int64 for Timespec.Sec. 36 | // If there were a new target with floating point type for it, we have 37 | // to consider the rounding error. 38 | if int64(ts.Sec) != sec { 39 | return Timespec{}, ERANGE 40 | } 41 | return ts, nil 42 | } 43 | 44 | // TimevalToNsec returns the time stored in tv as nanoseconds. 45 | func TimevalToNsec(tv Timeval) int64 { return tv.Nano() } 46 | 47 | // NsecToTimeval converts a number of nanoseconds into a Timeval. 48 | func NsecToTimeval(nsec int64) Timeval { 49 | nsec += 999 // round up to microsecond 50 | usec := nsec % 1e9 / 1e3 51 | sec := nsec / 1e9 52 | if usec < 0 { 53 | usec += 1e6 54 | sec-- 55 | } 56 | return setTimeval(sec, usec) 57 | } 58 | 59 | // Unix returns the time stored in ts as seconds plus nanoseconds. 60 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 61 | return int64(ts.Sec), int64(ts.Nsec) 62 | } 63 | 64 | // Unix returns the time stored in tv as seconds plus nanoseconds. 65 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 66 | return int64(tv.Sec), int64(tv.Usec) * 1000 67 | } 68 | 69 | // Nano returns the time stored in ts as nanoseconds. 70 | func (ts *Timespec) Nano() int64 { 71 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 72 | } 73 | 74 | // Nano returns the time stored in tv as nanoseconds. 75 | func (tv *Timeval) Nano() int64 { 76 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 77 | } 78 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/unveil_openbsd.go: -------------------------------------------------------------------------------- 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 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | // Unveil implements the unveil syscall. 13 | // For more information see unveil(2). 14 | // Note that the special case of blocking further 15 | // unveil calls is handled by UnveilBlock. 16 | func Unveil(path string, flags string) error { 17 | pathPtr, err := syscall.BytePtrFromString(path) 18 | if err != nil { 19 | return err 20 | } 21 | flagsPtr, err := syscall.BytePtrFromString(flags) 22 | if err != nil { 23 | return err 24 | } 25 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) 26 | if e != 0 { 27 | return e 28 | } 29 | return nil 30 | } 31 | 32 | // UnveilBlock blocks future unveil calls. 33 | // For more information see unveil(2). 34 | func UnveilBlock() error { 35 | // Both pointers must be nil. 36 | var pathUnsafe, flagsUnsafe unsafe.Pointer 37 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) 38 | if e != 0 { 39 | return e 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. 2 | 3 | //go:build linux && (arm || arm64) 4 | // +build linux 5 | // +build arm arm64 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // PtraceRegsArm is the registers used by arm binaries. 12 | type PtraceRegsArm struct { 13 | Uregs [18]uint32 14 | } 15 | 16 | // PtraceGetRegsArm fetches the registers used by arm binaries. 17 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 18 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 19 | } 20 | 21 | // PtraceSetRegsArm sets the registers used by arm binaries. 22 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 23 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 24 | } 25 | 26 | // PtraceRegsArm64 is the registers used by arm64 binaries. 27 | type PtraceRegsArm64 struct { 28 | Regs [31]uint64 29 | Sp uint64 30 | Pc uint64 31 | Pstate uint64 32 | } 33 | 34 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 35 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 36 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 37 | } 38 | 39 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 40 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 41 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 42 | } 43 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtraceRegSet("arm64"). DO NOT EDIT. 2 | 3 | package unix 4 | 5 | import "unsafe" 6 | 7 | // PtraceGetRegSetArm64 fetches the registers used by arm64 binaries. 8 | func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error { 9 | iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))} 10 | return ptrace(PTRACE_GETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec))) 11 | } 12 | 13 | // PtraceSetRegSetArm64 sets the registers used by arm64 binaries. 14 | func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error { 15 | iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))} 16 | return ptrace(PTRACE_SETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec))) 17 | } 18 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT. 2 | 3 | //go:build linux && (mips || mips64) 4 | // +build linux 5 | // +build mips mips64 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // PtraceRegsMips is the registers used by mips binaries. 12 | type PtraceRegsMips struct { 13 | Regs [32]uint64 14 | Lo uint64 15 | Hi uint64 16 | Epc uint64 17 | Badvaddr uint64 18 | Status uint64 19 | Cause uint64 20 | } 21 | 22 | // PtraceGetRegsMips fetches the registers used by mips binaries. 23 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 24 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 25 | } 26 | 27 | // PtraceSetRegsMips sets the registers used by mips binaries. 28 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 29 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 30 | } 31 | 32 | // PtraceRegsMips64 is the registers used by mips64 binaries. 33 | type PtraceRegsMips64 struct { 34 | Regs [32]uint64 35 | Lo uint64 36 | Hi uint64 37 | Epc uint64 38 | Badvaddr uint64 39 | Status uint64 40 | Cause uint64 41 | } 42 | 43 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 44 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 45 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 46 | } 47 | 48 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 49 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 50 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 51 | } 52 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT. 2 | 3 | //go:build linux && (mipsle || mips64le) 4 | // +build linux 5 | // +build mipsle mips64le 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // PtraceRegsMipsle is the registers used by mipsle binaries. 12 | type PtraceRegsMipsle struct { 13 | Regs [32]uint64 14 | Lo uint64 15 | Hi uint64 16 | Epc uint64 17 | Badvaddr uint64 18 | Status uint64 19 | Cause uint64 20 | } 21 | 22 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 23 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 24 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 25 | } 26 | 27 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 28 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 29 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 30 | } 31 | 32 | // PtraceRegsMips64le is the registers used by mips64le binaries. 33 | type PtraceRegsMips64le struct { 34 | Regs [32]uint64 35 | Lo uint64 36 | Hi uint64 37 | Epc uint64 38 | Badvaddr uint64 39 | Status uint64 40 | Cause uint64 41 | } 42 | 43 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 44 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 45 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 46 | } 47 | 48 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 49 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 50 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 51 | } 52 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT. 2 | 3 | //go:build linux && (386 || amd64) 4 | // +build linux 5 | // +build 386 amd64 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // PtraceRegs386 is the registers used by 386 binaries. 12 | type PtraceRegs386 struct { 13 | Ebx int32 14 | Ecx int32 15 | Edx int32 16 | Esi int32 17 | Edi int32 18 | Ebp int32 19 | Eax int32 20 | Xds int32 21 | Xes int32 22 | Xfs int32 23 | Xgs int32 24 | Orig_eax int32 25 | Eip int32 26 | Xcs int32 27 | Eflags int32 28 | Esp int32 29 | Xss int32 30 | } 31 | 32 | // PtraceGetRegs386 fetches the registers used by 386 binaries. 33 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error { 34 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 35 | } 36 | 37 | // PtraceSetRegs386 sets the registers used by 386 binaries. 38 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error { 39 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 40 | } 41 | 42 | // PtraceRegsAmd64 is the registers used by amd64 binaries. 43 | type PtraceRegsAmd64 struct { 44 | R15 uint64 45 | R14 uint64 46 | R13 uint64 47 | R12 uint64 48 | Rbp uint64 49 | Rbx uint64 50 | R11 uint64 51 | R10 uint64 52 | R9 uint64 53 | R8 uint64 54 | Rax uint64 55 | Rcx uint64 56 | Rdx uint64 57 | Rsi uint64 58 | Rdi uint64 59 | Orig_rax uint64 60 | Rip uint64 61 | Cs uint64 62 | Eflags uint64 63 | Rsp uint64 64 | Ss uint64 65 | Fs_base uint64 66 | Gs_base uint64 67 | Ds uint64 68 | Es uint64 69 | Fs uint64 70 | Gs uint64 71 | } 72 | 73 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries. 74 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error { 75 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 76 | } 77 | 78 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries. 79 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error { 80 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 81 | } 82 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go: -------------------------------------------------------------------------------- 1 | // go run mksyscall.go -tags darwin,amd64,go1.13 syscall_darwin.1_13.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | //go:build darwin && amd64 && go1.13 5 | // +build darwin,amd64,go1.13 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | var _ syscall.Errno 15 | 16 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 17 | 18 | func closedir(dir uintptr) (err error) { 19 | _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) 20 | if e1 != 0 { 21 | err = errnoErr(e1) 22 | } 23 | return 24 | } 25 | 26 | var libc_closedir_trampoline_addr uintptr 27 | 28 | //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" 29 | 30 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 | 32 | func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { 33 | r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) 34 | res = Errno(r0) 35 | return 36 | } 37 | 38 | var libc_readdir_r_trampoline_addr uintptr 39 | 40 | //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" 41 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s: -------------------------------------------------------------------------------- 1 | // go run mkasm_darwin.go amd64 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | //go:build go1.13 5 | // +build go1.13 6 | 7 | #include "textflag.h" 8 | 9 | TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 10 | JMP libc_fdopendir(SB) 11 | 12 | GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 13 | DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) 14 | 15 | TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 16 | JMP libc_closedir(SB) 17 | 18 | GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 19 | DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) 20 | 21 | TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 22 | JMP libc_readdir_r(SB) 23 | 24 | GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 25 | DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) 26 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go: -------------------------------------------------------------------------------- 1 | // go run mksyscall.go -tags darwin,arm64,go1.13 syscall_darwin.1_13.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | //go:build darwin && arm64 && go1.13 5 | // +build darwin,arm64,go1.13 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | var _ syscall.Errno 15 | 16 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 17 | 18 | func closedir(dir uintptr) (err error) { 19 | _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) 20 | if e1 != 0 { 21 | err = errnoErr(e1) 22 | } 23 | return 24 | } 25 | 26 | var libc_closedir_trampoline_addr uintptr 27 | 28 | //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" 29 | 30 | // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 | 32 | func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { 33 | r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) 34 | res = Errno(r0) 35 | return 36 | } 37 | 38 | var libc_readdir_r_trampoline_addr uintptr 39 | 40 | //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" 41 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s: -------------------------------------------------------------------------------- 1 | // go run mkasm_darwin.go arm64 2 | // Code generated by the command above; DO NOT EDIT. 3 | 4 | //go:build go1.13 5 | // +build go1.13 6 | 7 | #include "textflag.h" 8 | 9 | TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 10 | JMP libc_fdopendir(SB) 11 | 12 | GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 13 | DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) 14 | 15 | TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 16 | JMP libc_closedir(SB) 17 | 18 | GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 19 | DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) 20 | 21 | TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 22 | JMP libc_readdir_r(SB) 23 | 24 | GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 25 | DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) 26 | -------------------------------------------------------------------------------- /entrypoint/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go: -------------------------------------------------------------------------------- 1 | // cgo -godefs types_illumos.go | go run mkpost.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | //go:build amd64 && illumos 5 | // +build amd64,illumos 6 | 7 | package unix 8 | 9 | const ( 10 | TUNNEWPPA = 0x540001 11 | TUNSETPPA = 0x540002 12 | 13 | I_STR = 0x5308 14 | I_POP = 0x5303 15 | I_PUSH = 0x5302 16 | I_PLINK = 0x5316 17 | I_PUNLINK = 0x5317 18 | 19 | IF_UNITSEL = -0x7ffb8cca 20 | ) 21 | 22 | type strbuf struct { 23 | Maxlen int32 24 | Len int32 25 | Buf *int8 26 | } 27 | 28 | type Strioctl struct { 29 | Cmd int32 30 | Timout int32 31 | Len int32 32 | Dp *int8 33 | } 34 | 35 | type Lifreq struct { 36 | Name [32]int8 37 | Lifru1 [4]byte 38 | Type uint32 39 | Lifru [336]byte 40 | } 41 | -------------------------------------------------------------------------------- /entrypoint/vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 2 | ## explicit 3 | golang.org/x/sys/internal/unsafeheader 4 | golang.org/x/sys/unix 5 | -------------------------------------------------------------------------------- /functions/TODO.md: -------------------------------------------------------------------------------- 1 | Libtorrent/Rtorrent 2 | =================== 3 | 4 | * Run autoupdate. 5 | * Refactor test_tracker_list. 6 | * Refacotr http stream to use shared_ptr. 7 | 8 | 9 | 10 | Use this the following idea to replace current code used to execute 11 | commands. Do the command thing first, leave the rest for later. 12 | 13 | * Spawn a module loader at the very start of main(...). 14 | * Thread first, move to fork when the modules support it. 15 | * Each process has it's own group of services that it shares resources with. 16 | * The spawner process remains almost as exactly as right after start. 17 | * Only handles simple requests to spawn processes, then hands back the fd's requested to the hub. 18 | * The hub is first initialized, it asks spawner to start main thread. 19 | * Making executing external programs a temporary module would clean up a lot of code. 20 | -------------------------------------------------------------------------------- /functions/_args/rdo_docker: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo docker' 2 | 3 | while true; do 4 | case "${1:-}" in 5 | --help|-h|'') 6 | echo "Usage: rdo docker" 7 | echo 8 | echo "Manage docker." 9 | echo 10 | echo "Commands:" 11 | echo " args List all available build args" 12 | echo " build Build an image" 13 | echo " children ." 14 | echo " clean ." 15 | echo " container ." 16 | echo " images ." 17 | echo " inspect ." 18 | echo " network ." 19 | echo " ps ." 20 | echo " pull ." 21 | echo " targets ." 22 | echo 23 | echo "Run 'rdo docker COMMAND --help' for more information on a command." 24 | exit 0 25 | ;; 26 | *) 27 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 28 | print_error "${args__root}: unknown flag: ${1}" 29 | return 1 30 | fi 31 | 32 | break 33 | ;; 34 | esac 35 | done 36 | 37 | local args__root="rdo docker" 38 | local args__cmd="${1:-}" 39 | shift || : 40 | 41 | case "${args__cmd}" in 42 | args) 43 | args::verify_command_empty "${@}" 44 | rdo_docker_args 45 | ;; 46 | build) 47 | rdo_docker_build "${@}" 48 | ;; 49 | children) 50 | rdo_docker_children "${@}" 51 | ;; 52 | clean) 53 | rdo_docker_clean "${@}" 54 | ;; 55 | container) 56 | rdo_docker_container "${@}" 57 | ;; 58 | images) 59 | args::verify_command_empty "${@}" 60 | rdo_docker_images 61 | ;; 62 | inspect) 63 | rdo_docker_inspect "${@}" 64 | ;; 65 | network) 66 | rdo_docker_network "${@}" 67 | ;; 68 | ps) 69 | rdo_docker_ps "${@}" 70 | ;; 71 | pull) 72 | rdo_docker_pull "${@}" 73 | ;; 74 | targets) 75 | args::verify_command_empty "${@}" 76 | rdo_docker_targets 77 | ;; 78 | *) 79 | print_error "rdo docker: unknown command: ${args__cmd}" 80 | exit 1 81 | ;; 82 | esac 83 | 84 | # end of generated bash args 'rdo docker' 85 | -------------------------------------------------------------------------------- /functions/_args/rdo_stage: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo stage' 2 | 3 | while true; do 4 | case "${1:-}" in 5 | --help|-h|'') 6 | echo "Usage: rdo stage" 7 | echo 8 | echo "Manage staging of environments." 9 | echo 10 | echo "Commands:" 11 | echo " init Initialize new environment for staging" 12 | echo " deploy Deploy environment" 13 | echo " clean Remove environment" 14 | echo " append-rc Append to node's rc file" 15 | echo " network Add network" 16 | echo " router Add router" 17 | echo " dns Add dns" 18 | echo " rtorrent Add node" 19 | echo " tracker Add tracker" 20 | echo 21 | echo "Run 'rdo stage COMMAND --help' for more information on a command." 22 | exit 0 23 | ;; 24 | *) 25 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 26 | print_error "${args__root}: unknown flag: ${1}" 27 | return 1 28 | fi 29 | 30 | break 31 | ;; 32 | esac 33 | done 34 | 35 | local args__root="rdo stage" 36 | local args__cmd="${1:-}" 37 | shift || : 38 | 39 | case "${args__cmd}" in 40 | init) 41 | args::verify_command_empty "${@}" 42 | rdo_stage_init 43 | ;; 44 | deploy) 45 | args::verify_command_empty "${@}" 46 | rdo_stage_deploy 47 | ;; 48 | clean) 49 | args::verify_command_empty "${@}" 50 | rdo_stage_clean 51 | ;; 52 | append-rc) 53 | rdo_stage_append_rc "${@}" 54 | ;; 55 | network) 56 | rdo_stage_network "${@}" 57 | ;; 58 | router) 59 | rdo_stage_router "${@}" 60 | ;; 61 | dns) 62 | rdo_stage_dns "${@}" 63 | ;; 64 | rtorrent) 65 | rdo_stage_rtorrent "${@}" 66 | ;; 67 | tracker) 68 | rdo_stage_tracker "${@}" 69 | ;; 70 | *) 71 | print_error "rdo stage: unknown command: ${args__cmd}" 72 | exit 1 73 | ;; 74 | esac 75 | 76 | # end of generated bash args 'rdo stage' 77 | -------------------------------------------------------------------------------- /functions/_args/rdo_stage_append_rc: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo stage append-rc APPEND-TEXT' 2 | 3 | local node_list=() 4 | local args__opt_value__node= 5 | 6 | while true; do 7 | case "${1:-}" in 8 | --node) 9 | local args__1="${2:?Missing argument for '${1}'.}" 10 | args__opt_value__node="${args__1}" 11 | shift 2 12 | node_list+=("${args__1}") 13 | ;; 14 | --help|-h) 15 | echo "Usage: rdo stage append-rc APPEND-TEXT" 16 | echo 17 | echo "Append to node's rc file" 18 | echo 19 | echo "Options:" 20 | echo " --node Name of the node" 21 | echo 22 | echo "Run 'rdo stage append-rc APPEND-TEXT COMMAND --help' for more information on a command." 23 | exit 0 24 | ;; 25 | *) 26 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 27 | print_error "${args__root}: unknown flag: ${1}" 28 | return 1 29 | fi 30 | 31 | break 32 | ;; 33 | esac 34 | done 35 | 36 | if (( ${#} > 1 )); then 37 | print_error "rdo stage append-rc APPEND-TEXT: too many arguments" 38 | exit 1 39 | fi 40 | 41 | if (( ${#} == 0 )) || [[ -z "${1:-}" ]]; then 42 | print_error "rdo stage append-rc APPEND-TEXT: missing or empty argument" 43 | exit 1 44 | fi 45 | 46 | local append_text="${1}" 47 | shift 48 | 49 | # end of generated bash args 'rdo stage append-rc APPEND-TEXT' 50 | -------------------------------------------------------------------------------- /functions/_args/rdo_stage_dns: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo stage dns NODE-NAME' 2 | 3 | local resolve_conf 4 | local networks=() 5 | local run_template 6 | local args__opt_value__dns_inet_1= 7 | local args__opt_value__dns_inet_2= 8 | local args__opt_value__dns_inet6_1= 9 | local args__opt_value__dns_inet6_2= 10 | local args__opt_value__network= 11 | local args__opt_value__run_template= 12 | 13 | while true; do 14 | case "${1:-}" in 15 | --dns-inet) 16 | local args__1="${2%%:*}" 17 | local args__2="${2##*:}" 18 | local args__1="${args__1:?Missing argument for '${1}'.}" 19 | local args__2="${args__2:?Missing argument for '${1}'.}" 20 | args__opt_value__dns_inet_1="${args__1}" 21 | args__opt_value__dns_inet_2="${args__2}" 22 | 23 | if [[ "${args__1}:${args__2}" != "${2}" ]]; then 24 | print_error "${args__root}: invalid option format: ${1} ${2}" 25 | return 1 26 | fi 27 | 28 | shift 2 29 | resolve_conf="nameserver $(cat ./run/current/dns/${args__1}/interfaces/${args__2}/inet)" 30 | ;; 31 | --dns-inet6) 32 | local args__1="${2%%:*}" 33 | local args__2="${2##*:}" 34 | local args__1="${args__1:?Missing argument for '${1}'.}" 35 | local args__2="${args__2:?Missing argument for '${1}'.}" 36 | args__opt_value__dns_inet6_1="${args__1}" 37 | args__opt_value__dns_inet6_2="${args__2}" 38 | 39 | if [[ "${args__1}:${args__2}" != "${2}" ]]; then 40 | print_error "${args__root}: invalid option format: ${1} ${2}" 41 | return 1 42 | fi 43 | 44 | shift 2 45 | resolve_conf="nameserver $(cat ./run/current/dns/${args__1}/interfaces/${args__2}/inet6)" 46 | ;; 47 | --network|-n) 48 | local args__1="${2:?Missing argument for '${1}'.}" 49 | args__opt_value__network="${args__1}" 50 | shift 2 51 | networks+=("${args__1}") 52 | ;; 53 | --run-template|-r) 54 | local args__1="${2:?Missing argument for '${1}'.}" 55 | args__opt_value__run_template="${args__1}" 56 | shift 2 57 | run_template=("${args__1}") 58 | ;; 59 | --help|-h) 60 | echo "Usage: rdo stage dns NODE-NAME" 61 | echo 62 | echo "Add dns to staging of environments." 63 | echo 64 | echo "Options:" 65 | echo " --dns-inet Set dns resolver to a 'dns_node:network'" 66 | echo " --dns-inet6 Set dns resolver to a 'dns_node:network'" 67 | echo " -n, --network Connect tracker to network" 68 | echo " -r, --run-template Use template to create run script" 69 | echo 70 | echo "Run 'rdo stage dns NODE-NAME COMMAND --help' for more information on a command." 71 | exit 0 72 | ;; 73 | *) 74 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 75 | print_error "${args__root}: unknown flag: ${1}" 76 | return 1 77 | fi 78 | 79 | break 80 | ;; 81 | esac 82 | done 83 | 84 | if (( ${#} > 1 )); then 85 | print_error "rdo stage dns NODE-NAME: too many arguments" 86 | exit 1 87 | fi 88 | 89 | if (( ${#} == 0 )) || [[ -z "${1:-}" ]]; then 90 | print_error "rdo stage dns NODE-NAME: missing or empty argument" 91 | exit 1 92 | fi 93 | 94 | local node_name="${1}" 95 | shift 96 | 97 | # end of generated bash args 'rdo stage dns NODE-NAME' 98 | -------------------------------------------------------------------------------- /functions/_args/rdo_stage_network: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo stage network NAME' 2 | 3 | local enable_ipv4=yes 4 | local enable_ipv6=yes 5 | 6 | while true; do 7 | case "${1:-}" in 8 | --disable-ipv4) 9 | shift 10 | enable_ipv4=no 11 | ;; 12 | --disable-ipv6) 13 | shift 14 | enable_ipv6=no 15 | ;; 16 | --help|-h) 17 | echo "Usage: rdo stage network NAME" 18 | echo 19 | echo "Stage a network" 20 | echo 21 | echo "Options:" 22 | echo " --disable-ipv4 Disable IPv4" 23 | echo " --disable-ipv6 Disable IPv6" 24 | echo 25 | echo "Run 'rdo stage network NAME COMMAND --help' for more information on a command." 26 | exit 0 27 | ;; 28 | *) 29 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 30 | print_error "${args__root}: unknown flag: ${1}" 31 | return 1 32 | fi 33 | 34 | break 35 | ;; 36 | esac 37 | done 38 | 39 | if (( ${#} > 1 )); then 40 | print_error "rdo stage network NAME: too many arguments" 41 | exit 1 42 | fi 43 | 44 | if (( ${#} == 0 )) || [[ -z "${1:-}" ]]; then 45 | print_error "rdo stage network NAME: missing or empty argument" 46 | exit 1 47 | fi 48 | 49 | local name="${1}" 50 | shift 51 | 52 | # end of generated bash args 'rdo stage network NAME' 53 | -------------------------------------------------------------------------------- /functions/_args/rdo_stage_rtorrent: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo stage rtorrent [NODE-NAME]...' 2 | 3 | local resolve_conf 4 | local networks=() 5 | local run_template 6 | local torrents_disksize 7 | local args__opt_value__dns_inet_1= 8 | local args__opt_value__dns_inet_2= 9 | local args__opt_value__dns_inet6_1= 10 | local args__opt_value__dns_inet6_2= 11 | local args__opt_value__network= 12 | local args__opt_value__run_template= 13 | local args__opt_value__torrents_disksize= 14 | 15 | while true; do 16 | case "${1:-}" in 17 | --dns-inet) 18 | local args__1="${2%%:*}" 19 | local args__2="${2##*:}" 20 | local args__1="${args__1:?Missing argument for '${1}'.}" 21 | local args__2="${args__2:?Missing argument for '${1}'.}" 22 | args__opt_value__dns_inet_1="${args__1}" 23 | args__opt_value__dns_inet_2="${args__2}" 24 | 25 | if [[ "${args__1}:${args__2}" != "${2}" ]]; then 26 | print_error "${args__root}: invalid option format: ${1} ${2}" 27 | return 1 28 | fi 29 | 30 | shift 2 31 | resolve_conf="nameserver $(cat ./run/current/dns/${args__1}/interfaces/${args__2}/inet)" 32 | ;; 33 | --dns-inet6) 34 | local args__1="${2%%:*}" 35 | local args__2="${2##*:}" 36 | local args__1="${args__1:?Missing argument for '${1}'.}" 37 | local args__2="${args__2:?Missing argument for '${1}'.}" 38 | args__opt_value__dns_inet6_1="${args__1}" 39 | args__opt_value__dns_inet6_2="${args__2}" 40 | 41 | if [[ "${args__1}:${args__2}" != "${2}" ]]; then 42 | print_error "${args__root}: invalid option format: ${1} ${2}" 43 | return 1 44 | fi 45 | 46 | shift 2 47 | resolve_conf="nameserver $(cat ./run/current/dns/${args__1}/interfaces/${args__2}/inet6)" 48 | ;; 49 | --network|-n) 50 | local args__1="${2:?Missing argument for '${1}'.}" 51 | args__opt_value__network="${args__1}" 52 | shift 2 53 | networks+=("${args__1}") 54 | ;; 55 | --run-template|-r) 56 | local args__1="${2:?Missing argument for '${1}'.}" 57 | args__opt_value__run_template="${args__1}" 58 | shift 2 59 | run_template=("${args__1}") 60 | ;; 61 | --torrents-disksize) 62 | local args__1="${2:?Missing argument for '${1}'.}" 63 | args__opt_value__torrents_disksize="${args__1}" 64 | shift 2 65 | torrents_disksize="${args__1}" 66 | ;; 67 | --help|-h) 68 | echo "Usage: rdo stage rtorrent [NODE-NAME]..." 69 | echo 70 | echo "Stage rtorrent clients." 71 | echo 72 | echo "Options:" 73 | echo " --dns-inet Set dns resolver to a 'dns_node:network'" 74 | echo " --dns-inet6 Set dns resolver to a 'dns_node:network'" 75 | echo " -n, --network Connect tracker to network" 76 | echo " -r, --run-template Use template to create run script" 77 | echo " --torrents-disksize Torrents volume disksize" 78 | echo 79 | echo "Run 'rdo stage rtorrent [NODE-NAME]... COMMAND --help' for more information on a command." 80 | exit 0 81 | ;; 82 | *) 83 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 84 | print_error "${args__root}: unknown flag: ${1}" 85 | return 1 86 | fi 87 | 88 | break 89 | ;; 90 | esac 91 | done 92 | 93 | # end of generated bash args 'rdo stage rtorrent [NODE-NAME]...' 94 | -------------------------------------------------------------------------------- /functions/_args/rdo_stage_tracker: -------------------------------------------------------------------------------- 1 | # start of generated bash args 'rdo stage tracker NODE-NAME' 2 | 3 | local resolve_conf 4 | local networks=() 5 | local run_template 6 | local args__opt_value__dns_inet_1= 7 | local args__opt_value__dns_inet_2= 8 | local args__opt_value__dns_inet6_1= 9 | local args__opt_value__dns_inet6_2= 10 | local args__opt_value__network= 11 | local args__opt_value__run_template= 12 | 13 | while true; do 14 | case "${1:-}" in 15 | --dns-inet) 16 | local args__1="${2%%:*}" 17 | local args__2="${2##*:}" 18 | local args__1="${args__1:?Missing argument for '${1}'.}" 19 | local args__2="${args__2:?Missing argument for '${1}'.}" 20 | args__opt_value__dns_inet_1="${args__1}" 21 | args__opt_value__dns_inet_2="${args__2}" 22 | 23 | if [[ "${args__1}:${args__2}" != "${2}" ]]; then 24 | print_error "${args__root}: invalid option format: ${1} ${2}" 25 | return 1 26 | fi 27 | 28 | shift 2 29 | resolve_conf="nameserver $(cat ./run/current/dns/${args__1}/interfaces/${args__2}/inet)" 30 | ;; 31 | --dns-inet6) 32 | local args__1="${2%%:*}" 33 | local args__2="${2##*:}" 34 | local args__1="${args__1:?Missing argument for '${1}'.}" 35 | local args__2="${args__2:?Missing argument for '${1}'.}" 36 | args__opt_value__dns_inet6_1="${args__1}" 37 | args__opt_value__dns_inet6_2="${args__2}" 38 | 39 | if [[ "${args__1}:${args__2}" != "${2}" ]]; then 40 | print_error "${args__root}: invalid option format: ${1} ${2}" 41 | return 1 42 | fi 43 | 44 | shift 2 45 | resolve_conf="nameserver $(cat ./run/current/dns/${args__1}/interfaces/${args__2}/inet6)" 46 | ;; 47 | --network|-n) 48 | local args__1="${2:?Missing argument for '${1}'.}" 49 | args__opt_value__network="${args__1}" 50 | shift 2 51 | networks+=("${args__1}") 52 | ;; 53 | --run-template|-r) 54 | local args__1="${2:?Missing argument for '${1}'.}" 55 | args__opt_value__run_template="${args__1}" 56 | shift 2 57 | run_template=("${args__1}") 58 | ;; 59 | --help|-h) 60 | echo "Usage: rdo stage tracker NODE-NAME" 61 | echo 62 | echo "Add tracker to staging of environments." 63 | echo 64 | echo "Options:" 65 | echo " --dns-inet Set dns resolver to a 'dns_node:network'" 66 | echo " --dns-inet6 Set dns resolver to a 'dns_node:network'" 67 | echo " -n, --network Connect tracker to network" 68 | echo " -r, --run-template Use template to create run script" 69 | echo 70 | echo "Run 'rdo stage tracker NODE-NAME COMMAND --help' for more information on a command." 71 | exit 0 72 | ;; 73 | *) 74 | if [[ -n "${1:-}" ]] && [[ -z "${1##-*}" ]]; then 75 | print_error "${args__root}: unknown flag: ${1}" 76 | return 1 77 | fi 78 | 79 | break 80 | ;; 81 | esac 82 | done 83 | 84 | if (( ${#} > 1 )); then 85 | print_error "rdo stage tracker NODE-NAME: too many arguments" 86 | exit 1 87 | fi 88 | 89 | if (( ${#} == 0 )) || [[ -z "${1:-}" ]]; then 90 | print_error "rdo stage tracker NODE-NAME: missing or empty argument" 91 | exit 1 92 | fi 93 | 94 | local node_name="${1}" 95 | shift 96 | 97 | # end of generated bash args 'rdo stage tracker NODE-NAME' 98 | -------------------------------------------------------------------------------- /functions/build.context: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header build.context 4 | 5 | rdo_build__context__ancestor() { 6 | local context_name="ancestor" 7 | local context_path="./context/${context_name}" 8 | 9 | rm -r "${context_path}/bin" 2> /dev/null || : 10 | mkdir -p "${context_path}/bin" 11 | 12 | cp ./misc/{pkg,rdo}-*[!~] "${context_path}/bin/" 13 | 14 | rdo docker build --context "${context_path}" "${@}" 15 | } 16 | 17 | rdo_build__context__empty() { 18 | local context_name="empty" 19 | local context_path="./context/${context_name}" 20 | 21 | mkdir -p "${context_path}" 22 | 23 | rdo docker build --context "${context_path}" "${@}" 24 | } 25 | 26 | rdo_build__context__run() { 27 | local context_tag="${1:?Missing context tag argument.}" 28 | shift 29 | 30 | local context_name="run" 31 | local context_path="./context/${context_name}/${context_tag}" 32 | local tag_full="${@:${#}}" 33 | local tag_append="${tag_full##*:}" 34 | 35 | if [[ -z "${context_tag##-*}" ]]; then 36 | print_error "rdo_build__context__run requires the first argument to be the context tag, which cannot start with a '-'." 37 | return 1 38 | fi 39 | 40 | if [[ "${tag_full}" == "${tag_append}" ]]; then 41 | print_error "rdo_build__context__run requires the build tag to be a full tag" 42 | return 1 43 | fi 44 | 45 | mkdir -p "${context_path}" 46 | 47 | local bash_profile_path 48 | bash_profile_path="$(mktemp)" 49 | 50 | "./misc/gen-bash-profile" "${context_name}" "${tag_full}" > "${bash_profile_path}" 51 | "./misc/rdo-file-move" "${bash_profile_path}" "${context_path}/bash_profile" 52 | rm -f "${bash_profile_path}" 53 | 54 | cp "./misc/entrypoint.sh" "${context_path}/entrypoint.sh" 55 | 56 | rdo docker build --context "${context_path}" "${@}" 57 | } 58 | 59 | rdo_build__context__rtorrent() { 60 | local context_name="rtorrent" 61 | local context_path="./context/${context_name}" 62 | local tag_full="${@:${#}}" 63 | local tag_append="${tag_full##*:}" 64 | 65 | if [[ "${tag_full}" == "${tag_append}" ]]; then 66 | print_error "rdo_build__context__run requires the build tag to be a full tag" 67 | return 1 68 | fi 69 | 70 | mkdir -p "${context_path}" 71 | 72 | ./misc/rsync-stage-compile ./data/libtorrent/ "${context_path}/libtorrent/" 73 | ./misc/rsync-stage-compile ./data/rtorrent/ "${context_path}/rtorrent/" 74 | 75 | rdo__call_tar_cf "${context_path}/libtorrent.tar.gz" --directory "${context_path}/libtorrent" . 76 | rdo__call_tar_cf "${context_path}/rtorrent.tar.gz" --directory "${context_path}/rtorrent" . 77 | 78 | local bash_profile_path 79 | bash_profile_path="$(mktemp)" 80 | 81 | "./misc/gen-bash-profile" "${context_name}" "${tag_full}" > "${bash_profile_path}" 82 | "./misc/rdo-file-move" "${bash_profile_path}" "${context_path}/bash_profile" 83 | rm -f "${bash_profile_path}" 84 | 85 | cp "./misc/entrypoint.sh" "${context_path}/entrypoint.sh" 86 | 87 | rdo docker build --context "${context_path}" "${@}" 88 | } 89 | -------------------------------------------------------------------------------- /functions/common.container: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header common.container 4 | 5 | # TODO: Restrict to label. 6 | rdo__container_id__name() { 7 | local container_name="${1:?Missing container name argument.}" 8 | echo "$(docker container inspect --format '{{ .Id }}' "${container_name}" 2> /dev/null)" 9 | } 10 | 11 | rdo__running_container_id__name() { 12 | local container_name="${1:?Missing container name argument.}" 13 | echo "$(docker ps --no-trunc --format '{{ .ID }}' --filter "name=${container_name}" 2> /dev/null)" 14 | } 15 | 16 | rdo__image_id__name() { 17 | local image_name="${1:?Missing image name argument.}" 18 | echo "$(docker images --no-trunc --quiet "${image_name}" 2> /dev/null)" 19 | } 20 | -------------------------------------------------------------------------------- /functions/common.image: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header common.image 4 | 5 | # TODO: Add lookup that only take tags or id's 6 | rdo__image_id() { 7 | local image_name="${1:?Missing image argument.}" 8 | echo "$(rdo docker inspect --id "${image_name}" 2> /dev/null)" 9 | } 10 | 11 | rdo__image_id__tag() { 12 | local image_tag="${1:?Missing image tag argument.}" 13 | echo "$(rdo docker inspect --id "${image_tag}" 2> /dev/null)" 14 | } 15 | 16 | rdo__latest_image_id__label() { 17 | local label="${1:?Missing label argument.}" 18 | local image_id="$(docker images --all --quiet --filter label=${label} | head -n1)" 19 | 20 | if [[ -n "${image_id}" ]]; then 21 | rdo__image_id "${image_id}" 22 | fi 23 | } 24 | 25 | rdo__image_label_value__tag__label() { 26 | local tag="${1:?Missing tag argument.}" 27 | local label="${2:?Missing label argument.}" 28 | 29 | docker image inspect --format "{{ range \$k, \$v := .Config.Labels }}{{ if eq \$k \"${label}\" }}{{ \$v }}{{ end }}{{ end }}" "${tag}" 30 | } 31 | 32 | rdo__image_layer_depth() { 33 | local tag="${1:?Missing tag argument.}" 34 | 35 | docker image inspect --format "{{ len .RootFS.Layers }}" "${RDO_REPOSITORY:?Not in rdo bash session.}/${tag}" 36 | } 37 | 38 | rdo__image_ls__filters() { 39 | if [[ -z "${*}" ]]; then 40 | print_error "rdo__image_ls__filters: empty filter list" 41 | exit 1 42 | fi 43 | 44 | local args=(--no-trunc --all --quiet) 45 | 46 | local filter 47 | for filter in "${@}"; do 48 | args+=(--filter "${filter}") 49 | done 50 | 51 | docker image ls "${args[@]}" 52 | } 53 | 54 | rdo__image_rm__ids() { 55 | for image_id in "${@}"; do 56 | if [[ ! "${image_id}" =~ ^sha256:[0-9a-f]*$ ]]; then 57 | print_error "rdo__image_rm__ids: invalid image id: ${image_id}" 58 | exit 1 59 | fi 60 | done 61 | 62 | if (( "${#}" != 0 )); then 63 | docker rmi "${@}" 64 | fi 65 | } 66 | 67 | rdo__image_rm__filters() { 68 | rdo__image_rm__ids $(rdo__image_ls__filters "${@}") 69 | } 70 | 71 | rdo__image_has_file() { 72 | local image_tag="${1:?Missing image tag argument.}" 73 | local file_name="${2:?Missing file name argument.}" 74 | local result=1 75 | local image_id= 76 | image_id="$(docker create --rm "${image_tag}")" 77 | 78 | if docker cp "${image_id:?Missing image id result.}:${file_name}" "-" &> /dev/null; then 79 | result=0 80 | fi 81 | 82 | docker rm -f "${image_id}" > /dev/null || : 83 | return ${result} 84 | } 85 | -------------------------------------------------------------------------------- /functions/common.init: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header common.init 4 | 5 | rdo_bash() { 6 | if ! [[ -f "./data/env.bash" ]]; then 7 | print_error "rdo bash: environment not initialized, could not find './data/env.bash'" 8 | exit 1 9 | fi 10 | 11 | print_progress "entering custom bash session" 12 | /usr/bin/env bash --init-file "./data/env.bash" 13 | print_warning "exiting custom bash session" 14 | } 15 | 16 | # 17 | # Refactor: 18 | # 19 | 20 | rdo__compare_id__file_image() { 21 | local file_name="${1:?Missing file argument.}" 22 | local image_name="${2:?Missing image argument.}" 23 | 24 | if ! [[ -f "${file_name}" ]]; then 25 | return 1 26 | fi 27 | 28 | local file_id="$(cat "${file_name}")" 29 | local image_id="$(rdo docker inspect --id "${image_name}")" 30 | 31 | [[ -n "${file_id}" ]] && [[ "${file_id}" == "${image_id}" ]] 32 | } 33 | 34 | rdo__compare_hash__dir_dir() { 35 | local path_lhs="${1:?Missing lhs path argument.}" 36 | local path_rhs="${2:?Missing rhs path argument.}" 37 | 38 | # Sort by size to detect if any files are empty or incomplete. 39 | 40 | if [[ "${path_lhs}" =~ : ]]; then 41 | local hash_lhs="$(docker exec "${path_lhs%%:*}" sh -c "cd '${path_lhs##*:}'; \ls -S | tail -n +2")" 42 | else 43 | local hash_lhs="$(cd "${path_lhs}"; \ls -S | tail -n +2)" 44 | fi 45 | 46 | if [[ "${path_rhs}" =~ : ]]; then 47 | local hash_rhs="$(docker exec "${path_rhs%%:*}" sh -c "cd '${path_rhs##*:}'; \ls -S | tail -n +2")" 48 | else 49 | local hash_rhs="$(cd "${path_rhs}"; \ls -S | tail -n +2)" 50 | fi 51 | 52 | [[ "${hash_lhs}" == "${hash_rhs}" ]] 53 | } 54 | -------------------------------------------------------------------------------- /functions/common.system: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header common.system 4 | 5 | rdo__cpu_count() { 6 | if command -v sysctl &> /dev/null; then 7 | sysctl -n hw.ncpu 8 | else 9 | nproc 10 | fi 11 | } 12 | 13 | rdo__machine_memory() { 14 | local memory_size 15 | 16 | if command -v sysctl &> /dev/null; then 17 | memory_size="$(sysctl -n hw.memsize)" 18 | else 19 | memory_size="60000" 20 | fi 21 | 22 | if (( "${memory_size}" < 4 * 15000 )); then 23 | echo "$(( ${memory_size} / 4 ))" 24 | else 25 | echo 15000 26 | fi 27 | } 28 | 29 | rdo__call_md5() { 30 | if command -v md5 &> /dev/null; then 31 | local cmd="md5" 32 | elif command -v md5sum &> /dev/null; then 33 | local cmd="md5sum" 34 | else 35 | print_error "could not find md5 nor md5sum command" 36 | return 1 37 | fi 38 | 39 | eval ${cmd} "${@}" 40 | } 41 | 42 | rdo__call_tar_cf() { 43 | local tar_args="--format pax --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime --sort=name --owner=0 --group=0 --numeric-owner" 44 | 45 | if (command -v tar && ! ((tar ${tar_args} || :) 2>&1 | grep -q 'not supported')) &> /dev/null; then 46 | local cmd="tar ${tar_args} -cf" 47 | elif (command -v gnutar && ! ((gnutar ${tar_args} || :) 2>&1 | grep -q 'not supported')) &> /dev/null; then 48 | local cmd="gnutar ${tar_args} -cf" 49 | else 50 | print_error "could not find a tar version that supports extended pax options, try GNU tar" 51 | return 1 52 | fi 53 | 54 | echo eval ${cmd} "${@}" 55 | eval ${cmd} "${@}" 56 | } 57 | 58 | rdo__call_host() { 59 | case "${RDO_DOCKER_TYPE}" in 60 | "engine") 61 | "${@}" 62 | ;; 63 | "machine") 64 | : "${RDO_DOCKER_MACHINE:?Missing docker machine.}" 65 | docker-machine ssh "${RDO_DOCKER_MACHINE}" "${@}" 66 | ;; 67 | *) 68 | print_error "rdo___call_host: invalid docker type" 69 | return 1 70 | ;; 71 | esac 72 | } 73 | 74 | rdo__sudo_host() { 75 | case "${RDO_DOCKER_TYPE}" in 76 | "engine") 77 | sudo "${@}" 78 | ;; 79 | "machine") 80 | : "${RDO_DOCKER_MACHINE:?Missing docker machine.}" 81 | docker-machine ssh "${RDO_DOCKER_MACHINE}" sudo "${@}" 82 | ;; 83 | *) 84 | print_error "rdo___sudo_host: invalid docker type" 85 | return 1 86 | ;; 87 | esac 88 | } 89 | -------------------------------------------------------------------------------- /functions/common/init: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright (C) 2020 by Jari Petter Sundell 4 | # 5 | # Permission to use, copy, modify, and/or distribute this software for any purpose 6 | # with or without fee is hereby granted. 7 | # 8 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 10 | # FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 12 | # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 13 | # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 14 | # THIS SOFTWARE. 15 | 16 | COLOR_NC='\033[0m' 17 | COLOR_RED='\033[0;31m' 18 | COLOR_GREEN='\033[0;32m' 19 | 20 | if ! [[ -v __INCLUDED_HEADERS ]]; then 21 | declare -A __INCLUDED_HEADERS 22 | fi 23 | 24 | include_header() { 25 | local header_name="${1:?Missing header name argument.}" 26 | 27 | if [[ -v __INCLUDED_HEADERS[${header_name}] ]]; then 28 | echo "rdo_${header_name} already included:" >&2 29 | 30 | for (( i=0 ; i < ${#FUNCNAME[@]} - 1 ; i++ )); do 31 | echo " $i: ${BASH_SOURCE[$i+1]}:${BASH_LINENO[$i]} ${FUNCNAME[$i]}" >&2 32 | done 33 | 34 | exit 1 35 | fi 36 | 37 | __INCLUDED_HEADERS[${header_name}]="yes" 38 | } 39 | 40 | include_header common/init 41 | 42 | is_header_included() { 43 | local header_name="${1:?Missing header name argument.}" 44 | [[ -v __INCLUDED_HEADERS[${header_name}] ]] 45 | } 46 | 47 | print_normal() { 48 | echo -e "${@}" >&2 49 | } 50 | 51 | print_progress() { 52 | echo -e "${COLOR_GREEN}${@}${COLOR_NC}" >&2 53 | } 54 | 55 | print_error() { 56 | echo -e "${COLOR_RED}${@}${COLOR_NC}" >&2 57 | } 58 | 59 | print_warning() { 60 | echo -e "${COLOR_RED}${@}${COLOR_NC}" >&2 61 | } 62 | 63 | print_space() { 64 | echo >&2 65 | } 66 | 67 | printf_normal() { 68 | printf "${@}" >&2 69 | } 70 | -------------------------------------------------------------------------------- /functions/common/utils: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright (C) 2020 by Jari Petter Sundell 4 | # 5 | # Permission to use, copy, modify, and/or distribute this software for any purpose 6 | # with or without fee is hereby granted. 7 | # 8 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 10 | # FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 12 | # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 13 | # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 14 | # THIS SOFTWARE. 15 | 16 | include_header common/utils 17 | 18 | utils::array_key_max_width() { 19 | local width=0 20 | local array 21 | for array in "${@}"; do 22 | declare -n array="${1:?Missing array argument.}" 23 | 24 | local key 25 | for key in "${!array[@]}"; do 26 | if (( ${#key} > ${width} )); then 27 | width=${#key} 28 | fi 29 | done 30 | done 31 | 32 | echo ${width} 33 | } 34 | 35 | utils::array_value_max_width() { 36 | local width=0 37 | local array 38 | for array in "${@}"; do 39 | declare -n array="${1:?Missing array argument.}" 40 | 41 | local value 42 | for value in "${array[@]}"; do 43 | if (( ${#value} > ${width} )); then 44 | width=${#value} 45 | fi 46 | done 47 | done 48 | 49 | echo ${width} 50 | } 51 | 52 | utils::justify_string() { 53 | local width="${1:?Missing width argument.}" 54 | local string="${2:?Missing string argument.}" 55 | 56 | echo -n "${string}" 57 | 58 | local i 59 | for (( i=${#string}; i < ${width}; i++ )); do 60 | echo -n " " 61 | done 62 | } 63 | 64 | utils::prepend_output() { 65 | local prepend="${@}" 66 | local line 67 | while IFS= read -r line; do 68 | if [[ -n "${line}" ]]; then 69 | echo "${prepend}${line}" 70 | else 71 | echo 72 | fi 73 | done 74 | } 75 | -------------------------------------------------------------------------------- /functions/docker.clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header docker.clean 4 | 5 | rdo_docker_clean() { 6 | eval "$(args::init_subcommand "rdo build" "Build project.")" 7 | 8 | args::new_command "all" empty "Clean all project images" \ 9 | 'rdo_docker_clean_all' 10 | args::new_command "build" empty "Clean build project images" \ 11 | 'rdo_docker_clean_build' 12 | args::new_command "dangling" empty "Clean dangling project images" \ 13 | 'rdo_docker_clean_dangling' 14 | args::new_command "pkg-cache" empty "Clean package cache project images" \ 15 | 'rdo_docker_clean_pkg_cache' 16 | args::new_command "run" empty "Clean run project images" \ 17 | 'rdo_docker_clean_run' 18 | 19 | eval "$(args::process)" 20 | } 21 | 22 | rdo_docker_clean_all() { 23 | rdo_docker_clean__rm_filter "label=ancestor_project_root=rdo" 24 | } 25 | 26 | rdo_docker_clean_build() { 27 | rdo_docker_clean__rm_filter "label=ancestor_project_root=rdo" "label=ancestor_project=build" 28 | } 29 | 30 | rdo_docker_clean_dangling() { 31 | rdo_docker_clean__rm_filter "label=ancestor_project_root=rdo" "dangling=true" 32 | } 33 | rdo_docker_clean_pkg_cache() { 34 | rdo_docker_clean__rm_filter "label=ancestor_project_root=rdo" "label=ancestor_project=pkg-cache" 35 | } 36 | 37 | rdo_docker_clean_run() { 38 | rdo_docker_clean__rm_filter "label=ancestor_project_root=rdo" "label=ancestor_project=run" 39 | } 40 | 41 | # Helper functions 42 | 43 | rdo_docker_clean__rm_filter() { 44 | local filter_args=("${@}") 45 | 46 | if [[ -z "${filter_args[*]}" ]]; then 47 | print_error "rdo_docker_clean__rm_filter: no arguments" 48 | fi 49 | 50 | local args=() 51 | 52 | for arg in "${filter_args[@]}"; do 53 | args+=("--filter" "${arg}") 54 | done 55 | 56 | local containers=($(docker ps --all --quiet "${args[@]}")) 57 | if (( ${#containers[@]} > 0 )); then 58 | docker rm --force "${containers[@]}" || : 59 | fi 60 | 61 | local images=($(docker images --all --quiet "${args[@]}")) 62 | if (( ${#images[@]} > 0 )); then 63 | (docker rmi --force "${images[@]}" 2>&1 | grep -v 'Error: No such image:' >&2) || : 64 | fi 65 | } 66 | -------------------------------------------------------------------------------- /functions/git: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # - Add fallback to anonymouse git repositories. 4 | # - Store default remote and allow user to change it. 5 | 6 | include_header git 7 | 8 | rdo_git() { 9 | eval "$(args::init_subcommand "rdo build" "Build project.")" 10 | 11 | args::new_command "clone" empty "Clone all repositories" \ 12 | 'rdo_git_clone' 13 | 14 | eval "$(args::process)" 15 | } 16 | 17 | rdo_git_clone() { 18 | rdo_git__clone_repository "libtorrent" "git@github.com:rakshasa/libtorrent.git" 19 | rdo_git__clone_repository "rtorrent" "git@github.com:rakshasa/rtorrent.git" 20 | } 21 | 22 | # Helper functions 23 | 24 | rdo_git__clone_repository() { 25 | local name="${1:?Missing name argument.}" 26 | local repository="${2:?Missing repository argument.}" 27 | 28 | local path="./data/${name}" 29 | 30 | if ! [ -d "${path}" ]; then 31 | git clone "${repository}" "${path}" 32 | else 33 | print_progress "repository '${repository}' already exists, skipping" 34 | fi 35 | 36 | if ! (cd "${path}" && git status) &> /dev/null; then 37 | print_progress "repository '${repository}' is not valid, git status failed" 38 | fi 39 | } 40 | -------------------------------------------------------------------------------- /functions/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | include_header run 4 | 5 | rdo_run() { 6 | local cmd="${1}"; shift || : 7 | 8 | case "${cmd}" in 9 | init) 10 | rdo_run_init "${@}" 11 | ;; 12 | --help|-h|'') 13 | echo "Usage: do run COMMAND" 14 | echo 15 | echo "Run commands in containers" 16 | echo 17 | echo "Commands" 18 | echo " exec Foo" 19 | echo 20 | echo "Run 'do run COMMAND --help' for more information on a command." 21 | ;; 22 | *) 23 | rdo__exit__unknown_command "${cmd}" 24 | ;; 25 | esac 26 | } 27 | 28 | # 29 | # Refactor: 30 | # 31 | 32 | rdo_run_init() { 33 | local arg_rebuild= 34 | 35 | while true; do 36 | case "${1}" in 37 | --rebuild) 38 | arg_rebuild="yes" 39 | shift ;; 40 | --help|-h|'') 41 | echo "Initialize container" 42 | echo 43 | echo "Options:" 44 | echo " --rebuild Create new container" 45 | echo 46 | echo "Run 'rdo run init --help' for more information on a command." 47 | return 48 | ;; 49 | *) 50 | rdo__args__check_unknown_flag rdo_run_init "${@}" && break || exit 1 51 | ;; 52 | esac 53 | done 54 | 55 | local image_tag="${1:?Missing image tag argument.}" 56 | local image_id="$(rdo__image_id__tag "${image_tag}")" 57 | 58 | if [[ -z "${image_id}" ]]; then 59 | print_error "no such image: ${image_tag}" 60 | return 1 61 | fi 62 | 63 | # make this a flag, return hash 64 | local container_name="${2:?Missing container name argument.}" 65 | local container_id="$(rdo__container_id__name "${container_name}")" 66 | 67 | if [[ -n "${container_id}" ]] && 68 | ([[ "${arg_rebuild}" == "yes" ]] || [[ -z "$(rdo__running_container_id__name "${container_name}")" ]]); then 69 | print_progress "removing old container ${container_name}" 70 | docker rm -f "${container_id}" 71 | container_id= 72 | fi 73 | 74 | if [[ -n "${container_id}" ]]; then 75 | print_progress "using container ${container_name}" 76 | echo "${container_id}" 77 | return 78 | fi 79 | 80 | local project_data_path 81 | project_data_path="$(rdo__project_absolute_unix_path)/data" 82 | 83 | print_progress "starting build container ${container_name} with data path ${project_data_path}" 84 | 85 | docker run --detach --name "${container_name}" \ 86 | --volume "${project_data_path}:/data" \ 87 | "${image_id}" sleep 100000 88 | } 89 | -------------------------------------------------------------------------------- /functions/tags: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rdo_header tags 4 | 5 | do_tags() { 6 | local cmd="${1}"; shift || : 7 | 8 | case "${cmd}" in 9 | docker) 10 | tags_docker "${@}" 11 | ;; 12 | libtorrent) 13 | tags_libtorrent "${@}" 14 | ;; 15 | rtorrent) 16 | tags_rtorrent "${@}" 17 | ;; 18 | --help|-h|'') 19 | echo "Usage: do tags COMMAND" 20 | echo 21 | echo "Create and manage tags" 22 | echo 23 | echo "Commands" 24 | echo " docker Create tags for docker files" 25 | echo " libtorrent Create tags for libtorrent" 26 | echo " rtorrent Create tags for rtorrent" 27 | echo 28 | echo "Run 'do tags COMMAND --help' for more information on a command." 29 | ;; 30 | *) 31 | print_error "unknown tags command: ${@}" 32 | return 1 33 | ;; 34 | esac 35 | } 36 | 37 | tags_docker() { 38 | cd "./docker" 39 | 40 | rm -f TAGS || : 41 | 42 | if etags --version | grep Exuberant &> /dev/null; then 43 | # find . -name 'dockerfile.*' -not -name '*~' | etags -L - 44 | echo "ctags not supported" 45 | else 46 | find . -name 'dockerfile.*' -not -name '*~' | etags - 47 | fi 48 | } 49 | 50 | tags_libtorrent() { 51 | echo "not supported" 52 | } 53 | 54 | tags_rtorrent() { 55 | echo "not supported" 56 | } 57 | -------------------------------------------------------------------------------- /misc/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | echo "staging" > "/run/self/state" 6 | 7 | if [[ -f "/run/self/resolv.conf" ]]; then 8 | cp "/run/self/resolv.conf" "/etc/resolv.conf" 9 | fi 10 | 11 | run_netcat_server() { 12 | local hostname="${1:?Missing hostname argument.}" 13 | local reply="${2:?Missing reply argument.}" 14 | 15 | while true; do 16 | nc -N -l "${hostname}" 10000 < TIMEOUT )); then 28 | echo "error" > "/run/self/state" 29 | echo "staging_timeout" > "/run/self/error" 30 | exit 0 31 | fi 32 | 33 | if [[ ! -f "/run/self/signal" ]] || [[ "$(cat "/run/self/signal")" == "stage" ]]; then 34 | sleep 0.1 35 | continue 36 | fi 37 | 38 | if [[ "$(cat "/run/self/signal")" != "deploy" ]]; then 39 | echo "error" > "/run/self/state" 40 | echo "staging_unexpected_state" > "/run/self/error" 41 | exit 0 42 | fi 43 | 44 | break 45 | done 46 | 47 | echo "running" > "/run/self/state" 48 | 49 | mkdir -p "/run/self/logs" 50 | 51 | if ! ("/run/self/run" &> "/run/self/logs/entrypoint.log"); then 52 | echo "error" > "/run/self/state" 53 | echo "run_error" > "/run/self/error" 54 | exit 0 55 | fi 56 | 57 | echo "exited" > "/run/self/state" 58 | -------------------------------------------------------------------------------- /misc/gen-bash-profile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONTEXT_NAME="${1:?Missing context name argument.}" 4 | TAG_FULL="${2:?Missing tag full argument.}" 5 | 6 | set -e 7 | 8 | cat - <request, *write_ptr; 35 | 36 | -#ifdef WANT_FULLLOG_NETWORKS 37 | struct http_data *cookie = io_getcookie(sock); 38 | + 39 | + char ip6_str[INET6_ADDRSTRLEN] = {0}; 40 | + 41 | + if (ip6_isv4mapped(cookie->ip)) { 42 | + inet_ntop(AF_INET, cookie->ip + 12, ip6_str, INET6_ADDRSTRLEN); 43 | + } else { 44 | + inet_ntop(AF_INET6, cookie->ip, ip6_str, INET6_ADDRSTRLEN); 45 | + } 46 | + 47 | + printf("http_handle_request: %s\n---\n %.*s\n---\n", ip6_str, (int)ws->request_size, ws->request); 48 | + 49 | +#ifdef WANT_FULLLOG_NETWORKS 50 | if (loglist_check_address(cookie->ip)) { 51 | ot_log *log = malloc(sizeof(ot_log)); 52 | if (log) { 53 | -------------------------------------------------------------------------------- /misc/pkg-add: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | arg_packages="${@}" 6 | 7 | rm -rf /var/cache/apk-deploy &> /dev/null || : 8 | mkdir -p /var/cache/apk-deploy 9 | 10 | cd /var/cache/apk-stage 11 | find . -type d -exec mkdir -p "/var/cache/apk/{}" \; 12 | find . -type f -exec ln -s "/var/cache/apk-stage/{}" "/var/cache/apk/{}" \; 13 | 14 | if apk add --no-network ${arg_packages}; then 15 | echo "installed all packages from cache" 16 | exit 0 17 | fi 18 | 19 | if ! apk add ${arg_packages}; then 20 | echo "failed to install some packages from remote repository" 21 | exit 1 22 | fi 23 | 24 | echo "installed all packages from remote repository" 25 | 26 | cd /var/cache/apk 27 | find . -type d -exec mkdir -p "/var/cache/apk-deploy/{}" \; 28 | find . -type f -exec mv "{}" "/var/cache/apk-deploy/{}" \; 29 | -------------------------------------------------------------------------------- /misc/pkg-copy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | cd /stage 6 | 7 | if [[ -z "$(ls)" ]]; then 8 | exit 9 | fi 10 | 11 | for filename in *; do 12 | if [[ ! -f "${filename}" ]]; then 13 | echo "pkg-copy: not a file: ${filename}" 14 | exit 1 15 | fi 16 | 17 | cp -a "${filename}" "/deploy/${filename}" 18 | done 19 | -------------------------------------------------------------------------------- /misc/rancheros/os-service-docker-engine-20.10.8.yaml: -------------------------------------------------------------------------------- 1 | docker: 2 | image: rtdo/os-docker:20.10.8 3 | command: ros user-docker 4 | environment: 5 | - HTTP_PROXY 6 | - HTTPS_PROXY 7 | - NO_PROXY 8 | labels: 9 | io.rancher.os.scope: system 10 | io.rancher.os.after: console 11 | net: host 12 | pid: host 13 | ipc: host 14 | uts: host 15 | privileged: true 16 | restart: always 17 | volumes_from: 18 | - all-volumes 19 | volumes: 20 | - /sys:/host/sys 21 | - /var/lib/system-docker:/var/lib/system-docker:shared 22 | -------------------------------------------------------------------------------- /misc/rdo-file-move: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | while [ ${#} -ge 2 ]; do 6 | src_path="${1:?Missing src path argument.}" 7 | dst_path="${2:?Missing dst path argument.}" 8 | dst_dir="$(dirname "${dst_path}")" 9 | shift 2 10 | 11 | if [ ! -d "${dst_dir}" ]; then 12 | mkdir -p "${dst_dir}" 13 | fi 14 | 15 | if [ ! -e "${dst_path}" ] || ! diff -q "${src_path}" "${dst_path}"; then 16 | mv -v "${src_path}" "${dst_path}" 17 | fi 18 | done 19 | 20 | if [ ${#} -ne 0 ]; then 21 | echo "Unexpected number of arguments: ${#}" >&2 22 | exit 1 23 | fi 24 | -------------------------------------------------------------------------------- /misc/rdo-find-move: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -o pipefail 4 | 5 | ARG_COPY= 6 | ARG_REPLACE= 7 | ARG_KEEP_DIRECTORY= 8 | 9 | while true; do 10 | if [[ "${1}" == "--copy" ]]; then 11 | ARG_COPY="yes" 12 | shift 13 | continue 14 | fi 15 | 16 | if [[ "${1}" == "--replace" ]]; then 17 | ARG_REPLACE="yes" 18 | shift 19 | continue 20 | fi 21 | 22 | if [[ "${1}" == "--keep-directory" ]]; then 23 | ARG_KEEP_DIRECTORY="yes" 24 | shift 25 | continue 26 | fi 27 | 28 | break 29 | done 30 | 31 | if [[ -n "${4}" ]]; then 32 | echo "too many arguments: ${@}" >&2 33 | exit 1 34 | fi 35 | 36 | SRC_DIR="${1:?Missing source directory argument.}" 37 | DST_DIR="${2:?Missing destination directory argument.}" 38 | FIND_ARGS="${3:?Missing find argument.}" 39 | 40 | if [[ "${ARG_REPLACE}" == "yes" ]]; then 41 | rm -rf "${DST_DIR}" 42 | fi 43 | 44 | mkdir -p "${DST_DIR}" 45 | 46 | SRC_DIR="$(cd "${SRC_DIR}" && pwd)" 47 | DST_DIR="$(cd "${DST_DIR}" && pwd)" 48 | 49 | cd "${SRC_DIR}" 50 | 51 | find ./ \ 52 | ${FIND_ARGS} \ 53 | -exec dirname '{}' \; | uniq | tr '\n' '\0' | ( 54 | xargs -r0 -I {} sh -c "mkdir -p '${DST_DIR}/{}'; touch -r '${SRC_DIR}/{}' '${DST_DIR}/{}'" 55 | ) 56 | find ./ \ 57 | ${FIND_ARGS} \ 58 | -exec echo '{}' \; | tr '\n' '\0' | xargs -r0 -I {} /bin/bash --noprofile --norc -c " 59 | set +x 60 | 61 | if [[ '${ARG_COPY}' == 'yes' ]]; then 62 | if [[ ! -e '${DST_DIR}/{}' ]] || ! diff -q '${SRC_DIR}/{}' '${DST_DIR}/{}'; then 63 | cp -v '${SRC_DIR}/{}' '${DST_DIR}/{}'; 64 | fi 65 | else 66 | if [[ ! -e '${DST_DIR}/{}' ]] || ! diff -q '${SRC_DIR}/{}' '${DST_DIR}/{}'; then 67 | mv -v '${SRC_DIR}/{}' '${DST_DIR}/{}'; 68 | else 69 | rm -f '${SRC_DIR}/{}' 70 | fi 71 | fi 72 | " \; 73 | 74 | if [[ "${ARG_KEEP_DIRECTORY}" != "yes" ]]; then 75 | rm -rf "$(cd "${SRC_DIR}" &> /dev/null && pwd)" 76 | fi 77 | -------------------------------------------------------------------------------- /misc/rdo-iptables-flush: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -o pipefail 4 | 5 | ipv4_nat_rules="$(iptables-save --table nat | sed -n -e '/ -m comment --comment "rdo network/s/^-A /iptables --table nat -D /p')" 6 | ipv6_nat_rules="$(ip6tables-save --table nat | sed -n -e '/ -m comment --comment "rdo network/s/^-A /ip6tables --table nat -D /p')" 7 | ipv4_filter_rules="$(iptables-save --table filter | sed -n -e '/ -m comment --comment "rdo network/s/^-A /iptables --table filter -D /p')" 8 | ipv6_filter_rules="$(ip6tables-save --table filter | sed -n -e '/ -m comment --comment "rdo network/s/^-A /ip6tables --table filter -D /p')" 9 | 10 | rules="$(printf "%s\n%s\n" "${ipv4_nat_rules}" "${ipv6_nat_rules}" "${ipv4_filter_rules}" "${ipv6_filter_rules}")" 11 | 12 | if [[ -n "${rules}" ]]; then 13 | # echo "${ipv4_nat_rules}" 14 | # echo "${ipv6_nat_rules}" 15 | # echo "${ipv4_filter_rules}" 16 | # echo "${ipv6_filter_rules}" 17 | 18 | eval "${ipv4_nat_rules}" 19 | eval "${ipv6_nat_rules}" 20 | eval "${ipv4_filter_rules}" 21 | eval "${ipv6_filter_rules}" 22 | fi 23 | -------------------------------------------------------------------------------- /misc/rsync-stage-compile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | arg_source="${1:?Missing source argument.}" 6 | arg_target="${2:?Missing target argument.}" 7 | 8 | mkdir -p "${arg_target}" 9 | 10 | rsync -v -rlpgoD -muc -t --delete-after \ 11 | \ 12 | --include '*.am' \ 13 | --include '*.m4' \ 14 | --include '*.pc.in' \ 15 | --include '/configure.ac' \ 16 | --include '/autogen.sh' \ 17 | \ 18 | --include '*.c' \ 19 | --include '*.cc' \ 20 | --include '*.h' \ 21 | \ 22 | --include '*/' \ 23 | --exclude '*' \ 24 | \ 25 | ${arg_source} ${arg_target} 26 | -------------------------------------------------------------------------------- /misc/stat-list-mtime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | source_directory="${1:?Missing source directory argument.}" 6 | target_file="${2:?Missing target file argument.}" 7 | 8 | cd "${source_directory}" 9 | find . | xargs stat -c '%Y %n' > "${target_file}" 10 | -------------------------------------------------------------------------------- /misc/stat-update-mtime: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | source_file="${1:?Missing source file argument.}" 6 | target_directory="${1:?Missing target directory argument.}" 7 | 8 | while read -r line; do 9 | file_mtime="${line[0]}" 10 | file_name="${line[1]}" 11 | 12 | echo touch -m --date "${file_mtime}" "${file_name}" 13 | done < "${source_file}" 14 | -------------------------------------------------------------------------------- /templates/rc/rt-default: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat - < /proc/sys/kernel/yama/ptrace_scope 7 | 8 | tmux new -s rdo ' 9 | lldb \ 10 | --one-line "settings set target.disable-aslr false" \ 11 | --one-line run \ 12 | --one-line-on-crash "thread backtrace all" \ 13 | --file "rtorrent" \ 14 | -- -o "system.daemon.set=true,import=/run/self/rc" 15 | ' 16 | 17 | EOF 18 | -------------------------------------------------------------------------------- /templates/run/tracker-default: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat - <<"EOF" 4 | 5 | for nw in $(ls /run/self/interfaces/); do 6 | if [ -f "/run/self/interfaces/${nw}/inet" ]; then 7 | echo "listen.tcp_udp $(cat /run/self/interfaces/${nw}/inet)" >> /etc/opentracker/opentracker.conf 8 | fi 9 | if [ -f "/run/self/interfaces/${nw}/inet6" ]; then 10 | echo "listen.tcp_udp $(cat /run/self/interfaces/${nw}/inet6)" >> /etc/opentracker/opentracker.conf 11 | fi 12 | done 13 | 14 | opentracker -f /etc/opentracker/opentracker.conf 15 | 16 | EOF 17 | -------------------------------------------------------------------------------- /tests/ci-all: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | local TESTS=( 6 | ci-default 7 | ci-low-diskspace 8 | ci-nat 9 | ci-throttle 10 | ci-torrents 11 | ) 12 | 13 | local SUCCESSFUL_TESTS=() 14 | local FAILED_TESTS=() 15 | 16 | local test_name 17 | for test_name in "${TESTS[@]}"; do 18 | print_progress 19 | print_progress "running test: ${test_name}" 20 | print_progress 21 | 22 | if ./rdo batch "./tests/${test_name}"; then 23 | print_progress 24 | print_progress "*** SUCCEEDED ***" 25 | print_progress 26 | 27 | SUCCESSFUL_TESTS+=("${test_name}") 28 | else 29 | print_error 30 | print_error "*** FAILED ***" 31 | print_error 32 | 33 | FAILED_TESTS+=("${test_name}") 34 | fi 35 | done 36 | 37 | print_progress "CI results:" 38 | print_progress 39 | 40 | for t in "${SUCCESSFUL_TESTS[@]}"; do 41 | print_progress "succeeded: ${t}" 42 | done 43 | 44 | for t in "${FAILED_TESTS[@]}"; do 45 | print_error "failed: ${t}" 46 | done 47 | 48 | print_progress 49 | 50 | rdo_stage_clean 51 | 52 | if (( ${#FAILED_TESTS[@]} != 0 )); then 53 | return 1 54 | fi 55 | -------------------------------------------------------------------------------- /tests/ci-nat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Test rtorrent with NAT. 5 | # 6 | 7 | rdo_test_begin 8 | 9 | 10 | # 11 | # Topology, trackers and torrents: 12 | # 13 | 14 | rdo_stage_network --disable-ipv6 "rt-global-v4" 15 | 16 | rdo_stage_network "rt-nat-1" 17 | rdo_network_nat --network "rt-nat-1" --bridge "rt-global-v4" 18 | 19 | rdo_stage_network "rt-nat-2" 20 | rdo_network_nat --network "rt-nat-2" --bridge "rt-global-v4" 21 | 22 | rdo_stage_network "rt-nat-3" 23 | rdo_network_nat --network "rt-nat-3" --bridge "rt-global-v4" 24 | 25 | rdo_stage_dns --run-template "dns-default" --network "rt-global-v4" "rt-dns-global" 26 | rdo_stage_tracker --run-template "tracker-default" --network "rt-global-v4" "rt-tracker-global" 27 | 28 | rdo_stage_deploy 29 | 30 | default_rtorrent_args=( 31 | --run-template "rt-default" 32 | --dns-inet "rt-dns-global:rt-global-v4" 33 | ) 34 | 35 | 36 | # 37 | # Seeders: 38 | # 39 | 40 | rdo_stage_rtorrent \ 41 | "${default_rtorrent_args[@]}" \ 42 | --network "rt-global-v4" \ 43 | "rt-seed-global" 44 | 45 | rdo_torrent_create --domain "rt-tracker-global.rt" "torrent-global" 46 | rdo_torrent_node --seeder "rt-seed-global" "torrent-global" 47 | 48 | rdo_stage_deploy 49 | rdo_torrent_wait --print --wait-all \ 50 | \ 51 | --hash-done "rt-seed-global:torrent-global" \ 52 | --seeding "rt-seed-global:torrent-global" 53 | 54 | 55 | # 56 | # Leechers: 57 | # 58 | 59 | test_clients=( 60 | "rt-leech-nat-1-1" 61 | "rt-leech-nat-2-1" 62 | "rt-leech-nat-3-"{1..4} 63 | ) 64 | 65 | rdo_stage_rtorrent "${default_rtorrent_args[@]}" --network "rt-nat-1" "rt-leech-nat-1-1" 66 | rdo_stage_rtorrent "${default_rtorrent_args[@]}" --network "rt-nat-2" "rt-leech-nat-2-1" 67 | rdo_stage_rtorrent "${default_rtorrent_args[@]}" --network "rt-nat-3" "rt-leech-nat-3-"{1..4} 68 | 69 | rdo_torrent_node $(printf -- " --leecher %s" "${test_clients[@]}") "torrent-global" 70 | 71 | rdo_stage_deploy 72 | rdo_torrent_wait --print --wait-all \ 73 | $(printf -- " --completed %s:torrent-global" "${test_clients[@]}") 74 | 75 | rdo_test_end 76 | -------------------------------------------------------------------------------- /tests/ci-options: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Test default behavior of rtorrent in various network setttings. 5 | # 6 | 7 | rdo_test_begin 8 | 9 | 10 | # 11 | # Topology, trackers and torrents: 12 | # 13 | 14 | rdo_stage_network "rt-global" 15 | 16 | rdo_stage_dns --run-template "dns-default" --network "rt-global" "rt-dns-global" 17 | rdo_stage_tracker --run-template "tracker-default" --network "rt-global" "rt-tracker-global" 18 | 19 | rdo_stage_deploy 20 | 21 | default_client_args=( 22 | --run-template "rt-default" 23 | --network "rt-global" 24 | --dns-inet "rt-dns-global:rt-global" 25 | ) 26 | 27 | 28 | # 29 | # Seeders: 30 | # 31 | 32 | rdo_stage_rtorrent "${default_client_args[@]}" "rt-seed-global" 33 | 34 | rdo_torrent_create --domain "rt-tracker-global.rt" --size-mb "1" "torrent-1m" 35 | rdo_torrent_create --domain "rt-tracker-global.rt" --size-mb "5" "torrent-5m" 36 | rdo_torrent_node --seed --node "rt-seed-global" "torrent-1m" 37 | rdo_torrent_node --seed --node "rt-seed-global" "torrent-5m" 38 | 39 | rdo_stage_deploy 40 | rdo_torrent_wait --print --wait-all \ 41 | \ 42 | --hash-done "rt-seed-global:torrent-1m" \ 43 | --hash-done "rt-seed-global:torrent-5m" \ 44 | \ 45 | --seeding "rt-seed-global:torrent-1m" \ 46 | --seeding "rt-seed-global:torrent-5m" 47 | 48 | # 49 | # Test diskspace: 50 | # 51 | 52 | # Verify that all relevant torrents work. 53 | rdo_stage_rtorrent "${default_client_args[@]}" "rt-diskspace-verify-unlimited" 54 | rdo_torrent_node --node "rt-diskspace-verify-unlimited" "torrent-1m" 55 | rdo_torrent_node --node "rt-diskspace-verify-unlimited" "torrent-5m" 56 | 57 | # Verify that default disk space limit works. (not actually testing properly as the event is scheduled) 58 | # - Audit the 'Closed torrents due to low diskspace.' error. 59 | # - Consider test that don't rely on scheduled timers. 60 | rdo_stage_rtorrent "${default_client_args[@]}" --torrents-disksize "4m" "rt-diskspace-verify-5m-on-4m" 61 | rdo_torrent_node --node "rt-diskspace-verify-5m-on-4m" "torrent-5m" 62 | 63 | # Verify no low disk space event leaves client running. 64 | # rdo_stage_rtorrent "${default_client_args[@]}" --torrents-disksize "4m" "rt-diskspace-verify-5m-on-4m" 65 | # rdo_torrent_node --node "rt-diskspace-verify-5m-on-4m" "torrent-5m" 66 | 67 | rdo_stage_deploy 68 | rdo_torrent_wait --print --wait-all \ 69 | \ 70 | --completed "rt-diskspace-verify-unlimited:torrent-1m" \ 71 | --completed "rt-diskspace-verify-unlimited:torrent-5m" \ 72 | \ 73 | --not-completed "rt-diskspace-verify-5m-on-4m:torrent-5m" 74 | 75 | rdo_test_end 76 | -------------------------------------------------------------------------------- /tests/ci-priority: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Missing tests: 4 | # 5 | # * Add tests with throttle rather than tc. 6 | 7 | rdo_test_begin 8 | 9 | 10 | # 11 | # Topology, trackers and torrents: 12 | # 13 | 14 | rdo_stage_network "rt-global" 15 | 16 | rdo_stage_dns --run-template "dns-default" --network "rt-global" "rt-dns-global" 17 | rdo_stage_tracker --run-template "tracker-default" --network "rt-global" "rt-tracker-global" 18 | 19 | rdo_stage_deploy 20 | 21 | default_client_args=( 22 | --run-template "rt-default" 23 | --network "rt-global" 24 | --dns-inet "rt-dns-global:rt-global" 25 | ) 26 | 27 | # 28 | # Seeders: 29 | # 30 | 31 | rdo_stage_rtorrent "${default_client_args[@]}" "rt-seed-global" 32 | 33 | rdo_torrent_create --domain "rt-tracker-global.rt" --size-mb "1" "torrent-1m" 34 | rdo_torrent_create --domain "rt-tracker-global.rt" --size-mb "2" "torrent-2m" 35 | rdo_torrent_node --seeder "rt-seed-global" "torrent-1m" 36 | rdo_torrent_node --seeder "rt-seed-global" "torrent-2m" 37 | 38 | rdo_stage_deploy 39 | rdo_torrent_wait --print --wait-all \ 40 | --seeding "rt-seed-global:torrent-1m" \ 41 | --seeding "rt-seed-global:torrent-2m" 42 | 43 | 44 | # 45 | # Test throttle: 46 | # 47 | 48 | test_clients=( 49 | "rt-priority-default" 50 | "rt-priority-off" 51 | ) 52 | 53 | rdo_stage_rtorrent "${default_client_args[@]}" "${test_clients[@]}" 54 | 55 | rdo_network_tc_replace_root_tbf --rate-epsilon "${test_clients[@]}" 56 | 57 | rdo_stage_append_rc \ 58 | $(printf -- " --node %s" "${test_clients[@]}") \ 59 | '# Log priority changes and piece downloads. 60 | log.open_file = "ci-priority", /run/self/logs/ci-priority.log 61 | log.add_output = "torrent_info", "ci-priority" 62 | log.add_output = "protocol_piece_events", "ci-priority"' 63 | 64 | rdo_stage_append_rc \ 65 | --node "rt-priority-off" \ 66 | '# Set download choke queue priority to 0 and update it very second. 67 | method.set_key = event.download.inserted,priority_off,{(d.priority.set,0)} 68 | 69 | # TODO: This crashes the client. 70 | # schedule2 = update_choke_queue,1,1,((choke_group.down.update_balance,0)) 71 | 72 | # TODO: This does not produce logs. 73 | # schedule2 = update_choke_queue,1,1,((choke_group.down.update_balance,"default")) 74 | 75 | # TODO: Test that invalid name produces errors. 76 | #schedule2 = update_choke_queue,1,1,((choke_group.down.update_balance,"default-foo")) 77 | 78 | schedule2 = update_choke_queue,1,1,((choke_group.all.down.update_balance)) 79 | ' 80 | 81 | # Set min down unchoked to zero. 82 | 83 | # TODO: Use this to select priority for torrents. 84 | # method.set_key = event.download.inserted,priority_off, {(branch,((equal,(d.name),"torrent-1m")),((d.priority.set,0)))} 85 | 86 | rdo_torrent_node $(printf -- " --leecher %s" "${test_clients[@]}") "torrent-1m" 87 | 88 | rdo_stage_deploy 89 | rdo_torrent_wait --print --wait-all \ 90 | $(printf -- " --hash-done %s:torrent-1m" "${test_clients[@]}") 91 | 92 | rdo_network_tc_replace_root_tbf --rate 800kbit "${test_clients[@]}" 93 | 94 | rdo_torrent_wait --print --wait-all \ 95 | --completed "rt-priority-default:torrent-1m" \ 96 | --not-completed "rt-priority-off:torrent-1m" \ 97 | 98 | rdo_test_end 99 | -------------------------------------------------------------------------------- /tests/ci-torrents: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | rdo_test_begin 5 | 6 | # TODO: Disable dht. 7 | 8 | # 9 | # Topology, trackers and torrents: 10 | # 11 | 12 | rdo_stage_network "rt-global" 13 | 14 | rdo_stage_dns --run-template "dns-default" --network "rt-global" "rt-dns-global" 15 | rdo_stage_tracker --run-template "tracker-default" --network "rt-global" "rt-tracker-global-1" 16 | rdo_stage_tracker --run-template "tracker-default" --network "rt-global" "rt-tracker-global-2" 17 | rdo_stage_tracker --run-template "tracker-default" --network "rt-global" "rt-tracker-global-3" 18 | 19 | rdo_stage_deploy 20 | 21 | default_client_args=( 22 | --run-template "rt-default" 23 | --network "rt-global" 24 | --dns-inet "rt-dns-global:rt-global" 25 | ) 26 | 27 | # 28 | # Seeders: 29 | # 30 | 31 | rdo_stage_rtorrent "${default_client_args[@]}" "rt-seed-global" 32 | 33 | rdo_torrent_create --domain "rt-tracker-global-1.rt" "torrent-single-tracker" 34 | rdo_torrent_create --domain "rt-tracker-global-1.rt,rt-tracker-global-2.rt" "torrent-multiple-trackers" 35 | rdo_torrent_create --domain "rt-tracker-global-1.rt" --multi-file "torrent-multiple-files" 36 | 37 | # Single file torrents is still created using a directory, so fix torrent creation. 38 | rdo_torrent_node --seeder "rt-seed-global" "torrent-single-tracker" 39 | rdo_torrent_node --seeder "rt-seed-global" "torrent-multiple-trackers" 40 | rdo_torrent_node --seeder "rt-seed-global" "torrent-multiple-files" 41 | 42 | rdo_stage_deploy 43 | rdo_torrent_wait --print --wait-all \ 44 | --hash-done "rt-seed-global:torrent-single-tracker" \ 45 | --seeding "rt-seed-global:torrent-single-tracker" \ 46 | --hash-done "rt-seed-global:torrent-multiple-trackers" \ 47 | --seeding "rt-seed-global:torrent-multiple-trackers" \ 48 | --hash-done "rt-seed-global:torrent-multiple-files" \ 49 | --seeding "rt-seed-global:torrent-multiple-files" 50 | 51 | 52 | # 53 | # Leechers: 54 | # 55 | 56 | default_clients=( 57 | "rt-leech-global-"{1..4} 58 | ) 59 | 60 | rdo_stage_rtorrent "${default_client_args[@]}" \ 61 | --network "rt-global" \ 62 | "rt-leech-global-"{1..4} 63 | 64 | rdo_torrent_node \ 65 | $(printf -- " --leecher %s" "${default_clients[@]}") \ 66 | "torrent-single-tracker" 67 | 68 | rdo_torrent_node \ 69 | $(printf -- " --leecher %s" "${default_clients[@]}") \ 70 | "torrent-multiple-trackers" 71 | 72 | rdo_torrent_node \ 73 | --leecher "rt-leech-global-1" \ 74 | "torrent-multiple-files" 75 | 76 | rdo_stage_deploy 77 | rdo_torrent_wait --print --wait-all \ 78 | \ 79 | $(printf -- " --hash-done %s:torrent-single-tracker" "${default_clients[@]}") \ 80 | $(printf -- " --not-seeding %s:torrent-single-tracker" "${default_clients[@]}") \ 81 | $(printf -- " --completed %s:torrent-single-tracker" "${default_clients[@]}") \ 82 | \ 83 | $(printf -- " --hash-done %s:torrent-multiple-trackers" "${default_clients[@]}") \ 84 | $(printf -- " --not-seeding %s:torrent-multiple-trackers" "${default_clients[@]}") \ 85 | $(printf -- " --completed %s:torrent-multiple-trackers" "${default_clients[@]}") \ 86 | \ 87 | $(printf -- " --hash-done %s:torrent-multiple-files" "rt-leech-global-1") \ 88 | $(printf -- " --not-seeding %s:torrent-multiple-files" "rt-leech-global-1") \ 89 | $(printf -- " --completed %s:torrent-multiple-files" "rt-leech-global-1") 90 | 91 | 92 | rdo_test_end 93 | -------------------------------------------------------------------------------- /tests/unit-all: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | local VARIANTS=( 6 | alpine-3 7 | #alpine-3-lua 8 | alpine-3-tinyxml2 9 | alpine-3-xmlrpc-c 10 | alpine-3-lua-xmlrpc-c 11 | #ubuntu-20.04 12 | ) 13 | 14 | # On error, print a message and exit 15 | trap 'echo "Failed to build variant: ${v}"' ERR 16 | 17 | for v in "${VARIANTS[@]}"; do 18 | echo "---------------------------------" 19 | echo "Building variant: ${v}" 20 | echo "---------------------------------" 21 | 22 | rdo_build_variant "${v}" 23 | done 24 | --------------------------------------------------------------------------------