From d73119a493a5cd64b620e2729af673d5b80b8cd4 Mon Sep 17 00:00:00 2001 From: structix Date: Sun, 11 Oct 2020 18:17:12 +0200 Subject: [PATCH] Update vendor files --- go.mod | 10 + go.sum | 22 + .../go-playground/validator/v10/.gitignore | 3 +- .../go-playground/validator/v10/.travis.yml | 6 +- .../go-playground/validator/v10/README.md | 154 +- .../go-playground/validator/v10/baked_in.go | 238 +- .../validator/v10/country_codes.go | 162 + .../go-playground/validator/v10/doc.go | 195 +- .../go-playground/validator/v10/errors.go | 31 +- .../go-playground/validator/v10/go.mod | 1 + .../go-playground/validator/v10/go.sum | 7 + .../go-playground/validator/v10/regexes.go | 14 +- .../go-playground/validator/v10/util.go | 21 + .../go-playground/validator/v10/validator.go | 2 +- .../validator/v10/validator_instance.go | 8 +- .../github.com/hashicorp/errwrap/errwrap.go | 9 + vendor/github.com/json-iterator/go/README.md | 36 +- vendor/github.com/json-iterator/go/any_str.go | 4 +- vendor/github.com/json-iterator/go/config.go | 4 +- .../json-iterator/go/iter_object.go | 4 +- .../json-iterator/go/reflect_extension.go | 2 +- .../json-iterator/go/reflect_map.go | 80 +- .../json-iterator/go/reflect_optional.go | 4 - .../go/reflect_struct_decoder.go | 22 +- vendor/github.com/json-iterator/go/stream.go | 5 +- vendor/github.com/lib/pq/.travis.yml | 8 +- vendor/github.com/lib/pq/CONTRIBUTING.md | 29 - vendor/github.com/lib/pq/README.md | 77 +- vendor/github.com/lib/pq/conn.go | 89 +- vendor/github.com/lib/pq/connector.go | 7 +- vendor/github.com/lib/pq/copy.go | 29 +- vendor/github.com/lib/pq/doc.go | 23 + vendor/github.com/lib/pq/encode.go | 20 + vendor/github.com/lib/pq/go.mod | 2 + vendor/github.com/lib/pq/krb.go | 27 + vendor/github.com/lib/pq/notice.go | 71 + vendor/github.com/lib/pq/notify.go | 63 +- vendor/github.com/lib/pq/user_posix.go | 2 +- .../modern-go/concurrent/.gitignore | 1 + .../modern-go/concurrent/.travis.yml | 14 + .../github.com/modern-go/concurrent/README.md | 49 +- .../modern-go/concurrent/executor.go | 9 +- .../modern-go/concurrent/go_above_19.go | 4 +- .../modern-go/concurrent/go_below_19.go | 5 +- vendor/github.com/modern-go/concurrent/log.go | 13 + .../github.com/modern-go/concurrent/test.sh | 12 + .../concurrent/unbounded_executor.go | 62 +- .../github.com/modern-go/reflect2/type_map.go | 16 +- vendor/github.com/ugorji/go/codec/LICENSE | 2 +- vendor/github.com/ugorji/go/codec/README.md | 281 + vendor/github.com/ugorji/go/codec/binc.go | 391 +- vendor/github.com/ugorji/go/codec/build.sh | 73 +- vendor/github.com/ugorji/go/codec/cbor.go | 325 +- vendor/github.com/ugorji/go/codec/decimal.go | 461 ++ vendor/github.com/ugorji/go/codec/decode.go | 509 +- vendor/github.com/ugorji/go/codec/doc.go | 2 +- vendor/github.com/ugorji/go/codec/encode.go | 132 +- .../ugorji/go/codec/fast-path.generated.go | 4698 +++-------------- .../ugorji/go/codec/fast-path.go.tmpl | 95 +- .../ugorji/go/codec/fast-path.not.go | 14 +- vendor/github.com/ugorji/go/codec/float.go | 313 -- .../ugorji/go/codec/gen-dec-map.go.tmpl | 2 +- .../ugorji/go/codec/gen-helper.generated.go | 37 +- .../ugorji/go/codec/gen-helper.go.tmpl | 37 +- .../ugorji/go/codec/gen.generated.go | 4 +- vendor/github.com/ugorji/go/codec/gen.go | 593 ++- vendor/github.com/ugorji/go/codec/go.mod | 6 +- vendor/github.com/ugorji/go/codec/go.sum | 0 .../go/codec/goversion_arrayof_gte_go15.go | 2 +- .../go/codec/goversion_arrayof_lt_go15.go | 11 +- .../go/codec/goversion_fmt_time_gte_go15.go | 2 +- .../go/codec/goversion_fmt_time_lt_go15.go | 2 +- .../go/codec/goversion_makemap_gte_go19.go | 8 +- .../go/codec/goversion_makemap_lt_go19.go | 2 +- .../go/codec/goversion_maprange_gte_go112.go | 4 +- .../go/codec/goversion_maprange_lt_go112.go | 5 +- ...version_unexportedembeddedptr_gte_go110.go | 2 +- ...oversion_unexportedembeddedptr_lt_go110.go | 2 +- .../go/codec/goversion_unsupported_lt_go14.go | 8 +- .../go/codec/goversion_vendor_eq_go15.go | 2 +- .../go/codec/goversion_vendor_eq_go16.go | 2 +- .../go/codec/goversion_vendor_gte_go17.go | 2 +- .../go/codec/goversion_vendor_lt_go15.go | 2 +- vendor/github.com/ugorji/go/codec/helper.go | 429 +- .../ugorji/go/codec/helper_internal.go | 145 +- .../ugorji/go/codec/helper_not_unsafe.go | 16 +- .../ugorji/go/codec/helper_unsafe.go | 45 +- vendor/github.com/ugorji/go/codec/json.go | 629 +-- .../ugorji/go/codec/mammoth-test.go.tmpl | 11 +- .../ugorji/go/codec/mammoth2-test.go.tmpl | 2 +- vendor/github.com/ugorji/go/codec/msgpack.go | 319 +- vendor/github.com/ugorji/go/codec/prebuild.go | 136 - vendor/github.com/ugorji/go/codec/reader.go | 641 +-- .../ugorji/go/codec/register_ext.go | 2 +- vendor/github.com/ugorji/go/codec/rpc.go | 93 +- vendor/github.com/ugorji/go/codec/simple.go | 207 +- .../ugorji/go/codec/sort-slice.generated.go | 140 +- .../ugorji/go/codec/sort-slice.go.tmpl | 4 +- vendor/github.com/ugorji/go/codec/test.py | 30 +- vendor/github.com/ugorji/go/codec/writer.go | 72 +- vendor/golang.org/x/crypto/sha3/doc.go | 66 + vendor/golang.org/x/crypto/sha3/hashes.go | 97 + .../x/crypto/sha3/hashes_generic.go | 27 + vendor/golang.org/x/crypto/sha3/keccakf.go | 412 ++ .../golang.org/x/crypto/sha3/keccakf_amd64.go | 13 + .../golang.org/x/crypto/sha3/keccakf_amd64.s | 390 ++ vendor/golang.org/x/crypto/sha3/register.go | 18 + vendor/golang.org/x/crypto/sha3/sha3.go | 193 + vendor/golang.org/x/crypto/sha3/sha3_s390x.go | 284 + vendor/golang.org/x/crypto/sha3/sha3_s390x.s | 33 + vendor/golang.org/x/crypto/sha3/shake.go | 173 + .../golang.org/x/crypto/sha3/shake_generic.go | 19 + vendor/golang.org/x/crypto/sha3/xor.go | 23 + .../golang.org/x/crypto/sha3/xor_generic.go | 28 + .../golang.org/x/crypto/sha3/xor_unaligned.go | 67 + vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 17 + vendor/golang.org/x/sys/cpu/byteorder.go | 65 + vendor/golang.org/x/sys/cpu/cpu.go | 287 + vendor/golang.org/x/sys/cpu/cpu_aix.go | 32 + vendor/golang.org/x/sys/cpu/cpu_arm.go | 73 + vendor/golang.org/x/sys/cpu/cpu_arm64.go | 173 + vendor/golang.org/x/sys/cpu/cpu_arm64.s | 31 + .../cpu_gc_arm64.go} | 10 +- vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 + vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 16 + .../cpu_gccgo_arm64.go} | 10 +- .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 43 + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 26 + vendor/golang.org/x/sys/cpu/cpu_linux.go | 15 + vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 + .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 71 + .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 23 + .../cpu_linux_noinit.go} | 6 +- .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 31 + .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 159 + vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 15 + vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 11 + vendor/golang.org/x/sys/cpu/cpu_other_arm.go | 9 + .../cpu_other_arm64.go} | 6 +- vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 16 + vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 11 + vendor/golang.org/x/sys/cpu/cpu_s390x.go | 30 + vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 + vendor/golang.org/x/sys/cpu/cpu_wasm.go | 17 + vendor/golang.org/x/sys/cpu/cpu_x86.go | 135 + vendor/golang.org/x/sys/cpu/cpu_x86.s | 27 + vendor/golang.org/x/sys/cpu/hwcap_linux.go | 56 + .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 + .../x/sys/cpu/syscall_aix_ppc64_gc.go | 36 + .../x/sys/unix/asm_openbsd_mips64.s | 29 + vendor/golang.org/x/sys/unix/fcntl_darwin.go | 6 + vendor/golang.org/x/sys/unix/gccgo.go | 2 - vendor/golang.org/x/sys/unix/gccgo_c.c | 6 + vendor/golang.org/x/sys/unix/ioctl.go | 9 + vendor/golang.org/x/sys/unix/mkall.sh | 15 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 9 +- .../x/sys/unix/sockcmsg_unix_other.go | 6 +- vendor/golang.org/x/sys/unix/syscall_bsd.go | 17 +- .../x/sys/unix/syscall_darwin.1_12.go | 4 +- .../golang.org/x/sys/unix/syscall_darwin.go | 81 +- .../x/sys/unix/syscall_darwin_386.go | 4 - .../x/sys/unix/syscall_darwin_amd64.go | 4 - .../x/sys/unix/syscall_darwin_arm.go | 4 - .../x/sys/unix/syscall_darwin_arm64.go | 4 - .../x/sys/unix/syscall_dragonfly.go | 15 - .../golang.org/x/sys/unix/syscall_freebsd.go | 15 - .../golang.org/x/sys/unix/syscall_illumos.go | 41 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 71 +- .../x/sys/unix/syscall_linux_arm.go | 5 - .../x/sys/unix/syscall_linux_gc_arm.go | 13 + .../golang.org/x/sys/unix/syscall_netbsd.go | 15 - .../golang.org/x/sys/unix/syscall_openbsd.go | 15 - .../x/sys/unix/syscall_openbsd_mips64.go | 35 + .../golang.org/x/sys/unix/syscall_solaris.go | 7 +- .../x/sys/unix/zerrors_darwin_386.go | 2 + .../x/sys/unix/zerrors_darwin_amd64.go | 2 + .../x/sys/unix/zerrors_darwin_arm.go | 2 + .../x/sys/unix/zerrors_darwin_arm64.go | 2 + .../x/sys/unix/zerrors_dragonfly_amd64.go | 138 +- vendor/golang.org/x/sys/unix/zerrors_linux.go | 163 + .../x/sys/unix/zerrors_linux_386.go | 2 + .../x/sys/unix/zerrors_linux_amd64.go | 2 + .../x/sys/unix/zerrors_linux_arm.go | 2 + .../x/sys/unix/zerrors_linux_arm64.go | 2 + .../x/sys/unix/zerrors_linux_mips.go | 2 + .../x/sys/unix/zerrors_linux_mips64.go | 2 + .../x/sys/unix/zerrors_linux_mips64le.go | 2 + .../x/sys/unix/zerrors_linux_mipsle.go | 2 + .../x/sys/unix/zerrors_linux_ppc64.go | 2 + .../x/sys/unix/zerrors_linux_ppc64le.go | 2 + .../x/sys/unix/zerrors_linux_riscv64.go | 2 + .../x/sys/unix/zerrors_linux_s390x.go | 2 + .../x/sys/unix/zerrors_linux_sparc64.go | 2 + .../x/sys/unix/zerrors_openbsd_mips64.go | 1862 +++++++ .../x/sys/unix/zsyscall_darwin_386.1_11.go | 1809 ------- .../x/sys/unix/zsyscall_darwin_386.go | 107 +- .../x/sys/unix/zsyscall_darwin_386.s | 14 +- .../x/sys/unix/zsyscall_darwin_amd64.1_11.go | 1809 ------- .../x/sys/unix/zsyscall_darwin_amd64.go | 107 +- .../x/sys/unix/zsyscall_darwin_amd64.s | 14 +- .../x/sys/unix/zsyscall_darwin_arm.1_11.go | 1782 ------- .../x/sys/unix/zsyscall_darwin_arm.go | 107 +- .../x/sys/unix/zsyscall_darwin_arm.s | 14 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 107 +- .../x/sys/unix/zsyscall_darwin_arm64.s | 14 +- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 32 +- .../x/sys/unix/zsyscall_illumos_amd64.go | 29 +- .../golang.org/x/sys/unix/zsyscall_linux.go | 16 + ...m64.1_11.go => zsyscall_openbsd_mips64.go} | 510 +- .../x/sys/unix/zsysctl_openbsd_mips64.go | 279 + .../x/sys/unix/zsysnum_darwin_386.go | 436 -- .../x/sys/unix/zsysnum_darwin_amd64.go | 438 -- .../x/sys/unix/zsysnum_darwin_arm.go | 436 -- .../x/sys/unix/zsysnum_darwin_arm64.go | 436 -- .../x/sys/unix/zsysnum_dragonfly_amd64.go | 255 +- .../x/sys/unix/zsysnum_openbsd_mips64.go | 220 + .../x/sys/unix/ztypes_darwin_386.go | 17 +- .../x/sys/unix/ztypes_darwin_amd64.go | 28 +- .../x/sys/unix/ztypes_darwin_arm.go | 24 +- .../x/sys/unix/ztypes_darwin_arm64.go | 28 +- .../x/sys/unix/ztypes_dragonfly_amd64.go | 46 +- vendor/golang.org/x/sys/unix/ztypes_linux.go | 325 +- .../x/sys/unix/ztypes_openbsd_mips64.go | 565 ++ vendor/gopkg.in/yaml.v2/apic.go | 1 + vendor/modules.txt | 33 +- 226 files changed, 13364 insertions(+), 15397 deletions(-) create mode 100644 vendor/github.com/go-playground/validator/v10/country_codes.go delete mode 100644 vendor/github.com/lib/pq/CONTRIBUTING.md create mode 100644 vendor/github.com/lib/pq/krb.go create mode 100644 vendor/github.com/lib/pq/notice.go create mode 100644 vendor/github.com/modern-go/concurrent/.gitignore create mode 100644 vendor/github.com/modern-go/concurrent/.travis.yml create mode 100644 vendor/github.com/modern-go/concurrent/log.go create mode 100644 vendor/github.com/modern-go/concurrent/test.sh create mode 100644 vendor/github.com/ugorji/go/codec/README.md create mode 100644 vendor/github.com/ugorji/go/codec/decimal.go delete mode 100644 vendor/github.com/ugorji/go/codec/float.go create mode 100644 vendor/github.com/ugorji/go/codec/go.sum delete mode 100644 vendor/github.com/ugorji/go/codec/prebuild.go create mode 100644 vendor/golang.org/x/crypto/sha3/doc.go create mode 100644 vendor/golang.org/x/crypto/sha3/hashes.go create mode 100644 vendor/golang.org/x/crypto/sha3/hashes_generic.go create mode 100644 vendor/golang.org/x/crypto/sha3/keccakf.go create mode 100644 vendor/golang.org/x/crypto/sha3/keccakf_amd64.go create mode 100644 vendor/golang.org/x/crypto/sha3/keccakf_amd64.s create mode 100644 vendor/golang.org/x/crypto/sha3/register.go create mode 100644 vendor/golang.org/x/crypto/sha3/sha3.go create mode 100644 vendor/golang.org/x/crypto/sha3/sha3_s390x.go create mode 100644 vendor/golang.org/x/crypto/sha3/sha3_s390x.s create mode 100644 vendor/golang.org/x/crypto/sha3/shake.go create mode 100644 vendor/golang.org/x/crypto/sha3/shake_generic.go create mode 100644 vendor/golang.org/x/crypto/sha3/xor.go create mode 100644 vendor/golang.org/x/crypto/sha3/xor_generic.go create mode 100644 vendor/golang.org/x/crypto/sha3/xor_unaligned.go create mode 100644 vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s create mode 100644 vendor/golang.org/x/sys/cpu/byteorder.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_aix.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.s rename vendor/golang.org/x/sys/{unix/syscall_darwin_arm.1_11.go => cpu/cpu_gc_arm64.go} (54%) create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_x86.go rename vendor/golang.org/x/sys/{unix/syscall_darwin_arm64.1_11.go => cpu/cpu_gccgo_arm64.go} (53%) create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_arm.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go rename vendor/golang.org/x/sys/{unix/syscall_darwin_386.1_11.go => cpu/cpu_linux_noinit.go} (53%) create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_mips64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_mipsx.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_other_arm.go rename vendor/golang.org/x/sys/{unix/syscall_darwin_amd64.1_11.go => cpu/cpu_other_arm64.go} (53%) create mode 100644 vendor/golang.org/x/sys/cpu/cpu_ppc64x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_riscv64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_s390x.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_s390x.s create mode 100644 vendor/golang.org/x/sys/cpu/cpu_wasm.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_x86.s create mode 100644 vendor/golang.org/x/sys/cpu/hwcap_linux.go create mode 100644 vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go create mode 100644 vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go create mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go create mode 100644 vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go rename vendor/golang.org/x/sys/unix/{zsyscall_darwin_arm64.1_11.go => zsyscall_openbsd_mips64.go} (86%) create mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go diff --git a/go.mod b/go.mod index 3f16cb5..2d6c9fc 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,16 @@ go 1.15 require ( github.com/caarlos0/env/v6 v6.3.0 github.com/gin-gonic/gin v1.6.3 + github.com/go-playground/validator/v10 v10.4.0 // indirect github.com/golang-migrate/migrate/v4 v4.13.0 + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/jackc/pgx/v4 v4.9.0 + github.com/json-iterator/go v1.1.10 // indirect + github.com/lib/pq v1.8.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/ugorji/go v1.1.10 // indirect + golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect + golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect ) diff --git a/go.sum b/go.sum index e3489e9..04ae543 100644 --- a/go.sum +++ b/go.sum @@ -104,6 +104,8 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.4.0 h1:72qIR/m8ybvL8L5TIyfgrigqkrw7kVYAvjEvpT85l70= +github.com/go-playground/validator/v10 v10.4.0/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -181,6 +183,8 @@ github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -245,6 +249,8 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= @@ -266,6 +272,8 @@ github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= +github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -280,8 +288,12 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/mutecomm/go-sqlcipher/v4 v4.4.0/go.mod h1:PyN04SaWalavxRGH9E8ZftG6Ju7rsPrGmQRjrEaVpiY= @@ -333,8 +345,12 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/tidwall/pretty v0.0.0-20180105212114-65a9db5fad51/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go v1.1.10 h1:Mh7W3N/hGJJ8fRQNHIgomNTa0CgZc0aKDFvbgHl+U7A= +github.com/ugorji/go v1.1.10/go.mod h1:/tC+H0R6N4Lcv4DoSdphIa9y/RAs4QFHDtN9W2oQcHw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.1.10 h1:otofY/FAoRTMVqlVeDv/Kpm04D13lfJdrDqPbc3axg4= +github.com/ugorji/go/codec v1.1.10/go.mod h1:jdPQoxvTq1mb8XV6RmofOz5UgNKV2czR6xvxXGwy1Bo= github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -372,6 +388,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnk golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE= +golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -485,6 +503,8 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw= golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 h1:bNEHhJCnrwMKNMmOx3yAynp5vs5/gRy+XWFtZFu7NBM= +golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -647,6 +667,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/go-playground/validator/v10/.gitignore b/vendor/github.com/go-playground/validator/v10/.gitignore index 792ca00..6e43fac 100644 --- a/vendor/github.com/go-playground/validator/v10/.gitignore +++ b/vendor/github.com/go-playground/validator/v10/.gitignore @@ -6,6 +6,7 @@ # Folders _obj _test +bin # Architecture specific extensions/prefixes *.[568vq] @@ -26,4 +27,4 @@ _testmain.go *.out *.txt cover.html -README.html \ No newline at end of file +README.html diff --git a/vendor/github.com/go-playground/validator/v10/.travis.yml b/vendor/github.com/go-playground/validator/v10/.travis.yml index b88bb9f..85a7be3 100644 --- a/vendor/github.com/go-playground/validator/v10/.travis.yml +++ b/vendor/github.com/go-playground/validator/v10/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.13.4 + - 1.15.2 - tip matrix: allow_failures: @@ -25,5 +25,5 @@ script: - go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./... after_success: | - [ $TRAVIS_GO_VERSION = 1.13.4 ] && - goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN \ No newline at end of file + [ $TRAVIS_GO_VERSION = 1.15.2 ] && + goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN diff --git a/vendor/github.com/go-playground/validator/v10/README.md b/vendor/github.com/go-playground/validator/v10/README.md index daf28f1..054f294 100644 --- a/vendor/github.com/go-playground/validator/v10/README.md +++ b/vendor/github.com/go-playground/validator/v10/README.md @@ -1,20 +1,20 @@ Package validator ================ [![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -![Project status](https://img.shields.io/badge/version-10.1.0-green.svg) +![Project status](https://img.shields.io/badge/version-10.3.0-green.svg) [![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator) [![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator) -[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://godoc.org/github.com/go-playground/validator) +[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://pkg.go.dev/github.com/go-playground/validator/v10) ![License](https://img.shields.io/dub/l/vibe-d.svg) Package validator implements value validations for structs and individual fields based on tags. It has the following **unique** features: -- Cross Field and Cross Struct validations by using validation tags or custom validators. +- Cross Field and Cross Struct validations by using validation tags or custom validators. - Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated. -- Ability to dive into both map keys and values for validation +- Ability to dive into both map keys and values for validation - Handles type interface by determining it's underlying type prior to validation. - Handles custom field types such as sql driver Valuer see [Valuer](https://golang.org/src/database/sql/driver/types.go?s=1210:1293#L29) - Alias validation tags, which allows for mapping of several validations to a single tag for easier defining of validations on structs @@ -64,6 +64,152 @@ Please see https://godoc.org/github.com/go-playground/validator for detailed usa - [Gin upgrade and/or override validator](https://github.com/go-playground/validator/tree/v9/_examples/gin-upgrading-overriding) - [wash - an example application putting it all together](https://github.com/bluesuncorp/wash) +Baked-in Validations +------ + +### Fields: + +| Tag | Description | +| - | - | +| eqcsfield | Field Equals Another Field (relative)| +| eqfield | Field Equals Another Field | +| fieldcontains | NOT DOCUMENTED IN doc.go | +| fieldexcludes | NOT DOCUMENTED IN doc.go | +| gtcsfield | Field Greater Than Another Relative Field | +| gtecsfield | Field Greater Than or Equal To Another Relative Field | +| gtefield | Field Greater Than or Equal To Another Field | +| gtfield | Field Greater Than Another Field | +| ltcsfield | Less Than Another Relative Field | +| ltecsfield | Less Than or Equal To Another Relative Field | +| ltefield | Less Than or Equal To Another Field | +| ltfield | Less Than Another Field | +| necsfield | Field Does Not Equal Another Field (relative) | +| nefield | Field Does Not Equal Another Field | + +### Network: + +| Tag | Description | +| - | - | +| cidr | Classless Inter-Domain Routing CIDR | +| cidrv4 | Classless Inter-Domain Routing CIDRv4 | +| cidrv6 | Classless Inter-Domain Routing CIDRv6 | +| datauri | Data URL | +| fqdn | Full Qualified Domain Name (FQDN) | +| hostname | Hostname RFC 952 | +| hostname_port | HostPort | +| hostname_rfc1123 | Hostname RFC 1123 | +| ip | Internet Protocol Address IP | +| ip4_addr | Internet Protocol Address IPv4 | +| ip6_addr |Internet Protocol Address IPv6 | +| ip_addr | Internet Protocol Address IP | +| ipv4 | Internet Protocol Address IPv4 | +| ipv6 | Internet Protocol Address IPv6 | +| mac | Media Access Control Address MAC | +| tcp4_addr | Transmission Control Protocol Address TCPv4 | +| tcp6_addr | Transmission Control Protocol Address TCPv6 | +| tcp_addr | Transmission Control Protocol Address TCP | +| udp4_addr | User Datagram Protocol Address UDPv4 | +| udp6_addr | User Datagram Protocol Address UDPv6 | +| udp_addr | User Datagram Protocol Address UDP | +| unix_addr | Unix domain socket end point Address | +| uri | URI String | +| url | URL String | +| url_encoded | URL Encoded | +| urn_rfc2141 | Urn RFC 2141 String | + +### Strings: + +| Tag | Description | +| - | - | +| alpha | Alpha Only | +| alphanum | Alphanumeric | +| alphanumunicode | Alphanumeric Unicode | +| alphaunicode | Alpha Unicode | +| ascii | ASCII | +| contains | Contains | +| containsany | Contains Any | +| containsrune | Contains Rune | +| endswith | Ends With | +| lowercase | Lowercase | +| multibyte | Multi-Byte Characters | +| number | NOT DOCUMENTED IN doc.go | +| numeric | Numeric | +| printascii | Printable ASCII | +| startswith | Starts With | +| uppercase | Uppercase | + +### Format: +| Tag | Description | +| - | - | +| base64 | Base64 String | +| base64url | Base64URL String | +| btc_addr | Bitcoin Address | +| btc_addr_bech32 | Bitcoin Bech32 Address (segwit) | +| datetime | Datetime | +| e164 | e164 formatted phone number | +| email | E-mail String +| eth_addr | Ethereum Address | +| hexadecimal | Hexadecimal String | +| hexcolor | Hexcolor String | +| hsl | HSL String | +| hsla | HSLA String | +| html | HTML Tags | +| html_encoded | HTML Encoded | +| isbn | International Standard Book Number | +| isbn10 | International Standard Book Number 10 | +| isbn13 | International Standard Book Number 13 | +| json | JSON | +| latitude | Latitude | +| longitude | Longitude | +| rgb | RGB String | +| rgba | RGBA String | +| ssn | Social Security Number SSN | +| uuid | Universally Unique Identifier UUID | +| uuid3 | Universally Unique Identifier UUID v3 | +| uuid3_rfc4122 | Universally Unique Identifier UUID v3 RFC4122 | +| uuid4 | Universally Unique Identifier UUID v4 | +| uuid4_rfc4122 | Universally Unique Identifier UUID v4 RFC4122 | +| uuid5 | Universally Unique Identifier UUID v5 | +| uuid5_rfc4122 | Universally Unique Identifier UUID v5 RFC4122 | +| uuid_rfc4122 | Universally Unique Identifier UUID RFC4122 | + +### Comparisons: +| Tag | Description | +| - | - | +| eq | Equals | +| gt | Greater than| +| gte |Greater than or equal | +| lt | Less Than | +| lte | Less Than or Equal | +| ne | Not Equal | + +### Other: +| Tag | Description | +| - | - | +| dir | Directory | +| endswith | Ends With | +| excludes | Excludes | +| excludesall | Excludes All | +| excludesrune | Excludes Rune | +| file | File path | +| isdefault | Is Default | +| len | Length | +| max | Maximum | +| min | Minimum | +| oneof | One Of | +| required | Required | +| required_if | Required If | +| required_unless | Required Unless | +| required_with | Required With | +| required_with_all | Required With All | +| required_without | Required Without | +| required_without_all | Required Without All | +| excluded_with | Excluded With | +| excluded_with_all | Excluded With All | +| excluded_without | Excluded Without | +| excluded_without_all | Excluded Without All | +| unique | Unique | + Benchmarks ------ ###### Run on MacBook Pro (15-inch, 2017) go version go1.10.2 darwin/amd64 diff --git a/vendor/github.com/go-playground/validator/v10/baked_in.go b/vendor/github.com/go-playground/validator/v10/baked_in.go index 4124c62..ca3d3b9 100644 --- a/vendor/github.com/go-playground/validator/v10/baked_in.go +++ b/vendor/github.com/go-playground/validator/v10/baked_in.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "crypto/sha256" + "encoding/hex" "encoding/json" "fmt" "net" @@ -16,6 +17,8 @@ import ( "time" "unicode/utf8" + "golang.org/x/crypto/sha3" + urn "github.com/leodido/go-urn" ) @@ -56,7 +59,8 @@ var ( // defines a common or complex set of validation(s) to simplify // adding validation to structs. bakedInAliases = map[string]string{ - "iscolor": "hexcolor|rgb|rgba|hsl|hsla", + "iscolor": "hexcolor|rgb|rgba|hsl|hsla", + "country_code": "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric", } // BakedInValidators is the default map of ValidationFunc @@ -64,10 +68,16 @@ var ( // or even disregard and use your own map if so desired. bakedInValidators = map[string]Func{ "required": hasValue, + "required_if": requiredIf, + "required_unless": requiredUnless, "required_with": requiredWith, "required_with_all": requiredWithAll, "required_without": requiredWithout, "required_without_all": requiredWithoutAll, + "excluded_with": excludedWith, + "excluded_with_all": excludedWithAll, + "excluded_without": excludedWithout, + "excluded_without_all": excludedWithoutAll, "isdefault": isDefault, "len": hasLengthOf, "min": hasMinOf, @@ -120,6 +130,8 @@ var ( "excludesrune": excludesRune, "startswith": startsWith, "endswith": endsWith, + "startsnotwith": startsNotWith, + "endsnotwith": endsNotWith, "isbn": isISBN, "isbn10": isISBN10, "isbn13": isISBN13, @@ -172,6 +184,10 @@ var ( "lowercase": isLowercase, "uppercase": isUppercase, "datetime": isDatetime, + "timezone": isTimeZone, + "iso3166_1_alpha2": isIso3166Alpha2, + "iso3166_1_alpha3": isIso3166Alpha3, + "iso3166_1_alpha_numeric": isIso3166AlphaNumeric, } ) @@ -239,23 +255,33 @@ func isUnique(fl FieldLevel) bool { switch field.Kind() { case reflect.Slice, reflect.Array: + elem := field.Type().Elem() + if elem.Kind() == reflect.Ptr { + elem = elem.Elem() + } + if param == "" { - m := reflect.MakeMap(reflect.MapOf(field.Type().Elem(), v.Type())) + m := reflect.MakeMap(reflect.MapOf(elem, v.Type())) for i := 0; i < field.Len(); i++ { - m.SetMapIndex(field.Index(i), v) + m.SetMapIndex(reflect.Indirect(field.Index(i)), v) } return field.Len() == m.Len() } - sf, ok := field.Type().Elem().FieldByName(param) + sf, ok := elem.FieldByName(param) if !ok { panic(fmt.Sprintf("Bad field name %s", param)) } - m := reflect.MakeMap(reflect.MapOf(sf.Type, v.Type())) + sfTyp := sf.Type + if sfTyp.Kind() == reflect.Ptr { + sfTyp = sfTyp.Elem() + } + + m := reflect.MakeMap(reflect.MapOf(sfTyp, v.Type())) for i := 0; i < field.Len(); i++ { - m.SetMapIndex(field.Index(i).FieldByName(param), v) + m.SetMapIndex(reflect.Indirect(reflect.Indirect(field.Index(i)).FieldByName(param)), v) } return field.Len() == m.Len() case reflect.Map: @@ -513,7 +539,7 @@ func isISBN10(fl FieldLevel) bool { return checksum%11 == 0 } -// IsEthereumAddress is the validation function for validating if the field's value is a valid ethereum address based currently only on the format +// IsEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address. func isEthereumAddress(fl FieldLevel) bool { address := fl.Field().String() @@ -525,7 +551,21 @@ func isEthereumAddress(fl FieldLevel) bool { return true } - // checksum validation is blocked by https://github.com/golang/crypto/pull/28 + // Checksum validation. Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md + address = address[2:] // Skip "0x" prefix. + h := sha3.NewLegacyKeccak256() + // hash.Hash's io.Writer implementation says it never returns an error. https://golang.org/pkg/hash/#Hash + _, _ = h.Write([]byte(strings.ToLower(address))) + hash := hex.EncodeToString(h.Sum(nil)) + + for i := 0; i < len(address); i++ { + if address[i] <= '9' { // Skip 0-9 digits: they don't have upper/lower-case. + continue + } + if hash[i] > '7' && address[i] >= 'a' || hash[i] <= '7' && address[i] <= 'F' { + return false + } + } return true } @@ -690,6 +730,16 @@ func endsWith(fl FieldLevel) bool { return strings.HasSuffix(fl.Field().String(), fl.Param()) } +// StartsNotWith is the validation function for validating that the field's value does not start with the text specified within the param. +func startsNotWith(fl FieldLevel) bool { + return !startsWith(fl) +} + +// EndsNotWith is the validation function for validating that the field's value does not end with the text specified within the param. +func endsNotWith(fl FieldLevel) bool { + return !endsWith(fl) +} + // FieldContains is the validation function for validating if the current field's value contains the field specified by the param's value. func fieldContains(fl FieldLevel) bool { field := fl.Field() @@ -1117,7 +1167,7 @@ func isEq(fl FieldLevel) bool { return int64(field.Len()) == p case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - p := asInt(param) + p := asIntFromType(field.Type(), param) return field.Int() == p @@ -1371,6 +1421,75 @@ func requireCheckFieldKind(fl FieldLevel, param string, defaultNotFoundValue boo } } +// requireCheckFieldValue is a func for check field value +func requireCheckFieldValue(fl FieldLevel, param string, value string, defaultNotFoundValue bool) bool { + field, kind, _, found := fl.GetStructFieldOKAdvanced2(fl.Parent(), param) + if !found { + return defaultNotFoundValue + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() == asInt(value) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() == asUint(value) + + case reflect.Float32, reflect.Float64: + return field.Float() == asFloat(value) + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) == asInt(value) + } + + // default reflect.String: + return field.String() == value +} + +// requiredIf is the validation function +// The field under validation must be present and not empty only if all the other specified fields are equal to the value following with the specified field. +func requiredIf(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + if len(params)%2 != 0 { + panic(fmt.Sprintf("Bad param number for required_if %s", fl.FieldName())) + } + for i := 0; i < len(params); i += 2 { + if !requireCheckFieldValue(fl, params[i], params[i+1], false) { + return true + } + } + return hasValue(fl) +} + +// requiredUnless is the validation function +// The field under validation must be present and not empty only unless all the other specified fields are equal to the value following with the specified field. +func requiredUnless(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + if len(params)%2 != 0 { + panic(fmt.Sprintf("Bad param number for required_unless %s", fl.FieldName())) + } + + for i := 0; i < len(params); i += 2 { + if requireCheckFieldValue(fl, params[i], params[i+1], false) { + return true + } + } + return hasValue(fl) +} + +// ExcludedWith is the validation function +// The field under validation must not be present or is empty if any of the other specified fields are present. +func excludedWith(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if !requireCheckFieldKind(fl, param, true) { + return !hasValue(fl) + } + } + return true +} + // RequiredWith is the validation function // The field under validation must be present and not empty only if any of the other specified fields are present. func requiredWith(fl FieldLevel) bool { @@ -1383,6 +1502,18 @@ func requiredWith(fl FieldLevel) bool { return true } +// ExcludedWithAll is the validation function +// The field under validation must not be present or is empty if all of the other specified fields are present. +func excludedWithAll(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if requireCheckFieldKind(fl, param, true) { + return true + } + } + return !hasValue(fl) +} + // RequiredWithAll is the validation function // The field under validation must be present and not empty only if all of the other specified fields are present. func requiredWithAll(fl FieldLevel) bool { @@ -1395,6 +1526,15 @@ func requiredWithAll(fl FieldLevel) bool { return hasValue(fl) } +// ExcludedWithout is the validation function +// The field under validation must not be present or is empty when any of the other specified fields are not present. +func excludedWithout(fl FieldLevel) bool { + if requireCheckFieldKind(fl, strings.TrimSpace(fl.Param()), true) { + return !hasValue(fl) + } + return true +} + // RequiredWithout is the validation function // The field under validation must be present and not empty only when any of the other specified fields are not present. func requiredWithout(fl FieldLevel) bool { @@ -1404,6 +1544,18 @@ func requiredWithout(fl FieldLevel) bool { return true } +// RequiredWithoutAll is the validation function +// The field under validation must not be present or is empty when all of the other specified fields are not present. +func excludedWithoutAll(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if !requireCheckFieldKind(fl, param, true) { + return true + } + } + return !hasValue(fl) +} + // RequiredWithoutAll is the validation function // The field under validation must be present and not empty only when all of the other specified fields are not present. func requiredWithoutAll(fl FieldLevel) bool { @@ -1529,7 +1681,7 @@ func isGte(fl FieldLevel) bool { return int64(field.Len()) >= p case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - p := asInt(param) + p := asIntFromType(field.Type(), param) return field.Int() >= p @@ -1576,7 +1728,7 @@ func isGt(fl FieldLevel) bool { return int64(field.Len()) > p case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - p := asInt(param) + p := asIntFromType(field.Type(), param) return field.Int() > p @@ -1619,7 +1771,7 @@ func hasLengthOf(fl FieldLevel) bool { return int64(field.Len()) == p case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - p := asInt(param) + p := asIntFromType(field.Type(), param) return field.Int() == p @@ -1755,7 +1907,7 @@ func isLte(fl FieldLevel) bool { return int64(field.Len()) <= p case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - p := asInt(param) + p := asIntFromType(field.Type(), param) return field.Int() <= p @@ -1802,7 +1954,7 @@ func isLt(fl FieldLevel) bool { return int64(field.Len()) < p case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - p := asInt(param) + p := asIntFromType(field.Type(), param) return field.Int() < p @@ -1990,12 +2142,7 @@ func isFQDN(fl FieldLevel) bool { return false } - if val[len(val)-1] == '.' { - val = val[0 : len(val)-1] - } - - return strings.ContainsAny(val, ".") && - hostnameRegexRFC952.MatchString(val) + return fqdnRegexRFC1123.MatchString(val) } // IsDir is the validation function for validating if the current field's value is a valid directory. @@ -2080,6 +2227,29 @@ func isDatetime(fl FieldLevel) bool { if field.Kind() == reflect.String { _, err := time.Parse(param, field.String()) + + return err == nil + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isTimeZone is the validation function for validating if the current field's value is a valid time zone string. +func isTimeZone(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + // empty value is converted to UTC by time.LoadLocation but disallow it as it is not a valid time zone name + if field.String() == "" { + return false + } + + // Local value is converted to the current system time zone by time.LoadLocation but disallow it as it is not a valid time zone name + if strings.ToLower(field.String()) == "local" { + return false + } + + _, err := time.LoadLocation(field.String()) if err != nil { return false } @@ -2089,3 +2259,31 @@ func isDatetime(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } + +// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-2 country code. +func isIso3166Alpha2(fl FieldLevel) bool { + val := fl.Field().String() + return iso3166_1_alpha2[val] +} + +// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-3 country code. +func isIso3166Alpha3(fl FieldLevel) bool { + val := fl.Field().String() + return iso3166_1_alpha3[val] +} + +// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-numeric country code. +func isIso3166AlphaNumeric(fl FieldLevel) bool { + field := fl.Field() + + var code int + switch field.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + code = int(field.Int() % 1000) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + code = int(field.Uint() % 1000) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + return iso3166_1_alpha_numeric[code] +} diff --git a/vendor/github.com/go-playground/validator/v10/country_codes.go b/vendor/github.com/go-playground/validator/v10/country_codes.go new file mode 100644 index 0000000..ef81ead --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/country_codes.go @@ -0,0 +1,162 @@ +package validator + +var iso3166_1_alpha2 = map[string]bool{ + // see: https://www.iso.org/iso-3166-country-codes.html + "AF": true, "AX": true, "AL": true, "DZ": true, "AS": true, + "AD": true, "AO": true, "AI": true, "AQ": true, "AG": true, + "AR": true, "AM": true, "AW": true, "AU": true, "AT": true, + "AZ": true, "BS": true, "BH": true, "BD": true, "BB": true, + "BY": true, "BE": true, "BZ": true, "BJ": true, "BM": true, + "BT": true, "BO": true, "BQ": true, "BA": true, "BW": true, + "BV": true, "BR": true, "IO": true, "BN": true, "BG": true, + "BF": true, "BI": true, "KH": true, "CM": true, "CA": true, + "CV": true, "KY": true, "CF": true, "TD": true, "CL": true, + "CN": true, "CX": true, "CC": true, "CO": true, "KM": true, + "CG": true, "CD": true, "CK": true, "CR": true, "CI": true, + "HR": true, "CU": true, "CW": true, "CY": true, "CZ": true, + "DK": true, "DJ": true, "DM": true, "DO": true, "EC": true, + "EG": true, "SV": true, "GQ": true, "ER": true, "EE": true, + "ET": true, "FK": true, "FO": true, "FJ": true, "FI": true, + "FR": true, "GF": true, "PF": true, "TF": true, "GA": true, + "GM": true, "GE": true, "DE": true, "GH": true, "GI": true, + "GR": true, "GL": true, "GD": true, "GP": true, "GU": true, + "GT": true, "GG": true, "GN": true, "GW": true, "GY": true, + "HT": true, "HM": true, "VA": true, "HN": true, "HK": true, + "HU": true, "IS": true, "IN": true, "ID": true, "IR": true, + "IQ": true, "IE": true, "IM": true, "IL": true, "IT": true, + "JM": true, "JP": true, "JE": true, "JO": true, "KZ": true, + "KE": true, "KI": true, "KP": true, "KR": true, "KW": true, + "KG": true, "LA": true, "LV": true, "LB": true, "LS": true, + "LR": true, "LY": true, "LI": true, "LT": true, "LU": true, + "MO": true, "MK": true, "MG": true, "MW": true, "MY": true, + "MV": true, "ML": true, "MT": true, "MH": true, "MQ": true, + "MR": true, "MU": true, "YT": true, "MX": true, "FM": true, + "MD": true, "MC": true, "MN": true, "ME": true, "MS": true, + "MA": true, "MZ": true, "MM": true, "NA": true, "NR": true, + "NP": true, "NL": true, "NC": true, "NZ": true, "NI": true, + "NE": true, "NG": true, "NU": true, "NF": true, "MP": true, + "NO": true, "OM": true, "PK": true, "PW": true, "PS": true, + "PA": true, "PG": true, "PY": true, "PE": true, "PH": true, + "PN": true, "PL": true, "PT": true, "PR": true, "QA": true, + "RE": true, "RO": true, "RU": true, "RW": true, "BL": true, + "SH": true, "KN": true, "LC": true, "MF": true, "PM": true, + "VC": true, "WS": true, "SM": true, "ST": true, "SA": true, + "SN": true, "RS": true, "SC": true, "SL": true, "SG": true, + "SX": true, "SK": true, "SI": true, "SB": true, "SO": true, + "ZA": true, "GS": true, "SS": true, "ES": true, "LK": true, + "SD": true, "SR": true, "SJ": true, "SZ": true, "SE": true, + "CH": true, "SY": true, "TW": true, "TJ": true, "TZ": true, + "TH": true, "TL": true, "TG": true, "TK": true, "TO": true, + "TT": true, "TN": true, "TR": true, "TM": true, "TC": true, + "TV": true, "UG": true, "UA": true, "AE": true, "GB": true, + "US": true, "UM": true, "UY": true, "UZ": true, "VU": true, + "VE": true, "VN": true, "VG": true, "VI": true, "WF": true, + "EH": true, "YE": true, "ZM": true, "ZW": true, +} + +var iso3166_1_alpha3 = map[string]bool{ + // see: https://www.iso.org/iso-3166-country-codes.html + "AFG": true, "ALB": true, "DZA": true, "ASM": true, "AND": true, + "AGO": true, "AIA": true, "ATA": true, "ATG": true, "ARG": true, + "ARM": true, "ABW": true, "AUS": true, "AUT": true, "AZE": true, + "BHS": true, "BHR": true, "BGD": true, "BRB": true, "BLR": true, + "BEL": true, "BLZ": true, "BEN": true, "BMU": true, "BTN": true, + "BOL": true, "BES": true, "BIH": true, "BWA": true, "BVT": true, + "BRA": true, "IOT": true, "BRN": true, "BGR": true, "BFA": true, + "BDI": true, "CPV": true, "KHM": true, "CMR": true, "CAN": true, + "CYM": true, "CAF": true, "TCD": true, "CHL": true, "CHN": true, + "CXR": true, "CCK": true, "COL": true, "COM": true, "COD": true, + "COG": true, "COK": true, "CRI": true, "HRV": true, "CUB": true, + "CUW": true, "CYP": true, "CZE": true, "CIV": true, "DNK": true, + "DJI": true, "DMA": true, "DOM": true, "ECU": true, "EGY": true, + "SLV": true, "GNQ": true, "ERI": true, "EST": true, "SWZ": true, + "ETH": true, "FLK": true, "FRO": true, "FJI": true, "FIN": true, + "FRA": true, "GUF": true, "PYF": true, "ATF": true, "GAB": true, + "GMB": true, "GEO": true, "DEU": true, "GHA": true, "GIB": true, + "GRC": true, "GRL": true, "GRD": true, "GLP": true, "GUM": true, + "GTM": true, "GGY": true, "GIN": true, "GNB": true, "GUY": true, + "HTI": true, "HMD": true, "VAT": true, "HND": true, "HKG": true, + "HUN": true, "ISL": true, "IND": true, "IDN": true, "IRN": true, + "IRQ": true, "IRL": true, "IMN": true, "ISR": true, "ITA": true, + "JAM": true, "JPN": true, "JEY": true, "JOR": true, "KAZ": true, + "KEN": true, "KIR": true, "PRK": true, "KOR": true, "KWT": true, + "KGZ": true, "LAO": true, "LVA": true, "LBN": true, "LSO": true, + "LBR": true, "LBY": true, "LIE": true, "LTU": true, "LUX": true, + "MAC": true, "MDG": true, "MWI": true, "MYS": true, "MDV": true, + "MLI": true, "MLT": true, "MHL": true, "MTQ": true, "MRT": true, + "MUS": true, "MYT": true, "MEX": true, "FSM": true, "MDA": true, + "MCO": true, "MNG": true, "MNE": true, "MSR": true, "MAR": true, + "MOZ": true, "MMR": true, "NAM": true, "NRU": true, "NPL": true, + "NLD": true, "NCL": true, "NZL": true, "NIC": true, "NER": true, + "NGA": true, "NIU": true, "NFK": true, "MKD": true, "MNP": true, + "NOR": true, "OMN": true, "PAK": true, "PLW": true, "PSE": true, + "PAN": true, "PNG": true, "PRY": true, "PER": true, "PHL": true, + "PCN": true, "POL": true, "PRT": true, "PRI": true, "QAT": true, + "ROU": true, "RUS": true, "RWA": true, "REU": true, "BLM": true, + "SHN": true, "KNA": true, "LCA": true, "MAF": true, "SPM": true, + "VCT": true, "WSM": true, "SMR": true, "STP": true, "SAU": true, + "SEN": true, "SRB": true, "SYC": true, "SLE": true, "SGP": true, + "SXM": true, "SVK": true, "SVN": true, "SLB": true, "SOM": true, + "ZAF": true, "SGS": true, "SSD": true, "ESP": true, "LKA": true, + "SDN": true, "SUR": true, "SJM": true, "SWE": true, "CHE": true, + "SYR": true, "TWN": true, "TJK": true, "TZA": true, "THA": true, + "TLS": true, "TGO": true, "TKL": true, "TON": true, "TTO": true, + "TUN": true, "TUR": true, "TKM": true, "TCA": true, "TUV": true, + "UGA": true, "UKR": true, "ARE": true, "GBR": true, "UMI": true, + "USA": true, "URY": true, "UZB": true, "VUT": true, "VEN": true, + "VNM": true, "VGB": true, "VIR": true, "WLF": true, "ESH": true, + "YEM": true, "ZMB": true, "ZWE": true, "ALA": true, +} +var iso3166_1_alpha_numeric = map[int]bool{ + // see: https://www.iso.org/iso-3166-country-codes.html + 4: true, 8: true, 12: true, 16: true, 20: true, + 24: true, 660: true, 10: true, 28: true, 32: true, + 51: true, 533: true, 36: true, 40: true, 31: true, + 44: true, 48: true, 50: true, 52: true, 112: true, + 56: true, 84: true, 204: true, 60: true, 64: true, + 68: true, 535: true, 70: true, 72: true, 74: true, + 76: true, 86: true, 96: true, 100: true, 854: true, + 108: true, 132: true, 116: true, 120: true, 124: true, + 136: true, 140: true, 148: true, 152: true, 156: true, + 162: true, 166: true, 170: true, 174: true, 180: true, + 178: true, 184: true, 188: true, 191: true, 192: true, + 531: true, 196: true, 203: true, 384: true, 208: true, + 262: true, 212: true, 214: true, 218: true, 818: true, + 222: true, 226: true, 232: true, 233: true, 748: true, + 231: true, 238: true, 234: true, 242: true, 246: true, + 250: true, 254: true, 258: true, 260: true, 266: true, + 270: true, 268: true, 276: true, 288: true, 292: true, + 300: true, 304: true, 308: true, 312: true, 316: true, + 320: true, 831: true, 324: true, 624: true, 328: true, + 332: true, 334: true, 336: true, 340: true, 344: true, + 348: true, 352: true, 356: true, 360: true, 364: true, + 368: true, 372: true, 833: true, 376: true, 380: true, + 388: true, 392: true, 832: true, 400: true, 398: true, + 404: true, 296: true, 408: true, 410: true, 414: true, + 417: true, 418: true, 428: true, 422: true, 426: true, + 430: true, 434: true, 438: true, 440: true, 442: true, + 446: true, 450: true, 454: true, 458: true, 462: true, + 466: true, 470: true, 584: true, 474: true, 478: true, + 480: true, 175: true, 484: true, 583: true, 498: true, + 492: true, 496: true, 499: true, 500: true, 504: true, + 508: true, 104: true, 516: true, 520: true, 524: true, + 528: true, 540: true, 554: true, 558: true, 562: true, + 566: true, 570: true, 574: true, 807: true, 580: true, + 578: true, 512: true, 586: true, 585: true, 275: true, + 591: true, 598: true, 600: true, 604: true, 608: true, + 612: true, 616: true, 620: true, 630: true, 634: true, + 642: true, 643: true, 646: true, 638: true, 652: true, + 654: true, 659: true, 662: true, 663: true, 666: true, + 670: true, 882: true, 674: true, 678: true, 682: true, + 686: true, 688: true, 690: true, 694: true, 702: true, + 534: true, 703: true, 705: true, 90: true, 706: true, + 710: true, 239: true, 728: true, 724: true, 144: true, + 729: true, 740: true, 744: true, 752: true, 756: true, + 760: true, 158: true, 762: true, 834: true, 764: true, + 626: true, 768: true, 772: true, 776: true, 780: true, + 788: true, 792: true, 795: true, 796: true, 798: true, + 800: true, 804: true, 784: true, 826: true, 581: true, + 840: true, 858: true, 860: true, 548: true, 862: true, + 704: true, 92: true, 850: true, 876: true, 732: true, + 887: true, 894: true, 716: true, 248: true, +} diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go index 291c629..a816c20 100644 --- a/vendor/github.com/go-playground/validator/v10/doc.go +++ b/vendor/github.com/go-playground/validator/v10/doc.go @@ -245,6 +245,40 @@ ensures the value is not nil. Usage: required +Required If + +The field under validation must be present and not empty only if all +the other specified fields are equal to the value following the specified +field. For strings ensures value is not "". For slices, maps, pointers, +interfaces, channels and functions ensures the value is not nil. + + Usage: required_if + +Examples: + + // require the field if the Field1 is equal to the parameter given: + Usage: required_if=Field1 foobar + + // require the field if the Field1 and Field2 is equal to the value respectively: + Usage: required_if=Field1 foo Field2 bar + +Required Unless + +The field under validation must be present and not empty unless all +the other specified fields are equal to the value following the specified +field. For strings ensures value is not "". For slices, maps, pointers, +interfaces, channels and functions ensures the value is not nil. + + Usage: required_unless + +Examples: + + // require the field unless the Field1 is equal to the parameter given: + Usage: required_unless=Field1 foobar + + // require the field unless the Field1 and Field2 is equal to the value respectively: + Usage: required_unless=Field1 foo Field2 bar + Required With The field under validation must be present and not empty only if any @@ -321,8 +355,17 @@ equal to the parameter given. For strings, it checks that the string length is exactly that number of characters. For slices, arrays, and maps, validates the number of items. +Example #1 + Usage: len=10 +Example #2 (time.Duration) + +For time.Duration, len will ensure that the value is equal to the duration given +in the parameter. + + Usage: len=1h30m + Maximum For numbers, max will ensure that the value is @@ -330,8 +373,17 @@ less than or equal to the parameter given. For strings, it checks that the string length is at most that number of characters. For slices, arrays, and maps, validates the number of items. +Example #1 + Usage: max=10 +Example #2 (time.Duration) + +For time.Duration, max will ensure that the value is less than or equal to the +duration given in the parameter. + + Usage: max=1h30m + Minimum For numbers, min will ensure that the value is @@ -339,24 +391,51 @@ greater or equal to the parameter given. For strings, it checks that the string length is at least that number of characters. For slices, arrays, and maps, validates the number of items. +Example #1 + Usage: min=10 +Example #2 (time.Duration) + +For time.Duration, min will ensure that the value is greater than or equal to +the duration given in the parameter. + + Usage: min=1h30m + Equals For strings & numbers, eq will ensure that the value is equal to the parameter given. For slices, arrays, and maps, validates the number of items. +Example #1 + Usage: eq=10 +Example #2 (time.Duration) + +For time.Duration, eq will ensure that the value is equal to the duration given +in the parameter. + + Usage: eq=1h30m + Not Equal For strings & numbers, ne will ensure that the value is not equal to the parameter given. For slices, arrays, and maps, validates the number of items. +Example #1 + Usage: ne=10 +Example #2 (time.Duration) + +For time.Duration, ne will ensure that the value is not equal to the duration +given in the parameter. + + Usage: ne=1h30m + One Of For strings, ints, and uints, oneof will ensure that the value @@ -386,11 +465,17 @@ For time.Time ensures the time value is greater than time.Now.UTC(). Usage: gt +Example #3 (time.Duration) + +For time.Duration, gt will ensure that the value is greater than the duration +given in the parameter. + + Usage: gt=1h30m + Greater Than or Equal Same as 'min' above. Kept both to make terminology with 'len' easier. - Example #1 Usage: gte=10 @@ -401,6 +486,13 @@ For time.Time ensures the time value is greater than or equal to time.Now.UTC(). Usage: gte +Example #3 (time.Duration) + +For time.Duration, gte will ensure that the value is greater than or equal to +the duration given in the parameter. + + Usage: gte=1h30m + Less Than For numbers, this will ensure that the value is less than the parameter given. @@ -412,10 +504,18 @@ Example #1 Usage: lt=10 Example #2 (time.Time) + For time.Time ensures the time value is less than time.Now.UTC(). Usage: lt +Example #3 (time.Duration) + +For time.Duration, lt will ensure that the value is less than the duration given +in the parameter. + + Usage: lt=1h30m + Less Than or Equal Same as 'max' above. Kept both to make terminology with 'len' easier. @@ -430,6 +530,13 @@ For time.Time ensures the time value is less than or equal to time.Now.UTC(). Usage: lte +Example #3 (time.Duration) + +For time.Duration, lte will ensure that the value is less than or equal to the +duration given in the parameter. + + Usage: lte=1h30m + Field Equals Another Field This will validate the field value against another fields value either within @@ -476,9 +583,9 @@ relative to the top level struct. Field Greater Than Another Field -Only valid for Numbers and time.Time types, this will validate the field value -against another fields value either within a struct or passed in field. -usage examples are for validation of a Start and End date: +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: Example #1: @@ -490,7 +597,6 @@ Example #2: // Validating by field: validate.VarWithValue(start, end, "gtfield") - Field Greater Than Another Relative Field This does the same as gtfield except that it validates the field provided @@ -500,9 +606,9 @@ relative to the top level struct. Field Greater Than or Equal To Another Field -Only valid for Numbers and time.Time types, this will validate the field value -against another fields value either within a struct or passed in field. -usage examples are for validation of a Start and End date: +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: Example #1: @@ -523,9 +629,9 @@ to the top level struct. Less Than Another Field -Only valid for Numbers and time.Time types, this will validate the field value -against another fields value either within a struct or passed in field. -usage examples are for validation of a Start and End date: +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: Example #1: @@ -546,9 +652,9 @@ to the top level struct. Less Than or Equal To Another Field -Only valid for Numbers and time.Time types, this will validate the field value -against another fields value either within a struct or passed in field. -usage examples are for validation of a Start and End date: +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: Example #1: @@ -620,6 +726,13 @@ This validates that a string value contains unicode alphanumeric characters only Usage: alphanumunicode +Number + +This validates that a string value contains number values only. +For integers or float it returns true. + + Usage: number + Numeric This validates that a string value contains a basic numeric value. @@ -677,6 +790,13 @@ This validates that a string value contains a valid hsla color Usage: hsla +E.164 Phone Number String + +This validates that a string value contains a valid E.164 Phone number +https://en.wikipedia.org/wiki/E.164 (ex. +1123456789) + + Usage: e164 + E-mail String This validates that a string value contains a valid email @@ -759,8 +879,7 @@ Special thanks to Pieter Wuille for providng reference implementations. Ethereum Address This validates that a string value contains a valid ethereum address. -The format of the string is checked to ensure it matches the standard Ethereum address format -Full validation is blocked by https://github.com/golang/crypto/pull/28 +The format of the string is checked to ensure it matches the standard Ethereum address format. Usage: eth_addr @@ -814,6 +933,18 @@ This validates that a string value ends with the supplied string value Usage: endswith=goodbye +Does Not Start With + +This validates that a string value does not start with the supplied string value + + Usage: startsnotwith=hello + +Does Not End With + +This validates that a string value does not end with the supplied string value + + Usage: endsnotwith=goodbye + International Standard Book Number This validates that a string value contains a valid isbn10 or isbn13 value. @@ -1069,6 +1200,36 @@ Supplied format must match the official Go time format layout as documented in h Usage: datetime=2006-01-02 +Iso3166-1 alpha-2 + +This validates that a string value is a valid country code based on iso3166-1 alpha-2 standard. +see: https://www.iso.org/iso-3166-country-codes.html + + Usage: iso3166_1_alpha2 + +Iso3166-1 alpha-3 + +This validates that a string value is a valid country code based on iso3166-1 alpha-3 standard. +see: https://www.iso.org/iso-3166-country-codes.html + + Usage: iso3166_1_alpha3 + +Iso3166-1 alpha-numeric + +This validates that a string value is a valid country code based on iso3166-1 alpha-numeric standard. +see: https://www.iso.org/iso-3166-country-codes.html + + Usage: iso3166_1_alpha3 + +TimeZone + +This validates that a string value is a valid time zone based on the time zone database present on the system. +Although empty value and Local value are allowed by time.LoadLocation golang function, they are not allowed by this validator. +More information on https://golang.org/pkg/time/#LoadLocation + + Usage: timezone + + Alias Validators and Tags NOTE: When returning an error, the tag returned in "FieldError" will be @@ -1080,6 +1241,8 @@ Here is a list of the current built in alias tags: "iscolor" alias is "hexcolor|rgb|rgba|hsl|hsla" (Usage: iscolor) + "country_code" + alias is "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric" (Usage: country_code) Validator notes: diff --git a/vendor/github.com/go-playground/validator/v10/errors.go b/vendor/github.com/go-playground/validator/v10/errors.go index 46c24c9..63293cf 100644 --- a/vendor/github.com/go-playground/validator/v10/errors.go +++ b/vendor/github.com/go-playground/validator/v10/errors.go @@ -99,7 +99,7 @@ type FieldError interface { ActualTag() string // returns the namespace for the field error, with the tag - // name taking precedence over the fields actual name. + // name taking precedence over the field's actual name. // // eg. JSON name "User.fname" // @@ -109,29 +109,29 @@ type FieldError interface { // using validate.Field(...) as there is no way to extract it's name Namespace() string - // returns the namespace for the field error, with the fields + // returns the namespace for the field error, with the field's // actual name. // // eq. "User.FirstName" see Namespace for comparison // // NOTE: this field can be blank when validating a single primitive field - // using validate.Field(...) as there is no way to extract it's name + // using validate.Field(...) as there is no way to extract its name StructNamespace() string // returns the fields name with the tag name taking precedence over the - // fields actual name. + // field's actual name. // // eq. JSON name "fname" // see StructField for comparison Field() string - // returns the fields actual name from the struct, when able to determine. + // returns the field's actual name from the struct, when able to determine. // // eq. "FirstName" // see Field for comparison StructField() string - // returns the actual fields value in case needed for creating the error + // returns the actual field's value in case needed for creating the error // message Value() interface{} @@ -155,6 +155,9 @@ type FieldError interface { // NOTE: if no registered translator can be found it returns the same as // calling fe.Error() Translate(ut ut.Translator) string + + // Error returns the FieldError's message + Error() string } // compile time interface checks @@ -190,19 +193,19 @@ func (fe *fieldError) ActualTag() string { } // Namespace returns the namespace for the field error, with the tag -// name taking precedence over the fields actual name. +// name taking precedence over the field's actual name. func (fe *fieldError) Namespace() string { return fe.ns } -// StructNamespace returns the namespace for the field error, with the fields +// StructNamespace returns the namespace for the field error, with the field's // actual name. func (fe *fieldError) StructNamespace() string { return fe.structNs } -// Field returns the fields name with the tag name taking precedence over the -// fields actual name. +// Field returns the field's name with the tag name taking precedence over the +// field's actual name. func (fe *fieldError) Field() string { return fe.ns[len(fe.ns)-int(fe.fieldLen):] @@ -218,13 +221,13 @@ func (fe *fieldError) Field() string { // return fld } -// returns the fields actual name from the struct, when able to determine. +// returns the field's actual name from the struct, when able to determine. func (fe *fieldError) StructField() string { // return fe.structField return fe.structNs[len(fe.structNs)-int(fe.structfieldLen):] } -// Value returns the actual fields value in case needed for creating the error +// Value returns the actual field's value in case needed for creating the error // message func (fe *fieldError) Value() interface{} { return fe.value @@ -254,8 +257,8 @@ func (fe *fieldError) Error() string { // Translate returns the FieldError's translated error // from the provided 'ut.Translator' and registered 'TranslationFunc' // -// NOTE: is not registered translation can be found it returns the same -// as calling fe.Error() +// NOTE: if no registered translation can be found, it returns the original +// untranslated error message. func (fe *fieldError) Translate(ut ut.Translator) string { m, ok := fe.v.transTagFunc[ut] diff --git a/vendor/github.com/go-playground/validator/v10/go.mod b/vendor/github.com/go-playground/validator/v10/go.mod index 21316b3..d457100 100644 --- a/vendor/github.com/go-playground/validator/v10/go.mod +++ b/vendor/github.com/go-playground/validator/v10/go.mod @@ -7,4 +7,5 @@ require ( github.com/go-playground/locales v0.13.0 github.com/go-playground/universal-translator v0.17.0 github.com/leodido/go-urn v1.2.0 + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 ) diff --git a/vendor/github.com/go-playground/validator/v10/go.sum b/vendor/github.com/go-playground/validator/v10/go.sum index dc7dec4..0152642 100644 --- a/vendor/github.com/go-playground/validator/v10/go.sum +++ b/vendor/github.com/go-playground/validator/v10/go.sum @@ -13,6 +13,13 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/vendor/github.com/go-playground/validator/v10/regexes.go b/vendor/github.com/go-playground/validator/v10/regexes.go index b8bf253..b741f4e 100644 --- a/vendor/github.com/go-playground/validator/v10/regexes.go +++ b/vendor/github.com/go-playground/validator/v10/regexes.go @@ -9,7 +9,7 @@ const ( alphaUnicodeNumericRegexString = "^[\\p{L}\\p{N}]+$" numericRegexString = "^[-+]?[0-9]+(?:\\.[0-9]+)?$" numberRegexString = "^[0-9]+$" - hexadecimalRegexString = "^[0-9a-fA-F]+$" + hexadecimalRegexString = "^(0[xX])?[0-9a-fA-F]+$" hexcolorRegexString = "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$" rgbRegexString = "^rgb\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*\\)$" rgbaRegexString = "^rgba\\(\\s*(?:(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])|(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%\\s*,\\s*(?:0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])%)\\s*,\\s*(?:(?:0.[1-9]*)|[01])\\s*\\)$" @@ -36,11 +36,12 @@ const ( latitudeRegexString = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$" longitudeRegexString = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$" sSNRegexString = `^[0-9]{3}[ -]?(0[1-9]|[1-9][0-9])[ -]?([1-9][0-9]{3}|[0-9][1-9][0-9]{2}|[0-9]{2}[1-9][0-9]|[0-9]{3}[1-9])$` - hostnameRegexStringRFC952 = `^[a-zA-Z][a-zA-Z0-9\-\.]+[a-zA-Z0-9]$` // https://tools.ietf.org/html/rfc952 - hostnameRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123 - btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address - btcAddressUpperRegexStringBech32 = `^BC1[02-9AC-HJ-NP-Z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32 - btcAddressLowerRegexStringBech32 = `^bc1[02-9ac-hj-np-z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32 + hostnameRegexStringRFC952 = `^[a-zA-Z]([a-zA-Z0-9\-]+[\.]?)*[a-zA-Z0-9]$` // https://tools.ietf.org/html/rfc952 + hostnameRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?$` // accepts hostname starting with a digit https://tools.ietf.org/html/rfc1123 + fqdnRegexStringRFC1123 = `^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{0,62})(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*?(\.[a-zA-Z]{1}[a-zA-Z0-9]{0,62})\.?$` // same as hostnameRegexStringRFC1123 but must contain a non numerical TLD (possibly ending with '.') + btcAddressRegexString = `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` // bitcoin address + btcAddressUpperRegexStringBech32 = `^BC1[02-9AC-HJ-NP-Z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32 + btcAddressLowerRegexStringBech32 = `^bc1[02-9ac-hj-np-z]{7,76}$` // bitcoin bech32 address https://en.bitcoin.it/wiki/Bech32 ethAddressRegexString = `^0x[0-9a-fA-F]{40}$` ethAddressUpperRegexString = `^0x[0-9A-F]{40}$` ethAddressLowerRegexString = `^0x[0-9a-f]{40}$` @@ -86,6 +87,7 @@ var ( sSNRegex = regexp.MustCompile(sSNRegexString) hostnameRegexRFC952 = regexp.MustCompile(hostnameRegexStringRFC952) hostnameRegexRFC1123 = regexp.MustCompile(hostnameRegexStringRFC1123) + fqdnRegexRFC1123 = regexp.MustCompile(fqdnRegexStringRFC1123) btcAddressRegex = regexp.MustCompile(btcAddressRegexString) btcUpperAddressRegexBech32 = regexp.MustCompile(btcAddressUpperRegexStringBech32) btcLowerAddressRegexBech32 = regexp.MustCompile(btcAddressLowerRegexStringBech32) diff --git a/vendor/github.com/go-playground/validator/v10/util.go b/vendor/github.com/go-playground/validator/v10/util.go index 0d3a181..6e568f8 100644 --- a/vendor/github.com/go-playground/validator/v10/util.go +++ b/vendor/github.com/go-playground/validator/v10/util.go @@ -4,6 +4,7 @@ import ( "reflect" "strconv" "strings" + "time" ) // extractTypeInternal gets the actual underlying type of field value. @@ -229,6 +230,26 @@ func asInt(param string) int64 { return i } +// asIntFromTimeDuration parses param as time.Duration and returns it as int64 +// or panics on error. +func asIntFromTimeDuration(param string) int64 { + d, err := time.ParseDuration(param) + panicIf(err) + + return int64(d) +} + +// asIntFromType calls the proper function to parse param as int64, +// given a field's Type t. +func asIntFromType(t reflect.Type, param string) int64 { + switch t { + case timeDurationType: + return asIntFromTimeDuration(param) + default: + return asInt(param) + } +} + // asUint returns the parameter as a uint64 // or panics if it can't convert func asUint(param string) uint64 { diff --git a/vendor/github.com/go-playground/validator/v10/validator.go b/vendor/github.com/go-playground/validator/v10/validator.go index 342e72e..f097f39 100644 --- a/vendor/github.com/go-playground/validator/v10/validator.go +++ b/vendor/github.com/go-playground/validator/v10/validator.go @@ -249,7 +249,7 @@ OUTER: v.cf = cf v.ct = ct - if !v.fldIsPointer && !hasValue(v) { + if !hasValue(v) { return } diff --git a/vendor/github.com/go-playground/validator/v10/validator_instance.go b/vendor/github.com/go-playground/validator/v10/validator_instance.go index 4a89d40..fe6a487 100644 --- a/vendor/github.com/go-playground/validator/v10/validator_instance.go +++ b/vendor/github.com/go-playground/validator/v10/validator_instance.go @@ -27,6 +27,8 @@ const ( requiredWithoutTag = "required_without" requiredWithTag = "required_with" requiredWithAllTag = "required_with_all" + requiredIfTag = "required_if" + requiredUnlessTag = "required_unless" skipValidationTag = "-" diveTag = "dive" keysTag = "keys" @@ -41,7 +43,9 @@ const ( ) var ( - timeType = reflect.TypeOf(time.Time{}) + timeDurationType = reflect.TypeOf(time.Duration(0)) + timeType = reflect.TypeOf(time.Time{}) + defaultCField = &cField{namesEqual: true} ) @@ -107,7 +111,7 @@ func New() *Validate { switch k { // these require that even if the value is nil that the validation should run, omitempty still overrides this behaviour - case requiredWithTag, requiredWithAllTag, requiredWithoutTag, requiredWithoutAllTag: + case requiredIfTag, requiredUnlessTag, requiredWithTag, requiredWithAllTag, requiredWithoutTag, requiredWithoutAllTag: _ = v.registerValidation(k, wrapFunc(val), true, true) default: // no need to error check here, baked in will always be valid diff --git a/vendor/github.com/hashicorp/errwrap/errwrap.go b/vendor/github.com/hashicorp/errwrap/errwrap.go index a733bef..44e368e 100644 --- a/vendor/github.com/hashicorp/errwrap/errwrap.go +++ b/vendor/github.com/hashicorp/errwrap/errwrap.go @@ -44,6 +44,8 @@ func Wrap(outer, inner error) error { // // format is the format of the error message. The string '{{err}}' will // be replaced with the original error message. +// +// Deprecated: Use fmt.Errorf() func Wrapf(format string, err error) error { outerMsg := "" if err != nil { @@ -148,6 +150,9 @@ func Walk(err error, cb WalkFunc) { for _, err := range e.WrappedErrors() { Walk(err, cb) } + case interface{ Unwrap() error }: + cb(err) + Walk(e.Unwrap(), cb) default: cb(err) } @@ -167,3 +172,7 @@ func (w *wrappedError) Error() string { func (w *wrappedError) WrappedErrors() []error { return []error{w.Outer, w.Inner} } + +func (w *wrappedError) Unwrap() error { + return w.Inner +} diff --git a/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md index 50d56ff..52b111d 100644 --- a/vendor/github.com/json-iterator/go/README.md +++ b/vendor/github.com/json-iterator/go/README.md @@ -1,5 +1,5 @@ [![Sourcegraph](https://sourcegraph.com/github.com/json-iterator/go/-/badge.svg)](https://sourcegraph.com/github.com/json-iterator/go?badge) -[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/json-iterator/go) +[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/json-iterator/go) [![Build Status](https://travis-ci.org/json-iterator/go.svg?branch=master)](https://travis-ci.org/json-iterator/go) [![codecov](https://codecov.io/gh/json-iterator/go/branch/master/graph/badge.svg)](https://codecov.io/gh/json-iterator/go) [![rcard](https://goreportcard.com/badge/github.com/json-iterator/go)](https://goreportcard.com/report/github.com/json-iterator/go) @@ -18,16 +18,16 @@ Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/githu Raw Result (easyjson requires static code generation) -| | ns/op | allocation bytes | allocation times | -| --- | --- | --- | --- | -| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op | -| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op | -| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op | -| std encode | 2213 ns/op | 712 B/op | 5 allocs/op | -| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op | -| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op | +| | ns/op | allocation bytes | allocation times | +| --------------- | ----------- | ---------------- | ---------------- | +| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op | +| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op | +| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op | +| std encode | 2213 ns/op | 712 B/op | 5 allocs/op | +| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op | +| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op | -Always benchmark with your own workload. +Always benchmark with your own workload. The result depends heavily on the data input. # Usage @@ -41,10 +41,10 @@ import "encoding/json" json.Marshal(&data) ``` -with +with ```go -import "github.com/json-iterator/go" +import jsoniter "github.com/json-iterator/go" var json = jsoniter.ConfigCompatibleWithStandardLibrary json.Marshal(&data) @@ -60,7 +60,7 @@ json.Unmarshal(input, &data) with ```go -import "github.com/json-iterator/go" +import jsoniter "github.com/json-iterator/go" var json = jsoniter.ConfigCompatibleWithStandardLibrary json.Unmarshal(input, &data) @@ -78,10 +78,10 @@ go get github.com/json-iterator/go Contributors -* [thockin](https://github.com/thockin) -* [mattn](https://github.com/mattn) -* [cch123](https://github.com/cch123) -* [Oleg Shaldybin](https://github.com/olegshaldybin) -* [Jason Toffaletti](https://github.com/toffaletti) +- [thockin](https://github.com/thockin) +- [mattn](https://github.com/mattn) +- [cch123](https://github.com/cch123) +- [Oleg Shaldybin](https://github.com/olegshaldybin) +- [Jason Toffaletti](https://github.com/toffaletti) Report issue or pull request, or email taowen@gmail.com, or [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/json-iterator/Lobby) diff --git a/vendor/github.com/json-iterator/go/any_str.go b/vendor/github.com/json-iterator/go/any_str.go index a4b93c7..1f12f66 100644 --- a/vendor/github.com/json-iterator/go/any_str.go +++ b/vendor/github.com/json-iterator/go/any_str.go @@ -64,7 +64,6 @@ func (any *stringAny) ToInt64() int64 { flag := 1 startPos := 0 - endPos := 0 if any.val[0] == '+' || any.val[0] == '-' { startPos = 1 } @@ -73,6 +72,7 @@ func (any *stringAny) ToInt64() int64 { flag = -1 } + endPos := startPos for i := startPos; i < len(any.val); i++ { if any.val[i] >= '0' && any.val[i] <= '9' { endPos = i + 1 @@ -98,7 +98,6 @@ func (any *stringAny) ToUint64() uint64 { } startPos := 0 - endPos := 0 if any.val[0] == '-' { return 0 @@ -107,6 +106,7 @@ func (any *stringAny) ToUint64() uint64 { startPos = 1 } + endPos := startPos for i := startPos; i < len(any.val); i++ { if any.val[i] >= '0' && any.val[i] <= '9' { endPos = i + 1 diff --git a/vendor/github.com/json-iterator/go/config.go b/vendor/github.com/json-iterator/go/config.go index 8c58fcb..2adcdc3 100644 --- a/vendor/github.com/json-iterator/go/config.go +++ b/vendor/github.com/json-iterator/go/config.go @@ -183,11 +183,11 @@ func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { rawMessage := *(*json.RawMessage)(ptr) iter := cfg.BorrowIterator([]byte(rawMessage)) + defer cfg.ReturnIterator(iter) iter.Read() - if iter.Error != nil { + if iter.Error != nil && iter.Error != io.EOF { stream.WriteRaw("null") } else { - cfg.ReturnIterator(iter) stream.WriteRaw(string(rawMessage)) } }, func(ptr unsafe.Pointer) bool { diff --git a/vendor/github.com/json-iterator/go/iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go index b651371..58ee89c 100644 --- a/vendor/github.com/json-iterator/go/iter_object.go +++ b/vendor/github.com/json-iterator/go/iter_object.go @@ -150,7 +150,7 @@ func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { if c == '}' { return iter.decrementDepth() } - iter.ReportError("ReadObjectCB", `expect " after }, but found `+string([]byte{c})) + iter.ReportError("ReadObjectCB", `expect " after {, but found `+string([]byte{c})) iter.decrementDepth() return false } @@ -206,7 +206,7 @@ func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool { if c == '}' { return iter.decrementDepth() } - iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c})) + iter.ReportError("ReadMapCB", `expect " after {, but found `+string([]byte{c})) iter.decrementDepth() return false } diff --git a/vendor/github.com/json-iterator/go/reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go index 80320cd..74a97bf 100644 --- a/vendor/github.com/json-iterator/go/reflect_extension.go +++ b/vendor/github.com/json-iterator/go/reflect_extension.go @@ -475,7 +475,7 @@ func calcFieldNames(originalFieldName string, tagProvidedFieldName string, whole fieldNames = []string{tagProvidedFieldName} } // private? - isNotExported := unicode.IsLower(rune(originalFieldName[0])) + isNotExported := unicode.IsLower(rune(originalFieldName[0])) || originalFieldName[0] == '_' if isNotExported { fieldNames = []string{} } diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go index 9e2b623..5829671 100644 --- a/vendor/github.com/json-iterator/go/reflect_map.go +++ b/vendor/github.com/json-iterator/go/reflect_map.go @@ -49,6 +49,33 @@ func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { return decoder } } + + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(unmarshalerType) { + return &referenceDecoder{ + &unmarshalerDecoder{ + valType: ptrType, + }, + } + } + if typ.Implements(unmarshalerType) { + return &unmarshalerDecoder{ + valType: typ, + } + } + if ptrType.Implements(textUnmarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ + valType: ptrType, + }, + } + } + if typ.Implements(textUnmarshalerType) { + return &textUnmarshalerDecoder{ + valType: typ, + } + } + switch typ.Kind() { case reflect.String: return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) @@ -63,31 +90,6 @@ func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { typ = reflect2.DefaultTypeOfKind(typ.Kind()) return &numericMapKeyDecoder{decoderOfType(ctx, typ)} default: - ptrType := reflect2.PtrTo(typ) - if ptrType.Implements(unmarshalerType) { - return &referenceDecoder{ - &unmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(unmarshalerType) { - return &unmarshalerDecoder{ - valType: typ, - } - } - if ptrType.Implements(textUnmarshalerType) { - return &referenceDecoder{ - &textUnmarshalerDecoder{ - valType: ptrType, - }, - } - } - if typ.Implements(textUnmarshalerType) { - return &textUnmarshalerDecoder{ - valType: typ, - } - } return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} } } @@ -103,6 +105,19 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { return encoder } } + + if typ == textMarshalerType { + return &directTextMarshalerEncoder{ + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + if typ.Implements(textMarshalerType) { + return &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + switch typ.Kind() { case reflect.String: return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) @@ -117,17 +132,6 @@ func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { typ = reflect2.DefaultTypeOfKind(typ.Kind()) return &numericMapKeyEncoder{encoderOfType(ctx, typ)} default: - if typ == textMarshalerType { - return &directTextMarshalerEncoder{ - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } - if typ.Implements(textMarshalerType) { - return &textMarshalerEncoder{ - valType: typ, - stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), - } - } if typ.Kind() == reflect.Interface { return &dynamicMapKeyEncoder{ctx, typ} } @@ -163,10 +167,6 @@ func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { if c == '}' { return } - if c != '"' { - iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c})) - return - } iter.unreadByte() key := decoder.keyType.UnsafeNew() decoder.keyDecoder.Decode(key, iter) diff --git a/vendor/github.com/json-iterator/go/reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go index 43ec71d..fa71f47 100644 --- a/vendor/github.com/json-iterator/go/reflect_optional.go +++ b/vendor/github.com/json-iterator/go/reflect_optional.go @@ -2,7 +2,6 @@ package jsoniter import ( "github.com/modern-go/reflect2" - "reflect" "unsafe" ) @@ -10,9 +9,6 @@ func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { ptrType := typ.(*reflect2.UnsafePtrType) elemType := ptrType.Elem() decoder := decoderOfType(ctx, elemType) - if ctx.prefix == "" && elemType.Kind() == reflect.Ptr { - return &dereferenceDecoder{elemType, decoder} - } return &OptionalDecoder{elemType, decoder} } diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go index 5ad5cc5..d7eb0eb 100644 --- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go @@ -507,7 +507,7 @@ func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) for c = ','; c == ','; c = iter.nextToken() { decoder.decodeOneField(ptr, iter) } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } if c != '}' { @@ -588,7 +588,7 @@ func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -622,7 +622,7 @@ func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -660,7 +660,7 @@ func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -702,7 +702,7 @@ func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -748,7 +748,7 @@ func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -798,7 +798,7 @@ func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -852,7 +852,7 @@ func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -910,7 +910,7 @@ func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -972,7 +972,7 @@ func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() @@ -1038,7 +1038,7 @@ func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator break } } - if iter.Error != nil && iter.Error != io.EOF { + if iter.Error != nil && iter.Error != io.EOF && len(decoder.typ.Type1().Name()) != 0 { iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } iter.decrementDepth() diff --git a/vendor/github.com/json-iterator/go/stream.go b/vendor/github.com/json-iterator/go/stream.go index 17662fd..23d8a3a 100644 --- a/vendor/github.com/json-iterator/go/stream.go +++ b/vendor/github.com/json-iterator/go/stream.go @@ -103,14 +103,14 @@ func (stream *Stream) Flush() error { if stream.Error != nil { return stream.Error } - n, err := stream.out.Write(stream.buf) + _, err := stream.out.Write(stream.buf) if err != nil { if stream.Error == nil { stream.Error = err } return err } - stream.buf = stream.buf[n:] + stream.buf = stream.buf[:0] return nil } @@ -177,7 +177,6 @@ func (stream *Stream) WriteEmptyObject() { func (stream *Stream) WriteMore() { stream.writeByte(',') stream.writeIndention(0) - stream.Flush() } // WriteArrayStart write [ with possible indention diff --git a/vendor/github.com/lib/pq/.travis.yml b/vendor/github.com/lib/pq/.travis.yml index 8396f5d..3498c53 100644 --- a/vendor/github.com/lib/pq/.travis.yml +++ b/vendor/github.com/lib/pq/.travis.yml @@ -1,8 +1,8 @@ language: go go: - - 1.11.x - - 1.12.x + - 1.13.x + - 1.14.x - master sudo: true @@ -27,7 +27,7 @@ before_install: - ./.travis.sh client_configure - go get golang.org/x/tools/cmd/goimports - go get golang.org/x/lint/golint - - GO111MODULE=on go get honnef.co/go/tools/cmd/staticcheck@2019.2.1 + - GO111MODULE=on go get honnef.co/go/tools/cmd/staticcheck@2020.1.3 before_script: - createdb pqgotest @@ -38,7 +38,7 @@ script: - > goimports -d -e $(find -name '*.go') | awk '{ print } END { exit NR == 0 ? 0 : 1 }' - go vet ./... - - staticcheck -go 1.11 ./... + - staticcheck -go 1.13 ./... - golint ./... - PQTEST_BINARY_PARAMETERS=no go test -race -v ./... - PQTEST_BINARY_PARAMETERS=yes go test -race -v ./... diff --git a/vendor/github.com/lib/pq/CONTRIBUTING.md b/vendor/github.com/lib/pq/CONTRIBUTING.md deleted file mode 100644 index 84c937f..0000000 --- a/vendor/github.com/lib/pq/CONTRIBUTING.md +++ /dev/null @@ -1,29 +0,0 @@ -## Contributing to pq - -`pq` has a backlog of pull requests, but contributions are still very -much welcome. You can help with patch review, submitting bug reports, -or adding new functionality. There is no formal style guide, but -please conform to the style of existing code and general Go formatting -conventions when submitting patches. - -### Patch review - -Help review existing open pull requests by commenting on the code or -proposed functionality. - -### Bug reports - -We appreciate any bug reports, but especially ones with self-contained -(doesn't depend on code outside of pq), minimal (can't be simplified -further) test cases. It's especially helpful if you can submit a pull -request with just the failing test case (you'll probably want to -pattern it after the tests in -[conn_test.go](https://github.com/lib/pq/blob/master/conn_test.go). - -### New functionality - -There are a number of pending patches for new functionality, so -additional feature patches will take a while to merge. Still, patches -are generally reviewed based on usefulness and complexity in addition -to time-in-queue, so if you have a knockout idea, take a shot. Feel -free to open an issue discussion your proposed patch beforehand. diff --git a/vendor/github.com/lib/pq/README.md b/vendor/github.com/lib/pq/README.md index 385fe73..c972a86 100644 --- a/vendor/github.com/lib/pq/README.md +++ b/vendor/github.com/lib/pq/README.md @@ -1,21 +1,11 @@ # pq - A pure Go postgres driver for Go's database/sql package -[![GoDoc](https://godoc.org/github.com/lib/pq?status.svg)](https://godoc.org/github.com/lib/pq) -[![Build Status](https://travis-ci.org/lib/pq.svg?branch=master)](https://travis-ci.org/lib/pq) +[![GoDoc](https://godoc.org/github.com/lib/pq?status.svg)](https://pkg.go.dev/github.com/lib/pq?tab=doc) ## Install go get github.com/lib/pq -## Docs - -For detailed documentation and basic usage examples, please see the package -documentation at . - -## Tests - -`go test` is used for testing. See [TESTS.md](TESTS.md) for more details. - ## Features * SSL @@ -29,67 +19,12 @@ documentation at . * Unix socket support * Notifications: `LISTEN`/`NOTIFY` * pgpass support +* GSS (Kerberos) auth -## Future / Things you can help with +## Tests -* Better COPY FROM / COPY TO (see discussion in #181) +`go test` is used for testing. See [TESTS.md](TESTS.md) for more details. -## Thank you (alphabetical) +## Status -Some of these contributors are from the original library `bmizerany/pq.go` whose -code still exists in here. - -* Andy Balholm (andybalholm) -* Ben Berkert (benburkert) -* Benjamin Heatwole (bheatwole) -* Bill Mill (llimllib) -* Bjørn Madsen (aeons) -* Blake Gentry (bgentry) -* Brad Fitzpatrick (bradfitz) -* Charlie Melbye (cmelbye) -* Chris Bandy (cbandy) -* Chris Gilling (cgilling) -* Chris Walsh (cwds) -* Dan Sosedoff (sosedoff) -* Daniel Farina (fdr) -* Eric Chlebek (echlebek) -* Eric Garrido (minusnine) -* Eric Urban (hydrogen18) -* Everyone at The Go Team -* Evan Shaw (edsrzf) -* Ewan Chou (coocood) -* Fazal Majid (fazalmajid) -* Federico Romero (federomero) -* Fumin (fumin) -* Gary Burd (garyburd) -* Heroku (heroku) -* James Pozdena (jpoz) -* Jason McVetta (jmcvetta) -* Jeremy Jay (pbnjay) -* Joakim Sernbrant (serbaut) -* John Gallagher (jgallagher) -* Jonathan Rudenberg (titanous) -* Joël Stemmer (jstemmer) -* Kamil Kisiel (kisielk) -* Kelly Dunn (kellydunn) -* Keith Rarick (kr) -* Kir Shatrov (kirs) -* Lann Martin (lann) -* Maciek Sakrejda (uhoh-itsmaciek) -* Marc Brinkmann (mbr) -* Marko Tiikkaja (johto) -* Matt Newberry (MattNewberry) -* Matt Robenolt (mattrobenolt) -* Martin Olsen (martinolsen) -* Mike Lewis (mikelikespie) -* Nicolas Patry (Narsil) -* Oliver Tonnhofer (olt) -* Patrick Hayes (phayes) -* Paul Hammond (paulhammond) -* Ryan Smith (ryandotsmith) -* Samuel Stauffer (samuel) -* Timothée Peignier (cyberdelia) -* Travis Cline (tmc) -* TruongSinh Tran-Nguyen (truongsinh) -* Yaismel Miranda (ympons) -* notedit (notedit) +This package is effectively in maintenance mode and is not actively developed. Small patches and features are only rarely reviewed and merged. We recommend using [pgx](https://github.com/jackc/pgx) which is actively maintained. diff --git a/vendor/github.com/lib/pq/conn.go b/vendor/github.com/lib/pq/conn.go index 55152b1..f313c14 100644 --- a/vendor/github.com/lib/pq/conn.go +++ b/vendor/github.com/lib/pq/conn.go @@ -149,6 +149,15 @@ type conn struct { // If true this connection is in the middle of a COPY inCopy bool + + // If not nil, notices will be synchronously sent here + noticeHandler func(*Error) + + // If not nil, notifications will be synchronously sent here + notificationHandler func(*Notification) + + // GSSAPI context + gss GSS } // Handle driver-side settings in parsed connection string. @@ -329,10 +338,6 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) { func dial(ctx context.Context, d Dialer, o values) (net.Conn, error) { network, address := network(o) - // SSL is not necessary or supported over UNIX domain sockets - if network == "unix" { - o["sslmode"] = "disable" - } // Zero or not specified means wait indefinitely. if timeout, ok := o["connect_timeout"]; ok && timeout != "0" { @@ -971,7 +976,13 @@ func (cn *conn) recv() (t byte, r *readBuf) { case 'E': panic(parseError(r)) case 'N': - // ignore + if n := cn.noticeHandler; n != nil { + n(parseError(r)) + } + case 'A': + if n := cn.notificationHandler; n != nil { + n(recvNotification(r)) + } default: return } @@ -988,8 +999,14 @@ func (cn *conn) recv1Buf(r *readBuf) byte { } switch t { - case 'A', 'N': - // ignore + case 'A': + if n := cn.notificationHandler; n != nil { + n(recvNotification(r)) + } + case 'N': + if n := cn.noticeHandler; n != nil { + n(parseError(r)) + } case 'S': cn.processParameterStatus(r) default: @@ -1057,7 +1074,10 @@ func isDriverSetting(key string) bool { return true case "binary_parameters": return true - + case "krbsrvname": + return true + case "krbspn": + return true default: return false } @@ -1137,6 +1157,59 @@ func (cn *conn) auth(r *readBuf, o values) { if r.int32() != 0 { errorf("unexpected authentication response: %q", t) } + case 7: // GSSAPI, startup + if newGss == nil { + errorf("kerberos error: no GSSAPI provider registered (import github.com/lib/pq/auth/kerberos if you need Kerberos support)") + } + cli, err := newGss() + if err != nil { + errorf("kerberos error: %s", err.Error()) + } + + var token []byte + + if spn, ok := o["krbspn"]; ok { + // Use the supplied SPN if provided.. + token, err = cli.GetInitTokenFromSpn(spn) + } else { + // Allow the kerberos service name to be overridden + service := "postgres" + if val, ok := o["krbsrvname"]; ok { + service = val + } + + token, err = cli.GetInitToken(o["host"], service) + } + + if err != nil { + errorf("failed to get Kerberos ticket: %q", err) + } + + w := cn.writeBuf('p') + w.bytes(token) + cn.send(w) + + // Store for GSSAPI continue message + cn.gss = cli + + case 8: // GSSAPI continue + + if cn.gss == nil { + errorf("GSSAPI protocol error") + } + + b := []byte(*r) + + done, tokOut, err := cn.gss.Continue(b) + if err == nil && !done { + w := cn.writeBuf('p') + w.bytes(tokOut) + cn.send(w) + } + + // Errors fall through and read the more detailed message + // from the server.. + case 10: sc := scram.NewClient(sha256.New, o["user"], o["password"]) sc.Step(nil) diff --git a/vendor/github.com/lib/pq/connector.go b/vendor/github.com/lib/pq/connector.go index 2f8ced6..d7d4726 100644 --- a/vendor/github.com/lib/pq/connector.go +++ b/vendor/github.com/lib/pq/connector.go @@ -27,7 +27,7 @@ func (c *Connector) Connect(ctx context.Context) (driver.Conn, error) { return c.open(ctx) } -// Driver returnst the underlying driver of this Connector. +// Driver returns the underlying driver of this Connector. func (c *Connector) Driver() driver.Driver { return &Driver{} } @@ -106,5 +106,10 @@ func NewConnector(dsn string) (*Connector, error) { o["user"] = u } + // SSL is not necessary or supported over UNIX domain sockets + if network, _ := network(o); network == "unix" { + o["sslmode"] = "disable" + } + return &Connector{opts: o, dialer: defaultDialer{}}, nil } diff --git a/vendor/github.com/lib/pq/copy.go b/vendor/github.com/lib/pq/copy.go index 55378d5..38d5bb6 100644 --- a/vendor/github.com/lib/pq/copy.go +++ b/vendor/github.com/lib/pq/copy.go @@ -49,6 +49,7 @@ type copyin struct { buffer []byte rowData chan []byte done chan bool + driver.Result closed bool @@ -151,8 +152,12 @@ func (ci *copyin) resploop() { switch t { case 'C': // complete + res, _ := ci.cn.parseComplete(r.string()) + ci.setResult(res) case 'N': - // NoticeResponse + if n := ci.cn.noticeHandler; n != nil { + n(parseError(&r)) + } case 'Z': ci.cn.processReadyForQuery(&r) ci.done <- true @@ -199,6 +204,22 @@ func (ci *copyin) setError(err error) { ci.Unlock() } +func (ci *copyin) setResult(result driver.Result) { + ci.Lock() + ci.Result = result + ci.Unlock() +} + +func (ci *copyin) getResult() driver.Result { + ci.Lock() + result := ci.Result + if result == nil { + return driver.RowsAffected(0) + } + ci.Unlock() + return result +} + func (ci *copyin) NumInput() int { return -1 } @@ -229,7 +250,11 @@ func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) { } if len(v) == 0 { - return driver.RowsAffected(0), ci.Close() + if err := ci.Close(); err != nil { + return driver.RowsAffected(0), err + } + + return ci.getResult(), nil } numValues := len(v) diff --git a/vendor/github.com/lib/pq/doc.go b/vendor/github.com/lib/pq/doc.go index 2a60054..b571848 100644 --- a/vendor/github.com/lib/pq/doc.go +++ b/vendor/github.com/lib/pq/doc.go @@ -241,5 +241,28 @@ bytes by the PostgreSQL server. You can find a complete, working example of Listener usage at https://godoc.org/github.com/lib/pq/example/listen. + +Kerberos Support + + +If you need support for Kerberos authentication, add the following to your main +package: + + import "github.com/lib/pq/auth/kerberos" + + func init() { + pq.RegisterGSSProvider(func() (pq.Gss, error) { return kerberos.NewGSS() }) + } + +This package is in a separate module so that users who don't need Kerberos +don't have to download unnecessary dependencies. + +When imported, additional connection string parameters are supported: + + * krbsrvname - GSS (Kerberos) service name when constructing the + SPN (default is `postgres`). This will be combined with the host + to form the full SPN: `krbsrvname/host`. + * krbspn - GSS (Kerberos) SPN. This takes priority over + `krbsrvname` if present. */ package pq diff --git a/vendor/github.com/lib/pq/encode.go b/vendor/github.com/lib/pq/encode.go index 73cafb8..c4dafe2 100644 --- a/vendor/github.com/lib/pq/encode.go +++ b/vendor/github.com/lib/pq/encode.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "math" + "regexp" "strconv" "strings" "sync" @@ -16,6 +17,8 @@ import ( "github.com/lib/pq/oid" ) +var time2400Regex = regexp.MustCompile(`^(24:00(?::00(?:\.0+)?)?)(?:[Z+-].*)?$`) + func binaryEncode(parameterStatus *parameterStatus, x interface{}) []byte { switch v := x.(type) { case []byte: @@ -202,10 +205,27 @@ func mustParse(f string, typ oid.Oid, s []byte) time.Time { str[len(str)-3] == ':' { f += ":00" } + // Special case for 24:00 time. + // Unfortunately, golang does not parse 24:00 as a proper time. + // In this case, we want to try "round to the next day", to differentiate. + // As such, we find if the 24:00 time matches at the beginning; if so, + // we default it back to 00:00 but add a day later. + var is2400Time bool + switch typ { + case oid.T_timetz, oid.T_time: + if matches := time2400Regex.FindStringSubmatch(str); matches != nil { + // Concatenate timezone information at the back. + str = "00:00:00" + str[len(matches[1]):] + is2400Time = true + } + } t, err := time.Parse(f, str) if err != nil { errorf("decode: %s", err) } + if is2400Time { + t = t.Add(24 * time.Hour) + } return t } diff --git a/vendor/github.com/lib/pq/go.mod b/vendor/github.com/lib/pq/go.mod index edf0b34..b5a5639 100644 --- a/vendor/github.com/lib/pq/go.mod +++ b/vendor/github.com/lib/pq/go.mod @@ -1 +1,3 @@ module github.com/lib/pq + +go 1.13 diff --git a/vendor/github.com/lib/pq/krb.go b/vendor/github.com/lib/pq/krb.go new file mode 100644 index 0000000..408ec01 --- /dev/null +++ b/vendor/github.com/lib/pq/krb.go @@ -0,0 +1,27 @@ +package pq + +// NewGSSFunc creates a GSS authentication provider, for use with +// RegisterGSSProvider. +type NewGSSFunc func() (GSS, error) + +var newGss NewGSSFunc + +// RegisterGSSProvider registers a GSS authentication provider. For example, if +// you need to use Kerberos to authenticate with your server, add this to your +// main package: +// +// import "github.com/lib/pq/auth/kerberos" +// +// func init() { +// pq.RegisterGSSProvider(func() (pq.GSS, error) { return kerberos.NewGSS() }) +// } +func RegisterGSSProvider(newGssArg NewGSSFunc) { + newGss = newGssArg +} + +// GSS provides GSSAPI authentication (e.g., Kerberos). +type GSS interface { + GetInitToken(host string, service string) ([]byte, error) + GetInitTokenFromSpn(spn string) ([]byte, error) + Continue(inToken []byte) (done bool, outToken []byte, err error) +} diff --git a/vendor/github.com/lib/pq/notice.go b/vendor/github.com/lib/pq/notice.go new file mode 100644 index 0000000..01dd8c7 --- /dev/null +++ b/vendor/github.com/lib/pq/notice.go @@ -0,0 +1,71 @@ +// +build go1.10 + +package pq + +import ( + "context" + "database/sql/driver" +) + +// NoticeHandler returns the notice handler on the given connection, if any. A +// runtime panic occurs if c is not a pq connection. This is rarely used +// directly, use ConnectorNoticeHandler and ConnectorWithNoticeHandler instead. +func NoticeHandler(c driver.Conn) func(*Error) { + return c.(*conn).noticeHandler +} + +// SetNoticeHandler sets the given notice handler on the given connection. A +// runtime panic occurs if c is not a pq connection. A nil handler may be used +// to unset it. This is rarely used directly, use ConnectorNoticeHandler and +// ConnectorWithNoticeHandler instead. +// +// Note: Notice handlers are executed synchronously by pq meaning commands +// won't continue to be processed until the handler returns. +func SetNoticeHandler(c driver.Conn, handler func(*Error)) { + c.(*conn).noticeHandler = handler +} + +// NoticeHandlerConnector wraps a regular connector and sets a notice handler +// on it. +type NoticeHandlerConnector struct { + driver.Connector + noticeHandler func(*Error) +} + +// Connect calls the underlying connector's connect method and then sets the +// notice handler. +func (n *NoticeHandlerConnector) Connect(ctx context.Context) (driver.Conn, error) { + c, err := n.Connector.Connect(ctx) + if err == nil { + SetNoticeHandler(c, n.noticeHandler) + } + return c, err +} + +// ConnectorNoticeHandler returns the currently set notice handler, if any. If +// the given connector is not a result of ConnectorWithNoticeHandler, nil is +// returned. +func ConnectorNoticeHandler(c driver.Connector) func(*Error) { + if c, ok := c.(*NoticeHandlerConnector); ok { + return c.noticeHandler + } + return nil +} + +// ConnectorWithNoticeHandler creates or sets the given handler for the given +// connector. If the given connector is a result of calling this function +// previously, it is simply set on the given connector and returned. Otherwise, +// this returns a new connector wrapping the given one and setting the notice +// handler. A nil notice handler may be used to unset it. +// +// The returned connector is intended to be used with database/sql.OpenDB. +// +// Note: Notice handlers are executed synchronously by pq meaning commands +// won't continue to be processed until the handler returns. +func ConnectorWithNoticeHandler(c driver.Connector, handler func(*Error)) *NoticeHandlerConnector { + if c, ok := c.(*NoticeHandlerConnector); ok { + c.noticeHandler = handler + return c + } + return &NoticeHandlerConnector{Connector: c, noticeHandler: handler} +} diff --git a/vendor/github.com/lib/pq/notify.go b/vendor/github.com/lib/pq/notify.go index 850bb90..5c421fd 100644 --- a/vendor/github.com/lib/pq/notify.go +++ b/vendor/github.com/lib/pq/notify.go @@ -4,6 +4,8 @@ package pq // This module contains support for Postgres LISTEN/NOTIFY. import ( + "context" + "database/sql/driver" "errors" "fmt" "sync" @@ -29,6 +31,61 @@ func recvNotification(r *readBuf) *Notification { return &Notification{bePid, channel, extra} } +// SetNotificationHandler sets the given notification handler on the given +// connection. A runtime panic occurs if c is not a pq connection. A nil handler +// may be used to unset it. +// +// Note: Notification handlers are executed synchronously by pq meaning commands +// won't continue to be processed until the handler returns. +func SetNotificationHandler(c driver.Conn, handler func(*Notification)) { + c.(*conn).notificationHandler = handler +} + +// NotificationHandlerConnector wraps a regular connector and sets a notification handler +// on it. +type NotificationHandlerConnector struct { + driver.Connector + notificationHandler func(*Notification) +} + +// Connect calls the underlying connector's connect method and then sets the +// notification handler. +func (n *NotificationHandlerConnector) Connect(ctx context.Context) (driver.Conn, error) { + c, err := n.Connector.Connect(ctx) + if err == nil { + SetNotificationHandler(c, n.notificationHandler) + } + return c, err +} + +// ConnectorNotificationHandler returns the currently set notification handler, if any. If +// the given connector is not a result of ConnectorWithNotificationHandler, nil is +// returned. +func ConnectorNotificationHandler(c driver.Connector) func(*Notification) { + if c, ok := c.(*NotificationHandlerConnector); ok { + return c.notificationHandler + } + return nil +} + +// ConnectorWithNotificationHandler creates or sets the given handler for the given +// connector. If the given connector is a result of calling this function +// previously, it is simply set on the given connector and returned. Otherwise, +// this returns a new connector wrapping the given one and setting the notification +// handler. A nil notification handler may be used to unset it. +// +// The returned connector is intended to be used with database/sql.OpenDB. +// +// Note: Notification handlers are executed synchronously by pq meaning commands +// won't continue to be processed until the handler returns. +func ConnectorWithNotificationHandler(c driver.Connector, handler func(*Notification)) *NotificationHandlerConnector { + if c, ok := c.(*NotificationHandlerConnector); ok { + c.notificationHandler = handler + return c + } + return &NotificationHandlerConnector{Connector: c, notificationHandler: handler} +} + const ( connStateIdle int32 = iota connStateExpectResponse @@ -174,8 +231,12 @@ func (l *ListenerConn) listenerConnLoop() (err error) { } l.replyChan <- message{t, nil} - case 'N', 'S': + case 'S': // ignore + case 'N': + if n := l.cn.noticeHandler; n != nil { + n(parseError(r)) + } default: return fmt.Errorf("unexpected message %q from server in listenerConnLoop", t) } diff --git a/vendor/github.com/lib/pq/user_posix.go b/vendor/github.com/lib/pq/user_posix.go index bf98252..a510192 100644 --- a/vendor/github.com/lib/pq/user_posix.go +++ b/vendor/github.com/lib/pq/user_posix.go @@ -1,6 +1,6 @@ // Package pq is a pure Go Postgres driver for the database/sql package. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris rumprun +// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris rumprun package pq diff --git a/vendor/github.com/modern-go/concurrent/.gitignore b/vendor/github.com/modern-go/concurrent/.gitignore new file mode 100644 index 0000000..3f2bc47 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/.gitignore @@ -0,0 +1 @@ +/coverage.txt diff --git a/vendor/github.com/modern-go/concurrent/.travis.yml b/vendor/github.com/modern-go/concurrent/.travis.yml new file mode 100644 index 0000000..449e67c --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/.travis.yml @@ -0,0 +1,14 @@ +language: go + +go: + - 1.8.x + - 1.x + +before_install: + - go get -t -v ./... + +script: + - ./test.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/modern-go/concurrent/README.md b/vendor/github.com/modern-go/concurrent/README.md index 91d6adb..acab320 100644 --- a/vendor/github.com/modern-go/concurrent/README.md +++ b/vendor/github.com/modern-go/concurrent/README.md @@ -1,2 +1,49 @@ # concurrent -concurrency utilities + +[![Sourcegraph](https://sourcegraph.com/github.com/modern-go/concurrent/-/badge.svg)](https://sourcegraph.com/github.com/modern-go/concurrent?badge) +[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/modern-go/concurrent) +[![Build Status](https://travis-ci.org/modern-go/concurrent.svg?branch=master)](https://travis-ci.org/modern-go/concurrent) +[![codecov](https://codecov.io/gh/modern-go/concurrent/branch/master/graph/badge.svg)](https://codecov.io/gh/modern-go/concurrent) +[![rcard](https://goreportcard.com/badge/github.com/modern-go/concurrent)](https://goreportcard.com/report/github.com/modern-go/concurrent) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/modern-go/concurrent/master/LICENSE) + +* concurrent.Map: backport sync.Map for go below 1.9 +* concurrent.Executor: goroutine with explicit ownership and cancellable + +# concurrent.Map + +because sync.Map is only available in go 1.9, we can use concurrent.Map to make code portable + +```go +m := concurrent.NewMap() +m.Store("hello", "world") +elem, found := m.Load("hello") +// elem will be "world" +// found will be true +``` + +# concurrent.Executor + +```go +executor := concurrent.NewUnboundedExecutor() +executor.Go(func(ctx context.Context) { + everyMillisecond := time.NewTicker(time.Millisecond) + for { + select { + case <-ctx.Done(): + fmt.Println("goroutine exited") + return + case <-everyMillisecond.C: + // do something + } + } +}) +time.Sleep(time.Second) +executor.StopAndWaitForever() +fmt.Println("executor stopped") +``` + +attach goroutine to executor instance, so that we can + +* cancel it by stop the executor with Stop/StopAndWait/StopAndWaitForever +* handle panic by callback: the default behavior will no longer crash your application \ No newline at end of file diff --git a/vendor/github.com/modern-go/concurrent/executor.go b/vendor/github.com/modern-go/concurrent/executor.go index 56e5d22..623dba1 100644 --- a/vendor/github.com/modern-go/concurrent/executor.go +++ b/vendor/github.com/modern-go/concurrent/executor.go @@ -2,6 +2,13 @@ package concurrent import "context" +// Executor replace go keyword to start a new goroutine +// the goroutine should cancel itself if the context passed in has been cancelled +// the goroutine started by the executor, is owned by the executor +// we can cancel all executors owned by the executor just by stop the executor itself +// however Executor interface does not Stop method, the one starting and owning executor +// should use the concrete type of executor, instead of this interface. type Executor interface { + // Go starts a new goroutine controlled by the context Go(handler func(ctx context.Context)) -} \ No newline at end of file +} diff --git a/vendor/github.com/modern-go/concurrent/go_above_19.go b/vendor/github.com/modern-go/concurrent/go_above_19.go index a9f2593..aeabf8c 100644 --- a/vendor/github.com/modern-go/concurrent/go_above_19.go +++ b/vendor/github.com/modern-go/concurrent/go_above_19.go @@ -4,10 +4,12 @@ package concurrent import "sync" +// Map is a wrapper for sync.Map introduced in go1.9 type Map struct { sync.Map } +// NewMap creates a thread safe Map func NewMap() *Map { return &Map{} -} \ No newline at end of file +} diff --git a/vendor/github.com/modern-go/concurrent/go_below_19.go b/vendor/github.com/modern-go/concurrent/go_below_19.go index 3f79f4f..b9c8df7 100644 --- a/vendor/github.com/modern-go/concurrent/go_below_19.go +++ b/vendor/github.com/modern-go/concurrent/go_below_19.go @@ -4,17 +4,20 @@ package concurrent import "sync" +// Map implements a thread safe map for go version below 1.9 using mutex type Map struct { lock sync.RWMutex data map[interface{}]interface{} } +// NewMap creates a thread safe map func NewMap() *Map { return &Map{ data: make(map[interface{}]interface{}, 32), } } +// Load is same as sync.Map Load func (m *Map) Load(key interface{}) (elem interface{}, found bool) { m.lock.RLock() elem, found = m.data[key] @@ -22,9 +25,9 @@ func (m *Map) Load(key interface{}) (elem interface{}, found bool) { return } +// Load is same as sync.Map Store func (m *Map) Store(key interface{}, elem interface{}) { m.lock.Lock() m.data[key] = elem m.lock.Unlock() } - diff --git a/vendor/github.com/modern-go/concurrent/log.go b/vendor/github.com/modern-go/concurrent/log.go new file mode 100644 index 0000000..9756fcc --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/log.go @@ -0,0 +1,13 @@ +package concurrent + +import ( + "os" + "log" + "io/ioutil" +) + +// ErrorLogger is used to print out error, can be set to writer other than stderr +var ErrorLogger = log.New(os.Stderr, "", 0) + +// InfoLogger is used to print informational message, default to off +var InfoLogger = log.New(ioutil.Discard, "", 0) \ No newline at end of file diff --git a/vendor/github.com/modern-go/concurrent/test.sh b/vendor/github.com/modern-go/concurrent/test.sh new file mode 100644 index 0000000..d1e6b2e --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -coverprofile=profile.out -coverpkg=github.com/modern-go/concurrent $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done diff --git a/vendor/github.com/modern-go/concurrent/unbounded_executor.go b/vendor/github.com/modern-go/concurrent/unbounded_executor.go index 70a1cf0..05a77dc 100644 --- a/vendor/github.com/modern-go/concurrent/unbounded_executor.go +++ b/vendor/github.com/modern-go/concurrent/unbounded_executor.go @@ -4,33 +4,37 @@ import ( "context" "fmt" "runtime" + "runtime/debug" "sync" "time" - "runtime/debug" + "reflect" ) -var LogInfo = func(event string, properties ...interface{}) { +// HandlePanic logs goroutine panic by default +var HandlePanic = func(recovered interface{}, funcName string) { + ErrorLogger.Println(fmt.Sprintf("%s panic: %v", funcName, recovered)) + ErrorLogger.Println(string(debug.Stack())) } -var LogPanic = func(recovered interface{}, properties ...interface{}) interface{} { - fmt.Println(fmt.Sprintf("paniced: %v", recovered)) - debug.PrintStack() - return recovered -} - -const StopSignal = "STOP!" - +// UnboundedExecutor is a executor without limits on counts of alive goroutines +// it tracks the goroutine started by it, and can cancel them when shutdown type UnboundedExecutor struct { ctx context.Context cancel context.CancelFunc activeGoroutinesMutex *sync.Mutex activeGoroutines map[string]int + HandlePanic func(recovered interface{}, funcName string) } // GlobalUnboundedExecutor has the life cycle of the program itself // any goroutine want to be shutdown before main exit can be started from this executor +// GlobalUnboundedExecutor expects the main function to call stop +// it does not magically knows the main function exits var GlobalUnboundedExecutor = NewUnboundedExecutor() +// NewUnboundedExecutor creates a new UnboundedExecutor, +// UnboundedExecutor can not be created by &UnboundedExecutor{} +// HandlePanic can be set with a callback to override global HandlePanic func NewUnboundedExecutor() *UnboundedExecutor { ctx, cancel := context.WithCancel(context.TODO()) return &UnboundedExecutor{ @@ -41,8 +45,13 @@ func NewUnboundedExecutor() *UnboundedExecutor { } } +// Go starts a new goroutine and tracks its lifecycle. +// Panic will be recovered and logged automatically, except for StopSignal func (executor *UnboundedExecutor) Go(handler func(ctx context.Context)) { - _, file, line, _ := runtime.Caller(1) + pc := reflect.ValueOf(handler).Pointer() + f := runtime.FuncForPC(pc) + funcName := f.Name() + file, line := f.FileLine(pc) executor.activeGoroutinesMutex.Lock() defer executor.activeGoroutinesMutex.Unlock() startFrom := fmt.Sprintf("%s:%d", file, line) @@ -50,46 +59,57 @@ func (executor *UnboundedExecutor) Go(handler func(ctx context.Context)) { go func() { defer func() { recovered := recover() - if recovered != nil && recovered != StopSignal { - LogPanic(recovered) + // if you want to quit a goroutine without trigger HandlePanic + // use runtime.Goexit() to quit + if recovered != nil { + if executor.HandlePanic == nil { + HandlePanic(recovered, funcName) + } else { + executor.HandlePanic(recovered, funcName) + } } executor.activeGoroutinesMutex.Lock() - defer executor.activeGoroutinesMutex.Unlock() executor.activeGoroutines[startFrom] -= 1 + executor.activeGoroutinesMutex.Unlock() }() handler(executor.ctx) }() } +// Stop cancel all goroutines started by this executor without wait func (executor *UnboundedExecutor) Stop() { executor.cancel() } +// StopAndWaitForever cancel all goroutines started by this executor and +// wait until all goroutines exited func (executor *UnboundedExecutor) StopAndWaitForever() { executor.StopAndWait(context.Background()) } +// StopAndWait cancel all goroutines started by this executor and wait. +// Wait can be cancelled by the context passed in. func (executor *UnboundedExecutor) StopAndWait(ctx context.Context) { executor.cancel() for { - fiveSeconds := time.NewTimer(time.Millisecond * 100) + oneHundredMilliseconds := time.NewTimer(time.Millisecond * 100) select { - case <-fiveSeconds.C: + case <-oneHundredMilliseconds.C: + if executor.checkNoActiveGoroutines() { + return + } case <-ctx.Done(): return } - if executor.checkGoroutines() { - return - } } } -func (executor *UnboundedExecutor) checkGoroutines() bool { +func (executor *UnboundedExecutor) checkNoActiveGoroutines() bool { executor.activeGoroutinesMutex.Lock() defer executor.activeGoroutinesMutex.Unlock() for startFrom, count := range executor.activeGoroutines { if count > 0 { - LogInfo("event!unbounded_executor.still waiting goroutines to quit", + InfoLogger.Println("UnboundedExecutor is still waiting goroutines to quit", "startFrom", startFrom, "count", count) return false diff --git a/vendor/github.com/modern-go/reflect2/type_map.go b/vendor/github.com/modern-go/reflect2/type_map.go index 6d48911..3acfb55 100644 --- a/vendor/github.com/modern-go/reflect2/type_map.go +++ b/vendor/github.com/modern-go/reflect2/type_map.go @@ -4,6 +4,7 @@ import ( "reflect" "runtime" "strings" + "sync" "unsafe" ) @@ -15,10 +16,17 @@ func typelinks1() [][]unsafe.Pointer //go:linkname typelinks2 reflect.typelinks func typelinks2() (sections []unsafe.Pointer, offset [][]int32) -var types = map[string]reflect.Type{} -var packages = map[string]map[string]reflect.Type{} +// initOnce guards initialization of types and packages +var initOnce sync.Once + +var types map[string]reflect.Type +var packages map[string]map[string]reflect.Type + +// discoverTypes initializes types and packages +func discoverTypes() { + types = make(map[string]reflect.Type) + packages = make(map[string]map[string]reflect.Type) -func init() { ver := runtime.Version() if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") { loadGo15Types() @@ -90,11 +98,13 @@ type emptyInterface struct { // TypeByName return the type by its name, just like Class.forName in java func TypeByName(typeName string) Type { + initOnce.Do(discoverTypes) return Type2(types[typeName]) } // TypeByPackageName return the type by its package and name func TypeByPackageName(pkgPath string, name string) Type { + initOnce.Do(discoverTypes) pkgTypes := packages[pkgPath] if pkgTypes == nil { return nil diff --git a/vendor/github.com/ugorji/go/codec/LICENSE b/vendor/github.com/ugorji/go/codec/LICENSE index 95a0f05..36a8bcf 100644 --- a/vendor/github.com/ugorji/go/codec/LICENSE +++ b/vendor/github.com/ugorji/go/codec/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2012-2015 Ugorji Nwoke. +Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/vendor/github.com/ugorji/go/codec/README.md b/vendor/github.com/ugorji/go/codec/README.md new file mode 100644 index 0000000..ece1b55 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/README.md @@ -0,0 +1,281 @@ +# Package Documentation for github.com/ugorji/go/codec + +Package codec provides a High Performance, Feature-Rich Idiomatic Go 1.4+ +codec/encoding library for binc, msgpack, cbor, json. + +Supported Serialization formats are: + + - msgpack: https://github.com/msgpack/msgpack + - binc: http://github.com/ugorji/binc + - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049 + - json: http://json.org http://tools.ietf.org/html/rfc7159 + - simple: + +This package will carefully use 'package unsafe' for performance reasons in +specific places. You can build without unsafe use by passing the safe or +appengine tag i.e. 'go install -tags=safe ...'. + +For detailed usage information, read the primer at +http://ugorji.net/blog/go-codec-primer . + +The idiomatic Go support is as seen in other encoding packages in the +standard library (ie json, xml, gob, etc). + +Rich Feature Set includes: + + - Simple but extremely powerful and feature-rich API + - Support for go 1.4 and above, while selectively using newer APIs for later releases + - Excellent code coverage ( > 90% ) + - Very High Performance. + Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X. + - Careful selected use of 'unsafe' for targeted performance gains. + - 100% safe mode supported, where 'unsafe' is not used at all. + - Lock-free (sans mutex) concurrency for scaling to 100's of cores + - In-place updates during decode, with option to zero value in maps and slices prior to decode + - Coerce types where appropriate + e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc + - Corner Cases: + Overflows, nil maps/slices, nil values in streams are handled correctly + - Standard field renaming via tags + - Support for omitting empty fields during an encoding + - Encoding from any value and decoding into pointer to any value + (struct, slice, map, primitives, pointers, interface{}, etc) + - Extensions to support efficient encoding/decoding of any named types + - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces + - Support IsZero() bool to determine if a value is a zero value. + Analogous to time.Time.IsZero() bool. + - Decoding without a schema (into a interface{}). + Includes Options to configure what specific map or slice type to use + when decoding an encoded list or map into a nil interface{} + - Mapping a non-interface type to an interface, so we can decode appropriately + into any interface type with a correctly configured non-interface value. + - Encode a struct as an array, and decode struct from an array in the data stream + - Option to encode struct keys as numbers (instead of strings) + (to support structured streams with fields encoded as numeric codes) + - Comprehensive support for anonymous fields + - Fast (no-reflection) encoding/decoding of common maps and slices + - Code-generation for faster performance, supported in go 1.6+ + - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats + - Support indefinite-length formats to enable true streaming + (for formats which support it e.g. json, cbor) + - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes. + This mostly applies to maps, where iteration order is non-deterministic. + - NIL in data stream decoded as zero value + - Never silently skip data when decoding. + User decides whether to return an error or silently skip data when keys or indexes + in the data stream do not map to fields in the struct. + - Detect and error when encoding a cyclic reference (instead of stack overflow shutdown) + - Encode/Decode from/to chan types (for iterative streaming support) + - Drop-in replacement for encoding/json. `json:` key in struct tag supported. + - Provides a RPC Server and Client Codec for net/rpc communication protocol. + - Handle unique idiosyncrasies of codecs e.g. + - For messagepack, configure how ambiguities in handling raw bytes are resolved + - For messagepack, provide rpc server/client codec to support + msgpack-rpc protocol defined at: + https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md + + +## Extension Support + +Users can register a function to handle the encoding or decoding of their +custom types. + +There are no restrictions on what the custom type can be. Some examples: + +```go + type BisSet []int + type BitSet64 uint64 + type UUID string + type MyStructWithUnexportedFields struct { a int; b bool; c []int; } + type GifImage struct { ... } +``` + +As an illustration, MyStructWithUnexportedFields would normally be encoded +as an empty map because it has no exported fields, while UUID would be +encoded as a string. However, with extension support, you can encode any of +these however you like. + +There is also seamless support provided for registering an extension (with a +tag) but letting the encoding mechanism default to the standard way. + + +## Custom Encoding and Decoding + +This package maintains symmetry in the encoding and decoding halfs. We +determine how to encode or decode by walking this decision tree + + - is there an extension registered for the type? + - is type a codec.Selfer? + - is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler? + - is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler? + - is format text-based, and type an encoding.TextMarshaler and TextUnmarshaler? + - else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc + +This symmetry is important to reduce chances of issues happening because the +encoding and decoding sides are out of sync e.g. decoded via very specific +encoding.TextUnmarshaler but encoded via kind-specific generalized mode. + +Consequently, if a type only defines one-half of the symmetry (e.g. it +implements UnmarshalJSON() but not MarshalJSON() ), then that type doesn't +satisfy the check and we will continue walking down the decision tree. + + +## RPC + +RPC Client and Server Codecs are implemented, so the codecs can be used with +the standard net/rpc package. + + +## Usage + +The Handle is SAFE for concurrent READ, but NOT SAFE for concurrent +modification. + +The Encoder and Decoder are NOT safe for concurrent use. + +Consequently, the usage model is basically: + + - Create and initialize the Handle before any use. + Once created, DO NOT modify it. + - Multiple Encoders or Decoders can now use the Handle concurrently. + They only read information off the Handle (never write). + - However, each Encoder or Decoder MUST not be used concurrently + - To re-use an Encoder/Decoder, call Reset(...) on it first. + This allows you use state maintained on the Encoder/Decoder. + +Sample usage model: + +```go + // create and configure Handle + var ( + bh codec.BincHandle + mh codec.MsgpackHandle + ch codec.CborHandle + ) + + mh.MapType = reflect.TypeOf(map[string]interface{}(nil)) + + // configure extensions + // e.g. for msgpack, define functions and enable Time support for tag 1 + // mh.SetExt(reflect.TypeOf(time.Time{}), 1, myExt) + + // create and use decoder/encoder + var ( + r io.Reader + w io.Writer + b []byte + h = &bh // or mh to use msgpack + ) + + dec = codec.NewDecoder(r, h) + dec = codec.NewDecoderBytes(b, h) + err = dec.Decode(&v) + + enc = codec.NewEncoder(w, h) + enc = codec.NewEncoderBytes(&b, h) + err = enc.Encode(v) + + //RPC Server + go func() { + for { + conn, err := listener.Accept() + rpcCodec := codec.GoRpc.ServerCodec(conn, h) + //OR rpcCodec := codec.MsgpackSpecRpc.ServerCodec(conn, h) + rpc.ServeCodec(rpcCodec) + } + }() + + //RPC Communication (client side) + conn, err = net.Dial("tcp", "localhost:5555") + rpcCodec := codec.GoRpc.ClientCodec(conn, h) + //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h) + client := rpc.NewClientWithCodec(rpcCodec) +``` + + +## Running Tests + +To run tests, use the following: + +``` + go test +``` + +To run the full suite of tests, use the following: + +``` + go test -tags alltests -run Suite +``` + +You can run the tag 'safe' to run tests or build in safe mode. e.g. + +``` + go test -tags safe -run Json + go test -tags "alltests safe" -run Suite +``` + +## Running Benchmarks + +``` + cd bench + go test -bench . -benchmem -benchtime 1s +``` + +Please see http://github.com/ugorji/go-codec-bench . + + +## Caveats + +Struct fields matching the following are ignored during encoding and +decoding + + - struct tag value set to - + - func, complex numbers, unsafe pointers + - unexported and not embedded + - unexported and embedded and not struct kind + - unexported and embedded pointers (from go1.10) + +Every other field in a struct will be encoded/decoded. + +Embedded fields are encoded as if they exist in the top-level struct, with +some caveats. See Encode documentation. + +## Exported Package API + +```go +const CborStreamBytes byte = 0x5f ... +const GenVersion = 17 +var SelfExt = &extFailWrapper{} +var GoRpc goRpc +var MsgpackSpecRpc msgpackSpecRpc +func GenHelperDecoder(d *Decoder) (gd genHelperDecoder, dd genHelperDecDriver) +func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee genHelperEncDriver) +type BasicHandle struct{ ... } +type BincHandle struct{ ... } +type BytesExt interface{ ... } +type CborHandle struct{ ... } +type DecodeOptions struct{ ... } +type Decoder struct{ ... } + func NewDecoder(r io.Reader, h Handle) *Decoder + func NewDecoderBytes(in []byte, h Handle) *Decoder +type EncodeOptions struct{ ... } +type Encoder struct{ ... } + func NewEncoder(w io.Writer, h Handle) *Encoder + func NewEncoderBytes(out *[]byte, h Handle) *Encoder +type Ext interface{ ... } +type Handle interface{ ... } +type InterfaceExt interface{ ... } +type JsonHandle struct{ ... } +type MapBySlice interface{ ... } +type MissingFielder interface{ ... } +type MsgpackHandle struct{ ... } +type MsgpackSpecRpcMultiArgs []interface{} +type RPCOptions struct{ ... } +type Raw []byte +type RawExt struct{ ... } +type Rpc interface{ ... } +type Selfer interface{ ... } +type SimpleHandle struct{ ... } +type TypeInfos struct{ ... } + func NewTypeInfos(tags []string) *TypeInfos +``` diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go index 802b32c..5ac514a 100644 --- a/vendor/github.com/ugorji/go/codec/binc.go +++ b/vendor/github.com/ugorji/go/codec/binc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -8,7 +8,7 @@ import ( "time" ) -const bincDoPrune = true // No longer needed. Needed before as C lib did not support pruning. +const bincDoPrune = true // vd as low 4 bits (there are 16 slots) const ( @@ -24,10 +24,10 @@ const ( bincVdTimestamp bincVdSmallInt - bincVdUnicodeOther + _ // bincVdUnicodeOther bincVdSymbol - bincVdDecimal + _ // bincVdDecimal _ // open slot _ // open slot bincVdCustomExt = 0x0f @@ -46,7 +46,7 @@ const ( ) const ( - bincFlBin16 byte = iota + _ byte = iota // bincFlBin16 byte = iota bincFlBin32 _ // bincFlBin32e bincFlBin64 @@ -54,48 +54,43 @@ const ( // others not currently supported ) -func bincdesc(vd, vs byte) string { - switch vd { - case bincVdSpecial: - switch vs { - case bincSpNil: - return "nil" - case bincSpFalse: - return "false" - case bincSpTrue: - return "true" - case bincSpNan, bincSpPosInf, bincSpNegInf, bincSpZeroFloat: - return "float" - case bincSpZero: - return "uint" - case bincSpNegOne: - return "int" - default: - return "unknown" - } - case bincVdSmallInt, bincVdPosInt: - return "uint" - case bincVdNegInt: - return "int" - case bincVdFloat: - return "float" - case bincVdSymbol: - return "string" - case bincVdString: - return "string" - case bincVdByteArray: - return "bytes" - case bincVdTimestamp: - return "time" - case bincVdCustomExt: - return "ext" - case bincVdArray: - return "array" - case bincVdMap: - return "map" - default: - return "unknown" +var ( + bincdescSpecialVsNames = map[byte]string{ + bincSpNil: "nil", + bincSpFalse: "false", + bincSpTrue: "true", + bincSpNan: "float", + bincSpPosInf: "float", + bincSpNegInf: "float", + bincSpZeroFloat: "float", + bincSpZero: "uint", + bincSpNegOne: "int", } + bincdescVdNames = map[byte]string{ + bincVdSpecial: "special", + bincVdSmallInt: "uint", + bincVdPosInt: "uint", + bincVdFloat: "float", + bincVdSymbol: "string", + bincVdString: "string", + bincVdByteArray: "bytes", + bincVdTimestamp: "time", + bincVdCustomExt: "ext", + bincVdArray: "array", + bincVdMap: "map", + } +) + +func bincdesc(vd, vs byte) (s string) { + if vd == bincVdSpecial { + s = bincdescSpecialVsNames[vs] + } else { + s = bincdescVdNames[vd] + } + if s == "" { + s = "unknown" + } + return } type bincEncDriver struct { @@ -135,18 +130,30 @@ func (e *bincEncDriver) EncodeBool(b bool) { } } -func (e *bincEncDriver) EncodeFloat32(f float32) { +func (e *bincEncDriver) encSpFloat(f float64) (done bool) { if f == 0 { e.e.encWr.writen1(bincVdSpecial<<4 | bincSpZeroFloat) + } else if math.IsNaN(float64(f)) { + e.e.encWr.writen1(bincVdSpecial<<4 | bincSpNan) + } else if math.IsInf(float64(f), +1) { + e.e.encWr.writen1(bincVdSpecial<<4 | bincSpPosInf) + } else if math.IsInf(float64(f), -1) { + e.e.encWr.writen1(bincVdSpecial<<4 | bincSpNegInf) + } else { return } - e.e.encWr.writen1(bincVdFloat<<4 | bincFlBin32) - bigenHelper{e.b[:4], e.e.w()}.writeUint32(math.Float32bits(f)) + return true +} + +func (e *bincEncDriver) EncodeFloat32(f float32) { + if !e.encSpFloat(float64(f)) { + e.e.encWr.writen1(bincVdFloat<<4 | bincFlBin32) + bigenHelper{e.b[:4], e.e.w()}.writeUint32(math.Float32bits(f)) + } } func (e *bincEncDriver) EncodeFloat64(f float64) { - if f == 0 { - e.e.encWr.writen1(bincVdSpecial<<4 | bincSpZeroFloat) + if e.encSpFloat(f) { return } bigen.PutUint64(e.b[:8], math.Float64bits(f)) @@ -172,14 +179,12 @@ func (e *bincEncDriver) encIntegerPrune(bd byte, pos bool, v uint64, lim uint8) } else { bigen.PutUint64(e.b[:lim], v) } + var i byte if bincDoPrune { - i := pruneSignExt(e.b[:lim], pos) - e.e.encWr.writen1(bd | lim - 1 - byte(i)) - e.e.encWr.writeb(e.b[i:lim]) - } else { - e.e.encWr.writen1(bd | lim - 1) - e.e.encWr.writeb(e.b[:lim]) + i = byte(pruneSignExt(e.b[:lim], pos)) } + e.e.encWr.writen1(bd | lim - 1 - i) + e.e.encWr.writeb(e.b[i:lim]) } func (e *bincEncDriver) EncodeInt(v int64) { @@ -349,7 +354,7 @@ func (e *bincEncDriver) EncodeStringBytesRaw(v []byte) { } func (e *bincEncDriver) encBytesLen(c charEncoding, length uint64) { - // NOTE: we currently only support UTF-8 (string) and RAW (bytearray). + // MARKER: we currently only support UTF-8 (string) and RAW (bytearray). // We should consider supporting bincUnicodeOther. if c == cRAW { @@ -394,7 +399,7 @@ type bincDecDriver struct { vd byte vs byte - fnil bool + _ bool // _ [3]byte // padding // linear searching on this slice is ok, // because we typically expect < 32 symbols in each stream. @@ -417,30 +422,17 @@ func (d *bincDecDriver) readNextBd() { d.bdRead = true } -func (d *bincDecDriver) uncacheRead() { - if d.bdRead { - d.d.decRd.unreadn1() - d.bdRead = false - } -} - func (d *bincDecDriver) advanceNil() (null bool) { - d.fnil = false if !d.bdRead { d.readNextBd() } if d.bd == bincVdSpecial<<4|bincSpNil { d.bdRead = false - d.fnil = true null = true } return } -func (d *bincDecDriver) Nil() bool { - return d.fnil -} - func (d *bincDecDriver) TryNil() bool { return d.advanceNil() } @@ -449,11 +441,9 @@ func (d *bincDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } - d.fnil = false // if d.vd == bincVdSpecial && d.vs == bincSpNil { if d.bd == bincVdSpecial<<4|bincSpNil { d.bdRead = false - d.fnil = true return valueTypeNil } else if d.vd == bincVdByteArray { return valueTypeBytes @@ -473,24 +463,20 @@ func (d *bincDecDriver) DecodeTime() (t time.Time) { } if d.vd != bincVdTimestamp { d.d.errorf("cannot decode time - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return } t, err := bincDecodeTime(d.d.decRd.readx(uint(d.vs))) - if err != nil { - panic(err) - } + halt.onerror(err) d.bdRead = false return } -func (d *bincDecDriver) decFloatPre(vs, defaultLen byte) { - if vs&0x8 == 0 { - d.d.decRd.readb(d.b[0:defaultLen]) +func (d *bincDecDriver) decFloatPre(xlen byte) { + if d.vs&0x8 == 0 { + d.d.decRd.readb(d.b[0:xlen]) } else { l := d.d.decRd.readn1() if l > 8 { d.d.errorf("cannot read float - at most 8 bytes used to represent float - received %v bytes", l) - return } for i := l; i < 8; i++ { d.b[i] = 0 @@ -502,47 +488,51 @@ func (d *bincDecDriver) decFloatPre(vs, defaultLen byte) { func (d *bincDecDriver) decFloat() (f float64) { //if true { f = math.Float64frombits(bigen.Uint64(d.d.decRd.readx(8))); break; } if x := d.vs & 0x7; x == bincFlBin32 { - d.decFloatPre(d.vs, 4) + d.decFloatPre(4) f = float64(math.Float32frombits(bigen.Uint32(d.b[0:4]))) } else if x == bincFlBin64 { - d.decFloatPre(d.vs, 8) + d.decFloatPre(8) f = math.Float64frombits(bigen.Uint64(d.b[0:8])) } else { - d.d.errorf("read float - only float32 and float64 are supported - %s %x-%x/%s", - msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return + d.d.errorf("read float supports only float32/64 - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) } return } func (d *bincDecDriver) decUint() (v uint64) { - // need to inline the code (interface conversion and type assertion expensive) + _, v = d.uintBytes() + return +} + +func (d *bincDecDriver) uintBytes() (bs []byte, v uint64) { switch d.vs { case 0: - v = uint64(d.d.decRd.readn1()) + d.b[0] = d.d.decRd.readn1() + v = uint64(d.b[0]) + bs = d.b[:1] case 1: - d.d.decRd.readb(d.b[6:8]) - v = uint64(bigen.Uint16(d.b[6:8])) + bs = d.b[6:8] + d.d.decRd.readb(bs) + v = uint64(bigen.Uint16(bs)) case 2: + bs = d.b[5:8] + d.d.decRd.readb(bs) d.b[4] = 0 - d.d.decRd.readb(d.b[5:8]) v = uint64(bigen.Uint32(d.b[4:8])) case 3: - d.d.decRd.readb(d.b[4:8]) - v = uint64(bigen.Uint32(d.b[4:8])) - case 4, 5, 6: + bs = d.b[4:8] + d.d.decRd.readb(bs) + v = uint64(bigen.Uint32(bs)) + case 4, 5, 6, 7: lim := 7 - d.vs - d.d.decRd.readb(d.b[lim:8]) + bs = d.b[lim:8] + d.d.decRd.readb(bs) for i := uint8(0); i < lim; i++ { d.b[i] = 0 } v = uint64(bigen.Uint64(d.b[:8])) - case 7: - d.d.decRd.readb(d.b[:8]) - v = uint64(bigen.Uint64(d.b[:8])) default: - d.d.errorf("unsigned integers with greater than 64 bits of precision not supported") - return + d.d.errorf("unsigned integers with greater than 64 bits of precision not supported: d.vs: %v %x", d.vs, d.vs) } return } @@ -563,13 +553,10 @@ func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) { neg = true ui = 1 } else { - d.d.errorf("integer decode fails - invalid special value from descriptor %x-%x/%s", - d.vd, d.vs, bincdesc(d.vd, d.vs)) - return + d.d.errorf("integer decode has invalid special value %x-%x/%s", d.vd, d.vs, bincdesc(d.vd, d.vs)) } } else { d.d.errorf("integer can only be decoded from int/uint. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd) - return } return } @@ -594,7 +581,6 @@ func (d *bincDecDriver) DecodeUint64() (ui uint64) { ui, neg := d.decCheckInteger() if neg { d.d.errorf("assigning negative signed value to unsigned integer type") - return } d.bdRead = false return @@ -616,9 +602,7 @@ func (d *bincDecDriver) DecodeFloat64() (f float64) { } else if vs == bincSpNegInf { return math.Inf(-1) } else { - d.d.errorf("float - invalid special value from descriptor %x-%x/%s", - d.vd, d.vs, bincdesc(d.vd, d.vs)) - return + d.d.errorf("float - invalid special value %x-%x/%s", d.vd, d.vs, bincdesc(d.vd, d.vs)) } } else if vd == bincVdFloat { f = d.decFloat() @@ -640,7 +624,6 @@ func (d *bincDecDriver) DecodeBool() (b bool) { b = true } else { d.d.errorf("bool - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return } d.bdRead = false return @@ -648,11 +631,10 @@ func (d *bincDecDriver) DecodeBool() (b bool) { func (d *bincDecDriver) ReadMapStart() (length int) { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } if d.vd != bincVdMap { d.d.errorf("map - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return } length = d.decLen() d.bdRead = false @@ -661,11 +643,10 @@ func (d *bincDecDriver) ReadMapStart() (length int) { func (d *bincDecDriver) ReadArrayStart() (length int) { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } if d.vd != bincVdArray { d.d.errorf("array - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return } length = d.decLen() d.bdRead = false @@ -706,7 +687,7 @@ func (d *bincDecDriver) decStringBytes(bs []byte, zerocopy bool) (bs2 []byte) { slen = d.decLen() if zerocopy { if d.d.bytes { - bs2 = d.d.decRd.readx(uint(slen)) + bs2 = d.d.decRd.rb.readx(uint(slen)) } else if len(bs) == 0 { bs2 = decByteSlice(d.d.r(), slen, d.d.h.MaxInitLen, d.d.b[:]) } else { @@ -757,7 +738,6 @@ func (d *bincDecDriver) decStringBytes(bs []byte, zerocopy bool) (bs2 []byte) { } default: d.d.errorf("string/bytes - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return } d.bdRead = false return @@ -789,15 +769,13 @@ func (d *bincDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { clen = d.decLen() } else { d.d.errorf("bytes - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return } d.bdRead = false - if zerocopy { - if d.d.bytes { - return d.d.decRd.readx(uint(clen)) - } else if len(bs) == 0 { - bs = d.d.b[:] - } + if d.d.bytes && (zerocopy || d.h.ZeroCopy) { + return d.d.decRd.rb.readx(uint(clen)) + } + if zerocopy && len(bs) == 0 { + bs = d.d.b[:] } return decByteSlice(d.d.r(), clen, d.d.h.MaxInitLen, bs) } @@ -805,7 +783,6 @@ func (d *bincDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { func (d *bincDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { if xtag > 0xff { d.d.errorf("ext: tag must be <= 0xff; got: %v", xtag) - return } if d.advanceNil() { return @@ -829,19 +806,16 @@ func (d *bincDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []b xtag = d.d.decRd.readn1() if verifyTag && xtag != tag { d.d.errorf("wrong extension tag - got %b, expecting: %v", xtag, tag) - return } if d.d.bytes { - xbs = d.d.decRd.readx(uint(l)) + xbs = d.d.decRd.rb.readx(uint(l)) } else { xbs = decByteSlice(d.d.r(), l, d.d.h.MaxInitLen, d.d.b[:]) } } else if d.vd == bincVdByteArray { xbs = d.DecodeBytes(nil, true) } else { - d.d.errorf("ext - expecting extensions or byte array - %s %x-%x/%s", - msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) - return + d.d.errorf("ext expects extensions or byte array - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) } d.bdRead = false return @@ -852,7 +826,6 @@ func (d *bincDecDriver) DecodeNaked() { d.readNextBd() } - d.fnil = false n := d.d.naked() var decodeFurther bool @@ -861,7 +834,6 @@ func (d *bincDecDriver) DecodeNaked() { switch d.vs { case bincSpNil: n.v = valueTypeNil - d.fnil = true case bincSpFalse: n.v = valueTypeBool n.b = false @@ -887,8 +859,7 @@ func (d *bincDecDriver) DecodeNaked() { n.v = valueTypeInt n.i = int64(-1) // int8(-1) default: - d.d.errorf("cannot infer value - unrecognized special value from descriptor %x-%x/%s", - d.vd, d.vs, bincdesc(d.vd, d.vs)) + d.d.errorf("cannot infer value - unrecognized special value %x-%x/%s", d.vd, d.vs, bincdesc(d.vd, d.vs)) } case bincVdSmallInt: n.v = valueTypeUint @@ -902,27 +873,25 @@ func (d *bincDecDriver) DecodeNaked() { case bincVdFloat: n.v = valueTypeFloat n.f = d.decFloat() - case bincVdSymbol: - n.v = valueTypeSymbol - n.s = string(d.DecodeStringAsBytes()) case bincVdString: n.v = valueTypeString n.s = string(d.DecodeStringAsBytes()) case bincVdByteArray: - decNakedReadRawBytes(d, &d.d, n, d.h.RawToString) + fauxUnionReadRawBytes(d, &d.d, n, d.h.RawToString) + case bincVdSymbol: + n.v = valueTypeSymbol + n.s = string(d.DecodeStringAsBytes()) case bincVdTimestamp: n.v = valueTypeTime tt, err := bincDecodeTime(d.d.decRd.readx(uint(d.vs))) - if err != nil { - panic(err) - } + halt.onerror(err) n.t = tt case bincVdCustomExt: n.v = valueTypeExt l := d.decLen() n.u = uint64(d.d.decRd.readn1()) if d.d.bytes { - n.l = d.d.decRd.readx(uint(l)) + n.l = d.d.decRd.rb.readx(uint(l)) } else { n.l = decByteSlice(d.d.r(), l, d.d.h.MaxInitLen, d.d.b[:]) } @@ -945,6 +914,121 @@ func (d *bincDecDriver) DecodeNaked() { } } +func (d *bincDecDriver) nextValueBytes(start []byte) (v []byte) { + if !d.bdRead { + d.readNextBd() + } + v = append(start, d.bd) + v = d.nextValueBytesBdReadR(v) + d.bdRead = false + return +} + +func (d *bincDecDriver) nextValueBytesR(v0 []byte) (v []byte) { + d.readNextBd() + v = append(v0, d.bd) + return d.nextValueBytesBdReadR(v) +} + +func (d *bincDecDriver) nextValueBytesBdReadR(v0 []byte) (v []byte) { + v = v0 + fnLen := func(vs byte) uint { + var bs []byte + switch vs { + case 0: + x := d.d.decRd.readn1() + v = append(v, x) + return uint(x) + case 1: + bs = d.b[6:8] + d.d.decRd.readb(bs) + v = append(v, bs...) + return uint(bigen.Uint16(bs)) + case 2: + bs = d.b[4:8] + d.d.decRd.readb(bs) + v = append(v, bs...) + return uint(bigen.Uint32(bs)) + case 3: + bs = d.b[:8] + d.d.decRd.readb(bs) + v = append(v, bs...) + return uint(bigen.Uint64(bs)) + default: + return uint(vs - 4) + } + } + + var clen uint + + switch d.vd { + case bincVdSpecial: + switch d.vs { + case bincSpNil, bincSpFalse, bincSpTrue, bincSpNan, bincSpPosInf: // pass + case bincSpNegInf, bincSpZeroFloat, bincSpZero, bincSpNegOne: // pass + default: + d.d.errorf("cannot infer value - unrecognized special value %x-%x/%s", d.vd, d.vs, bincdesc(d.vd, d.vs)) + } + case bincVdSmallInt: // pass + case bincVdPosInt, bincVdNegInt: + bs, _ := d.uintBytes() + v = append(v, bs...) + case bincVdFloat: + fn := func(xlen byte) { + if d.vs&0x8 != 0 { + xlen = d.d.decRd.readn1() + v = append(v, xlen) + if xlen > 8 { + d.d.errorf("cannot read float - at most 8 bytes used to represent float - received %v bytes", xlen) + } + } + d.d.decRd.readb(d.b[:xlen]) + v = append(v, d.b[:xlen]...) + } + switch d.vs & 0x7 { + case bincFlBin32: + fn(4) + case bincFlBin64: + fn(8) + default: + d.d.errorf("read float supports only float32/64 - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) + } + case bincVdString, bincVdByteArray: + clen = fnLen(d.vs) + v = append(v, d.d.decRd.readx(clen)...) + case bincVdSymbol: + if d.vs&0x8 == 0 { + v = append(v, d.d.decRd.readn1()) + } else { + v = append(v, d.d.decRd.rb.readx(2)...) + } + if d.vs&0x4 != 0 { + clen = fnLen(d.vs & 0x3) + v = append(v, d.d.decRd.readx(clen)...) + } + case bincVdTimestamp: + v = append(v, d.d.decRd.readx(uint(d.vs))...) + case bincVdCustomExt: + clen = fnLen(d.vs) + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(clen)...) + case bincVdArray: + clen = fnLen(d.vs) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + } + case bincVdMap: + clen = fnLen(d.vs) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + v = d.nextValueBytesR(v) + } + default: + d.d.errorf("cannot infer value - %s %x-%x/%s", msgBadDesc, d.vd, d.vs, bincdesc(d.vd, d.vs)) + } + return +} + //------------------------------------ //BincHandle is a Handle for the Binc Schema-Free Encoding Format @@ -990,6 +1074,8 @@ type BincHandle struct { // Name returns the name of the handle: binc func (h *BincHandle) Name() string { return "binc" } +func (h *BincHandle) desc(bd byte) string { return bincdesc(bd>>4, bd&0x0f) } + func (h *BincHandle) newEncDriver() encDriver { var e = &bincEncDriver{h: h} e.e.e = e @@ -1022,7 +1108,6 @@ func (e *bincEncDriver) atEndOfEncode() { func (d *bincDecDriver) reset() { d.s = nil d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0 - d.fnil = false } func (d *bincDecDriver) atEndOfDecode() { @@ -1193,27 +1278,5 @@ func bincDecodeTime(bs []byte) (tt time.Time, err error) { return } -// func timeLocUTCName(tzint int16) string { -// if tzint == 0 { -// return "UTC" -// } -// var tzname = []byte("UTC+00:00") -// //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf.. inline below. -// //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first -// var tzhr, tzmin int16 -// if tzint < 0 { -// tzname[3] = '-' -// tzhr, tzmin = -tzint/60, (-tzint)%60 -// } else { -// tzhr, tzmin = tzint/60, tzint%60 -// } -// tzname[4] = timeDigits[tzhr/10] -// tzname[5] = timeDigits[tzhr%10] -// tzname[7] = timeDigits[tzmin/10] -// tzname[8] = timeDigits[tzmin%10] -// return string(tzname) -// //return time.FixedZone(string(tzname), int(tzint)*60) -// } - var _ decDriver = (*bincDecDriver)(nil) var _ encDriver = (*bincEncDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/build.sh b/vendor/github.com/ugorji/go/codec/build.sh index a71227f..f5d7168 100644 --- a/vendor/github.com/ugorji/go/codec/build.sh +++ b/vendor/github.com/ugorji/go/codec/build.sh @@ -6,23 +6,32 @@ _tests() { local vet="" # TODO: make it off local gover=$( go version | cut -f 3 -d ' ' ) + case $gover in + go1.[7-9]*|go1.1[0-9]*|go2.*|devel*) true ;; + *) return 1 + esac # note that codecgen requires fastpath, so you cannot do "codecgen notfastpath" - local a=( "" "safe" "notfastpath" "notfastpath safe" "codecgen" "codecgen safe" ) + # we test the following permutations: fastpath/unsafe, !fastpath/!unsafe, codecgen/unsafe + ## local a=( "" "safe" "notfastpath safe" "codecgen" ) + echo "TestCodecSuite: (fastpath/unsafe), (!fastpath/!unsafe), (codecgen/unsafe)" + local a=( "" "notfastpath safe" "codecgen" ) + local b=() for i in "${a[@]}" do - echo ">>>> TAGS: $i" local i2=${i:-default} - case $gover in - go1.[0-6]*) go test ${zargs[*]} -tags "$i" "$@" ;; - *) go vet -printfuncs "errorf" "$@" && - go test ${zargs[*]} -vet "$vet" -tags "alltests $i" -run "Suite" -coverprofile "${i2// /-}.cov.out" "$@" ;; - esac - if [[ "$?" != 0 ]]; then return 1; fi + [[ "$zwait" == "1" ]] && echo ">>>> TAGS: '$i'" + true && + go vet -printfuncs "errorf" "$@" && + go test ${zargs[*]} ${ztestargs[*]} -vet "$vet" -tags "alltests $i" \ + -run "TestCodecSuite" -coverprofile "${i2// /-}.cov.out" "$@" & + b+=("${i2// /-}.cov.out") + [[ "$zwait" == "1" ]] && wait + # if [[ "$?" != 0 ]]; then return 1; fi done - echo "++++++++ TEST SUITES ALL PASSED ++++++++" + wait + [[ "$zcover" == "1" ]] && command -v gocovmerge && gocovmerge "${b[@]}" > __merge.cov.out && go tool cover -html=__merge.cov.out } - # is a generation needed? _ng() { local a="$1" @@ -59,7 +68,7 @@ _build() { cat > gen.generated.go < gen-from-tmpl.codec.generated.go < gen-from-tmpl.generated.go < " + fnameOut + " ______") -fin, err := os.Open(fnameIn) -if err != nil { panic(err) } -defer fin.Close() -fout, err := os.Create(fnameOut) -if err != nil { panic(err) } -defer fout.Close() -err = codec.GenInternalGoFile(fin, fout) -if err != nil { panic(err) } -} func main() { -run("fast-path.go.tmpl", "fast-path.generated.go") -run("gen-helper.go.tmpl", "gen-helper.generated.go") -run("mammoth-test.go.tmpl", "mammoth_generated_test.go") -run("mammoth2-test.go.tmpl", "mammoth2_generated_test.go") -// run("sort-slice.go.tmpl", "sort-slice.generated.go") +codec.GenRunTmpl2Go("fast-path.go.tmpl", "fast-path.generated.go") +codec.GenRunTmpl2Go("gen-helper.go.tmpl", "gen-helper.generated.go") +codec.GenRunTmpl2Go("mammoth-test.go.tmpl", "mammoth_generated_test.go") +codec.GenRunTmpl2Go("mammoth2-test.go.tmpl", "mammoth2_generated_test.go") +codec.GenRunSortTmpl2Go("sort-slice.go.tmpl", "sort-slice.generated.go") } EOF @@ -124,7 +118,6 @@ EOF shared_test.go > bench/shared_test.go # explicitly return 0 if this passes, else return 1 - go run -tags "prebuild" prebuild.go || return 1 go run -tags "notfastpath safe codecgen.exec" gen-from-tmpl.generated.go || return 1 rm -f gen-from-tmpl.*generated.go return 0 @@ -225,8 +218,8 @@ EOF _usage() { cat < [tests, make, prebuild (force) (external), inlining diagnostics, mid-stack inlining, race detector] - -v -> verbose + -[tosw m pf n l d] -> [t=tests (o=cover, s=short, w=wait), m=make, p=prebuild (f=force), n=inlining diagnostics, l=mid-stack inlining, d=race detector] + -v -> v=verbose EOF if [[ "$(type -t _usage_run)" = "function" ]]; then _usage_run ; fi } @@ -235,14 +228,20 @@ _main() { if [[ -z "$1" ]]; then _usage; return 1; fi local x local zforce + local zcover + local zwait + local ztestargs=() local zargs=() local zverbose=() local zbenchflags="" OPTIND=1 - while getopts ":ctmnrgpfvlyzdb:" flag + while getopts ":ctmnrgpfvlyzdsowb:" flag do case "x$flag" in + 'xo') zcover=1 ;; + 'xw') zwait=1 ;; 'xf') zforce=1 ;; + 'xs') ztestargs+=("-short") ;; 'xv') zverbose+=(1) ;; 'xl') zargs+=("-gcflags"); zargs+=("-l=4") ;; 'xn') zargs+=("-gcflags"); zargs+=("-m=2") ;; diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go index d84fbb2..6088603 100644 --- a/vendor/github.com/ugorji/go/codec/cbor.go +++ b/vendor/github.com/ugorji/go/codec/cbor.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -69,45 +69,48 @@ const ( // cborSelfDesrTag3 byte = 0xf7 // ) -func cbordesc(bd byte) string { - switch bd >> 5 { - case cborMajorUint: - return "(u)int" - case cborMajorNegInt: - return "int" - case cborMajorBytes: - return "bytes" - case cborMajorString: - return "string" - case cborMajorArray: - return "array" - case cborMajorMap: - return "map" - case cborMajorTag: - return "tag" - case cborMajorSimpleOrFloat: // default - switch bd { - case cborBdNil: - return "nil" - case cborBdFalse: - return "false" - case cborBdTrue: - return "true" - case cborBdFloat16, cborBdFloat32, cborBdFloat64: - return "float" - case cborBdIndefiniteBytes: - return "bytes*" - case cborBdIndefiniteString: - return "string*" - case cborBdIndefiniteArray: - return "array*" - case cborBdIndefiniteMap: - return "map*" - default: - return "unknown(simple)" +var ( + cbordescSimpleNames = map[byte]string{ + cborBdNil: "nil", + cborBdFalse: "false", + cborBdTrue: "true", + cborBdFloat16: "float", + cborBdFloat32: "float", + cborBdFloat64: "float", + cborBdBreak: "break", + } + cbordescIndefNames = map[byte]string{ + cborBdIndefiniteBytes: "bytes*", + cborBdIndefiniteString: "string*", + cborBdIndefiniteArray: "array*", + cborBdIndefiniteMap: "map*", + } + cbordescMajorNames = map[byte]string{ + cborMajorUint: "(u)int", + cborMajorNegInt: "int", + cborMajorBytes: "bytes", + cborMajorString: "string", + cborMajorArray: "array", + cborMajorMap: "map", + cborMajorTag: "tag", + cborMajorSimpleOrFloat: "simple", + } +) + +func cbordesc(bd byte) (s string) { + bm := bd >> 5 + if bm == cborMajorSimpleOrFloat { + s = cbordescSimpleNames[bd] + } else { + s = cbordescMajorNames[bm] + if s == "" { + s = cbordescIndefNames[bd] } } - return "unknown" + if s == "" { + s = "unknown" + } + return } // ------------------- @@ -138,11 +141,26 @@ func (e *cborEncDriver) EncodeBool(b bool) { } func (e *cborEncDriver) EncodeFloat32(f float32) { + b := math.Float32bits(f) + if e.h.OptimumSize { + if h := floatToHalfFloatBits(b); halfFloatToFloatBits(h) == b { + // fmt.Printf("no 32-16 overflow: %v\n", f) + e.e.encWr.writen1(cborBdFloat16) + bigenHelper{e.x[:2], e.e.w()}.writeUint16(h) + return + } + } e.e.encWr.writen1(cborBdFloat32) - bigenHelper{e.x[:4], e.e.w()}.writeUint32(math.Float32bits(f)) + bigenHelper{e.x[:4], e.e.w()}.writeUint32(b) } func (e *cborEncDriver) EncodeFloat64(f float64) { + if e.h.OptimumSize { + if f32 := float32(f); float64(f32) == f { + e.EncodeFloat32(f32) + return + } + } e.e.encWr.writen1(cborBdFloat64) bigenHelper{e.x[:8], e.e.w()}.writeUint64(math.Float64bits(f)) } @@ -305,7 +323,7 @@ type cborDecDriver struct { bdRead bool bd byte st bool // skip tags - fnil bool // found nil + _ bool // found nil noBuiltInTypes _ [6]uint64 // padding cache-aligned d Decoder @@ -321,13 +339,11 @@ func (d *cborDecDriver) readNextBd() { } func (d *cborDecDriver) advanceNil() (null bool) { - d.fnil = false if !d.bdRead { d.readNextBd() } if d.bd == cborBdNil || d.bd == cborBdUndefined { d.bdRead = false - d.fnil = true null = true } return @@ -347,15 +363,7 @@ func (d *cborDecDriver) skipTags() { } } -func (d *cborDecDriver) uncacheRead() { - if d.bdRead { - d.d.decRd.unreadn1() - d.bdRead = false - } -} - func (d *cborDecDriver) ContainerType() (vt valueType) { - d.fnil = false if !d.bdRead { d.readNextBd() } @@ -364,24 +372,21 @@ func (d *cborDecDriver) ContainerType() (vt valueType) { } if d.bd == cborBdNil { d.bdRead = false // always consume nil after seeing it in container type - d.fnil = true return valueTypeNil - } else if d.bd == cborBdIndefiniteBytes || (d.bd>>5 == cborMajorBytes) { + } + major := d.bd >> 5 + if major == cborMajorBytes { return valueTypeBytes - } else if d.bd == cborBdIndefiniteString || (d.bd>>5 == cborMajorString) { + } else if major == cborMajorString { return valueTypeString - } else if d.bd == cborBdIndefiniteArray || (d.bd>>5 == cborMajorArray) { + } else if major == cborMajorArray { return valueTypeArray - } else if d.bd == cborBdIndefiniteMap || (d.bd>>5 == cborMajorMap) { + } else if major == cborMajorMap { return valueTypeMap } return valueTypeUnset } -func (d *cborDecDriver) Nil() bool { - return d.fnil -} - func (d *cborDecDriver) TryNil() bool { return d.advanceNil() } @@ -401,19 +406,16 @@ func (d *cborDecDriver) decUint() (ui uint64) { v := d.bd & 0x1f if v <= 0x17 { ui = uint64(v) + } else if v == 0x18 { + ui = uint64(d.d.decRd.readn1()) + } else if v == 0x19 { + ui = uint64(bigen.Uint16(d.d.decRd.readx(2))) + } else if v == 0x1a { + ui = uint64(bigen.Uint32(d.d.decRd.readx(4))) + } else if v == 0x1b { + ui = uint64(bigen.Uint64(d.d.decRd.readx(8))) } else { - if v == 0x18 { - ui = uint64(d.d.decRd.readn1()) - } else if v == 0x19 { - ui = uint64(bigen.Uint16(d.d.decRd.readx(2))) - } else if v == 0x1a { - ui = uint64(bigen.Uint32(d.d.decRd.readx(4))) - } else if v == 0x1b { - ui = uint64(bigen.Uint64(d.d.decRd.readx(8))) - } else { - d.d.errorf("invalid descriptor decoding uint: %x/%s", d.bd, cbordesc(d.bd)) - return - } + d.d.errorf("invalid descriptor decoding uint: %x/%s", d.bd, cbordesc(d.bd)) } return } @@ -427,8 +429,8 @@ func (d *cborDecDriver) decCheckInteger() (neg bool) { } else if major == cborMajorNegInt { neg = true } else { - d.d.errorf("invalid integer; got major %v from descriptor %x/%s, expected %v or %v", - major, d.bd, cbordesc(d.bd), cborMajorUint, cborMajorNegInt) + d.d.errorf("invalid integer %x (%s); got major %v, expected %v or %v", + d.bd, cbordesc(d.bd), major, cborMajorUint, cborMajorNegInt) } return } @@ -451,8 +453,8 @@ func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte { d.bdRead = false for !d.CheckBreak() { if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorString { - d.d.errorf("invalid indefinite string/bytes; got major %v, expected %x/%s", - major, d.bd, cbordesc(d.bd)) + d.d.errorf("invalid indefinite string/bytes %x (%s); got major %v, expected %v or %v", + d.bd, cbordesc(d.bd), major, cborMajorBytes, cborMajorString) } n := uint(d.decLen()) oldLen := uint(len(bs)) @@ -515,8 +517,7 @@ func (d *cborDecDriver) DecodeFloat64() (f float64) { } else if major == cborMajorNegInt { f = float64(cborDecInt64(d.decUint(), true)) } else { - d.d.errorf("invalid float descriptor; got %d/%s, expected float16/32/64 or (-)int", - d.bd, cbordesc(d.bd)) + d.d.errorf("invalid float descriptor; got %d/%s, expected float16/32/64 or (-)int", d.bd, cbordesc(d.bd)) } } d.bdRead = false @@ -536,7 +537,6 @@ func (d *cborDecDriver) DecodeBool() (b bool) { } else if d.bd == cborBdFalse { } else { d.d.errorf("not bool - %s %x/%s", msgBadDesc, d.bd, cbordesc(d.bd)) - return } d.bdRead = false return @@ -544,36 +544,34 @@ func (d *cborDecDriver) DecodeBool() (b bool) { func (d *cborDecDriver) ReadMapStart() (length int) { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } if d.st { d.skipTags() } d.bdRead = false if d.bd == cborBdIndefiniteMap { - return decContainerLenUnknown + return containerLenUnknown } if d.bd>>5 != cborMajorMap { - d.d.errorf("error reading map; got major type: %x, expected %x/%s", - d.bd>>5, cborMajorMap, cbordesc(d.bd)) + d.d.errorf("error reading map; got major type: %x, expected %x/%s", d.bd>>5, cborMajorMap, cbordesc(d.bd)) } return d.decLen() } func (d *cborDecDriver) ReadArrayStart() (length int) { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } if d.st { d.skipTags() } d.bdRead = false if d.bd == cborBdIndefiniteArray { - return decContainerLenUnknown + return containerLenUnknown } if d.bd>>5 != cborMajorArray { - d.d.errorf("invalid array; got major type: %x, expect: %x/%s", - d.bd>>5, cborMajorArray, cbordesc(d.bd)) + d.d.errorf("invalid array; got major type: %x, expect: %x/%s", d.bd>>5, cborMajorArray, cbordesc(d.bd)) } return d.decLen() } @@ -624,12 +622,11 @@ func (d *cborDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { } clen := d.decLen() d.bdRead = false - if zerocopy { - if d.d.bytes { - return d.d.decRd.readx(uint(clen)) - } else if len(bs) == 0 { - bs = d.d.b[:] - } + if d.d.bytes && (zerocopy || d.h.ZeroCopy) { + return d.d.decRd.rb.readx(uint(clen)) + } + if zerocopy && len(bs) == 0 { + bs = d.d.b[:] } return decByteSlice(d.d.r(), clen, d.h.MaxInitLen, bs) } @@ -655,7 +652,7 @@ func (d *cborDecDriver) decodeTime(xtag uint64) (t time.Time) { case 0: var err error if t, err = time.Parse(time.RFC3339, stringView(d.DecodeStringAsBytes())); err != nil { - d.d.errorv(err) + d.d.onerror(err) } case 1: f1, f2 := math.Modf(d.DecodeFloat64()) @@ -682,7 +679,6 @@ func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { d.d.decode(&re.Value) } else if xtag != realxtag { d.d.errorf("Wrong extension tag. Got %b. Expecting: %v", realxtag, xtag) - return } else if ext == SelfExt { rv2 := baseRV(rv) d.d.decodeValue(rv2, d.h.fnNoExt(rv2.Type())) @@ -697,7 +693,6 @@ func (d *cborDecDriver) DecodeNaked() { d.readNextBd() } - d.fnil = false n := d.d.naked() var decodeFurther bool @@ -714,7 +709,7 @@ func (d *cborDecDriver) DecodeNaked() { n.v = valueTypeInt n.i = d.DecodeInt64() case cborMajorBytes: - decNakedReadRawBytes(d, &d.d, n, d.h.RawToString) + fauxUnionReadRawBytes(d, &d.d, n, d.h.RawToString) case cborMajorString: n.v = valueTypeString n.s = string(d.DecodeStringAsBytes()) @@ -742,7 +737,6 @@ func (d *cborDecDriver) DecodeNaked() { switch d.bd { case cborBdNil, cborBdUndefined: n.v = valueTypeNil - d.fnil = true case cborBdFalse: n.v = valueTypeBool n.b = false @@ -752,17 +746,6 @@ func (d *cborDecDriver) DecodeNaked() { case cborBdFloat16, cborBdFloat32, cborBdFloat64: n.v = valueTypeFloat n.f = d.DecodeFloat64() - case cborBdIndefiniteBytes: - decNakedReadRawBytes(d, &d.d, n, d.h.RawToString) - case cborBdIndefiniteString: - n.v = valueTypeString - n.s = string(d.DecodeStringAsBytes()) - case cborBdIndefiniteArray: - n.v = valueTypeArray - decodeFurther = true - case cborBdIndefiniteMap: - n.v = valueTypeMap - decodeFurther = true default: d.d.errorf("decodeNaked: Unrecognized d.bd: 0x%x", d.bd) } @@ -774,6 +757,129 @@ func (d *cborDecDriver) DecodeNaked() { } } +func (d *cborDecDriver) uintBytes() (v []byte, ui uint64) { + switch vv := d.bd & 0x1f; vv { + case 0x18: + v = d.d.decRd.readx(1) + ui = uint64(v[0]) + case 0x19: + v = d.d.decRd.readx(2) + ui = uint64(bigen.Uint16(v)) + case 0x1a: + v = d.d.decRd.readx(4) + ui = uint64(bigen.Uint32(v)) + case 0x1b: + v = d.d.decRd.readx(8) + ui = uint64(bigen.Uint64(v)) + default: + if vv > 0x1b { + d.d.errorf("invalid descriptor decoding uint: %x/%s", d.bd, cbordesc(d.bd)) + } + ui = uint64(vv) + } + return +} + +func (d *cborDecDriver) nextValueBytes(start []byte) (v []byte) { + if !d.bdRead { + d.readNextBd() + } + v = append(start, d.bd) + v = d.nextValueBytesBdReadR(v) + d.bdRead = false + return +} + +func (d *cborDecDriver) nextValueBytesR(v0 []byte) (v []byte) { + d.readNextBd() + v = append(v0, d.bd) + return d.nextValueBytesBdReadR(v) +} + +func (d *cborDecDriver) nextValueBytesBdReadR(v0 []byte) (v []byte) { + v = v0 + var bs []byte + var ui uint64 + + switch d.bd >> 5 { + case cborMajorUint, cborMajorNegInt: + bs, _ = d.uintBytes() + v = append(v, bs...) + case cborMajorString, cborMajorBytes: + if d.bd == cborBdIndefiniteBytes || d.bd == cborBdIndefiniteString { + for { + d.readNextBd() + v = append(v, d.bd) + if d.bd == cborBdBreak { + break + } + bs, ui = d.uintBytes() + v = append(v, bs...) + v = append(v, d.d.decRd.readx(uint(ui))...) + } + } else { + bs, ui = d.uintBytes() + v = append(v, bs...) + v = append(v, d.d.decRd.readx(uint(ui))...) + } + case cborMajorArray: + if d.bd == cborBdIndefiniteArray { + for { + d.readNextBd() + v = append(v, d.bd) + if d.bd == cborBdBreak { + break + } + v = d.nextValueBytesBdReadR(v) + } + } else { + bs, ui = d.uintBytes() + v = append(v, bs...) + for i := uint64(0); i < ui; i++ { + v = d.nextValueBytesR(v) + } + } + case cborMajorMap: + if d.bd == cborBdIndefiniteMap { + for { + d.readNextBd() + v = append(v, d.bd) + if d.bd == cborBdBreak { + break + } + v = d.nextValueBytesBdReadR(v) + v = d.nextValueBytesR(v) + } + } else { + bs, ui = d.uintBytes() + v = append(v, bs...) + for i := uint64(0); i < ui; i++ { + v = d.nextValueBytesR(v) + v = d.nextValueBytesR(v) + } + } + case cborMajorTag: + bs, _ = d.uintBytes() + v = append(v, bs...) + v = d.nextValueBytesR(v) + case cborMajorSimpleOrFloat: + switch d.bd { + case cborBdNil, cborBdUndefined, cborBdFalse, cborBdTrue: // pass + case cborBdFloat16: + v = append(v, d.d.decRd.readx(2)...) + case cborBdFloat32: + v = append(v, d.d.decRd.readx(4)...) + case cborBdFloat64: + v = append(v, d.d.decRd.readx(8)...) + default: + d.d.errorf("nextValueBytes: Unrecognized d.bd: 0x%x", d.bd) + } + default: // should never happen + d.d.errorf("nextValueBytes: Unrecognized d.bd: 0x%x", d.bd) + } + return +} + // ------------------------- // CborHandle is a Handle for the CBOR encoding format, @@ -815,6 +921,8 @@ type CborHandle struct { // Name returns the name of the handle: cbor func (h *CborHandle) Name() string { return "cbor" } +func (h *CborHandle) desc(bd byte) string { return cbordesc(bd) } + func (h *CborHandle) newEncDriver() encDriver { var e = &cborEncDriver{h: h} e.e.e = e @@ -838,7 +946,6 @@ func (e *cborEncDriver) reset() { func (d *cborDecDriver) reset() { d.bd = 0 d.bdRead = false - d.fnil = false d.st = d.h.SkipUnexpectedTags } diff --git a/vendor/github.com/ugorji/go/codec/decimal.go b/vendor/github.com/ugorji/go/codec/decimal.go new file mode 100644 index 0000000..c71af73 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/decimal.go @@ -0,0 +1,461 @@ +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +package codec + +import ( + "strconv" +) + +func parseFloat32(b []byte) (f float32, err error) { + return parseFloat32_custom(b) + // return parseFloat32_strconv(b) +} + +func parseFloat64(b []byte) (f float64, err error) { + return parseFloat64_custom(b) + // return parseFloat64_strconv(b) +} + +func parseFloat32_strconv(b []byte) (f float32, err error) { + f64, err := strconv.ParseFloat(stringView(b), 32) + f = float32(f64) + return +} + +func parseFloat64_strconv(b []byte) (f float64, err error) { + return strconv.ParseFloat(stringView(b), 64) +} + +// ------ parseFloat custom below -------- + +// We assume that a lot of floating point numbers in json files will be +// those that are handwritten, and with defined precision (in terms of number +// of digits after decimal point), etc. +// +// We further assume that this ones can be written in exact format. +// +// strconv.ParseFloat has some unnecessary overhead which we can do without +// for the common case: +// +// - expensive char-by-char check to see if underscores are in right place +// - testing for and skipping underscores +// - check if the string matches ignorecase +/- inf, +/- infinity, nan +// - support for base 16 (0xFFFF...) +// +// The functions below will try a fast-path for floats which can be decoded +// without any loss of precision, meaning they: +// +// - fits within the significand bits of the 32-bits or 64-bits +// - exponent fits within the exponent value +// - there is no truncation (any extra numbers are all trailing zeros) +// +// To figure out what the values are for maxMantDigits, use this idea below: +// +// 2^23 = 838 8608 (between 10^ 6 and 10^ 7) (significand bits of uint32) +// 2^32 = 42 9496 7296 (between 10^ 9 and 10^10) (full uint32) +// 2^52 = 4503 5996 2737 0496 (between 10^15 and 10^16) (significand bits of uint64) +// 2^64 = 1844 6744 0737 0955 1616 (between 10^19 and 10^20) (full uint64) +// +// Note: we only allow for up to what can comfortably fit into the significand +// ignoring the exponent, and we only try to parse iff significand fits. + +const ( + thousand = 1000 + million = thousand * thousand + billion = thousand * million + trillion = thousand * billion + quadrillion = thousand * trillion + quintillion = thousand * quadrillion +) + +// Exact powers of 10. +var uint64pow10 = [...]uint64{ + 1, 10, 100, + 1 * thousand, 10 * thousand, 100 * thousand, + 1 * million, 10 * million, 100 * million, + 1 * billion, 10 * billion, 100 * billion, + 1 * trillion, 10 * trillion, 100 * trillion, + 1 * quadrillion, 10 * quadrillion, 100 * quadrillion, + 1 * quintillion, 10 * quintillion, +} +var float64pow10 = [...]float64{ + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22, +} +var float32pow10 = [...]float32{ + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, +} + +type floatinfo struct { + mantbits uint8 + + // expbits uint8 // (unused) + // bias int16 // (unused) + + is32bit bool + exactPow10 int8 // Exact powers of ten are <= 10^N (32: 10, 64: 22) + + exactInts int8 // Exact integers are <= 10^N (for non-float, set to 0) + // maxMantDigits int8 // 10^19 fits in uint64, while 10^9 fits in uint32 + + mantCutoffIsUint64Cutoff bool + + mantCutoff uint64 +} + +// var fi32 = floatinfo{23, 8, -127, 10, 7, 9, fUint32Cutoff} +// var fi64 = floatinfo{52, 11, -1023, 22, 15, 19, fUint64Cutoff} + +// var fi64u = floatinfo{64, 0, -1023, 19, 0, 19, fUint64Cutoff} +// var fi64i = floatinfo{63, 0, -1023, 19, 0, 19, fUint64Cutoff} + +var fi32 = floatinfo{23, true, 10, 7, false, 1<<23 - 1} +var fi64 = floatinfo{52, false, 22, 15, false, 1<<52 - 1} + +var fi64u = floatinfo{0, false, 19, 0, true, fUint64Cutoff} +var fi64i = floatinfo{0, false, 19, 0, true, fUint64Cutoff} + +const fMaxMultiplierForExactPow10_64 = 1e15 +const fMaxMultiplierForExactPow10_32 = 1e7 + +const fUint64Cutoff = (1<<64-1)/10 + 1 +const fUint32Cutoff = (1<<32-1)/10 + 1 + +const fBase = 10 + +func strconvParseErr(b []byte, fn string) error { + return &strconv.NumError{ + Func: fn, + Err: strconv.ErrSyntax, + Num: string(b), + } +} + +func parseFloat32_reader(r readFloatResult) (f float32, fail bool) { + // parseFloatDebug(b, 32, false, exp, trunc, ok) + f = float32(r.mantissa) + // xdebugf("parsefloat32: exp: %v, mantissa: %v", r.exp, r.mantissa) + if r.exp == 0 { + } else if r.exp < 0 { // int / 10^k + f /= float32pow10[uint8(-r.exp)] + } else { // exp > 0 + if r.exp > fi32.exactPow10 { + f *= float32pow10[r.exp-fi32.exactPow10] + if f > fMaxMultiplierForExactPow10_32 { // exponent too large - outside range + fail = true + return // ok = false + } + f *= float32pow10[fi32.exactPow10] + } else { + f *= float32pow10[uint8(r.exp)] + } + } + if r.neg { + f = -f + } + return +} + +func parseFloat32_custom(b []byte) (f float32, err error) { + r := readFloat(b, fi32) + // xdebug2f("\tparsing: %s - ok: %v, bad: %v, trunc: %v, mantissa: %v, exp: %v", b, r.ok, r.bad, r.trunc, r.mantissa, r.exp) + if r.bad { + return 0, strconvParseErr(b, "ParseFloat") + } + if r.ok { + f, r.bad = parseFloat32_reader(r) + if !r.bad { + return + } + } + return parseFloat32_strconv(b) +} + +func parseFloat64_reader(r readFloatResult) (f float64, fail bool) { + f = float64(r.mantissa) + if r.exp == 0 { + } else if r.exp < 0 { // int / 10^k + f /= float64pow10[-uint8(r.exp)] + } else { // exp > 0 + if r.exp > fi64.exactPow10 { + f *= float64pow10[r.exp-fi64.exactPow10] + if f > fMaxMultiplierForExactPow10_64 { // exponent too large - outside range + fail = true + return + } + f *= float64pow10[fi64.exactPow10] + } else { + f *= float64pow10[uint8(r.exp)] + } + } + if r.neg { + f = -f + } + return +} + +func parseFloat64_custom(b []byte) (f float64, err error) { + r := readFloat(b, fi64) + if r.bad { + return 0, strconvParseErr(b, "ParseFloat") + } + if r.ok { + f, r.bad = parseFloat64_reader(r) + if !r.bad { + return + } + } + return parseFloat64_strconv(b) +} + +func parseUint64_simple(b []byte) (n uint64, ok bool) { + var i int + var n1 uint64 + var c uint8 +LOOP: + if i < len(b) { + c = b[i] + // unsigned integers don't overflow well on multiplication, so check cutoff here + // e.g. (maxUint64-5)*10 doesn't overflow well ... + // if n >= fUint64Cutoff || !isDigitChar(b[i]) { // if c < '0' || c > '9' { + if n >= fUint64Cutoff || c < '0' || c > '9' { + return + } else if c == '0' { + n *= fBase + } else { + n1 = n + n = n*fBase + uint64(c-'0') + if n < n1 { + return + } + } + i++ + goto LOOP + } + ok = true + return +} + +func parseUint64_reader(r readFloatResult) (f uint64, fail bool) { + f = r.mantissa + if r.exp == 0 { + } else if r.exp < 0 { // int / 10^k + if f%uint64pow10[uint8(-r.exp)] != 0 { + fail = true + } else { + f /= uint64pow10[uint8(-r.exp)] + } + } else { // exp > 0 + f *= uint64pow10[uint8(r.exp)] + } + return +} + +func parseInt64_reader(r readFloatResult) (v int64, fail bool) { + if r.exp == 0 { + } else if r.exp < 0 { // int / 10^k + if r.mantissa%uint64pow10[uint8(-r.exp)] != 0 { + // fail = true + return 0, true + } + r.mantissa /= uint64pow10[uint8(-r.exp)] + } else { // exp > 0 + r.mantissa *= uint64pow10[uint8(r.exp)] + } + if chkOvf.Uint2Int(r.mantissa, r.neg) { + fail = true + } else if r.neg { + v = -int64(r.mantissa) + } else { + v = int64(r.mantissa) + } + return +} + +// parseNumber will return an integer if only composed of [-]?[0-9]+ +// Else it will return a float. +func parseNumber(b []byte, z *fauxUnion, preferSignedInt bool) (err error) { + var ok, neg bool + var f uint64 + + // var b1 []byte + // if b[0] == '-' { + // neg = true + // b1 = b[1:] + // } else { + // b1 = b + // } + // f, ok = parseUint64_simple(b1) + + if len(b) == 0 { + return + } + + if b[0] == '-' { + neg = true + f, ok = parseUint64_simple(b[1:]) + } else { + f, ok = parseUint64_simple(b) + } + + if ok { + if neg { + z.v = valueTypeInt + if chkOvf.Uint2Int(f, neg) { + return strconvParseErr(b, "ParseInt") + } + z.i = -int64(f) + } else if preferSignedInt { + z.v = valueTypeInt + if chkOvf.Uint2Int(f, neg) { + return strconvParseErr(b, "ParseInt") + } + z.i = int64(f) + } else { + z.v = valueTypeUint + z.u = f + } + return + } + + z.v = valueTypeFloat + z.f, err = parseFloat64_custom(b) + return +} + +type readFloatResult struct { + mantissa uint64 + exp int8 + neg, sawdot, sawexp, trunc, bad bool + ok bool + + _ byte // padding +} + +func readFloat(s []byte, y floatinfo) (r readFloatResult) { + var i uint // uint, so that we eliminate bounds checking + var slen = uint(len(s)) + if slen == 0 { + // read an empty string as the zero value + // r.bad = true + r.ok = true + return + } + + if s[0] == '-' { + r.neg = true + i++ + } + + // we considered punting early if string has length > maxMantDigits, but this doesn't account + // for trailing 0's e.g. 700000000000000000000 can be encoded exactly as it is 7e20 + + var nd, ndMant, dp int8 + var xu uint64 + +LOOP: + for ; i < slen; i++ { + switch s[i] { + case '.': + if r.sawdot { + r.bad = true + return + } + r.sawdot = true + dp = nd + case 'e', 'E': + r.sawexp = true + break LOOP + case '0': + if nd == 0 { + dp-- + continue LOOP + } + nd++ + if r.mantissa < y.mantCutoff { + r.mantissa *= fBase + ndMant++ + } + case '1', '2', '3', '4', '5', '6', '7', '8', '9': + nd++ + if y.mantCutoffIsUint64Cutoff && r.mantissa < fUint64Cutoff { + r.mantissa *= fBase + xu = r.mantissa + uint64(s[i]-'0') + if xu < r.mantissa { + r.trunc = true + return + } + r.mantissa = xu + } else if r.mantissa < y.mantCutoff { + // mantissa = (mantissa << 1) + (mantissa << 3) + uint64(c-'0') + r.mantissa = r.mantissa*fBase + uint64(s[i]-'0') + } else { + r.trunc = true + return + } + ndMant++ + default: + r.bad = true + return + } + } + + if !r.sawdot { + dp = nd + } + + if r.sawexp { + i++ + if i < slen { + var eneg bool + if s[i] == '+' { + i++ + } else if s[i] == '-' { + i++ + eneg = true + } + if i < slen { + // for exact match, exponent is 1 or 2 digits (float64: -22 to 37, float32: -1 to 17). + // exit quick if exponent is more than 2 digits. + if i+2 < slen { + return + } + var e int8 + if s[i] < '0' || s[i] > '9' { // !isDigitChar(s[i]) { // + r.bad = true + return + } + e = int8(s[i] - '0') + i++ + if i < slen { + if s[i] < '0' || s[i] > '9' { // !isDigitChar(s[i]) { // + r.bad = true + return + } + e = e*fBase + int8(s[i]-'0') // (e << 1) + (e << 3) + int8(s[i]-'0') + i++ + } + if eneg { + dp -= e + } else { + dp += e + } + } + } + } + + if r.mantissa != 0 { + r.exp = dp - ndMant + // do not set ok=true for cases we cannot handle + if r.exp < -y.exactPow10 || + r.exp > y.exactInts+y.exactPow10 || + (y.mantbits != 0 && r.mantissa>>y.mantbits != 0) { + return + } + } + + r.ok = true + return +} diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go index a33252b..1bd5f56 100644 --- a/vendor/github.com/ugorji/go/codec/decode.go +++ b/vendor/github.com/ugorji/go/codec/decode.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io" - "math" "reflect" "strconv" "time" @@ -26,15 +25,6 @@ const ( decDefChanCap = 64 // should be large, as cap cannot be expanded decScratchByteArrayLen = (6 * 8) // ??? cacheLineSize + - // decContainerLenUnknown is length returned from Read(Map|Array)Len - // when a format doesn't know apiori. - // For example, json doesn't pre-determine the length of a container (sequence/map). - decContainerLenUnknown = -1 - - // decContainerLenNil is length returned from Read(Map|Array)Len - // when a 'nil' was encountered in the stream. - decContainerLenNil = math.MinInt32 - // decFailNonEmptyIntf configures whether we error // when decoding naked into a non-empty interface. // @@ -50,8 +40,8 @@ const ( ) var ( - errstrOnlyMapOrArrayCanDecodeIntoStruct = "only encoded map or array can be decoded into a struct" - errstrCannotDecodeIntoNil = "cannot decode into nil" + errOnlyMapOrArrayCanDecodeIntoStruct = errors.New("only encoded map or array can be decoded into a struct") + errCannotDecodeIntoNil = errors.New("cannot decode into nil") // errmsgExpandSliceOverflow = "expand slice: slice overflow" errmsgExpandSliceCannotChange = "expand slice: cannot change" @@ -63,7 +53,7 @@ var ( errDecUnreadByteUnknown = errors.New("cannot unread - reason unknown") errMaxDepthExceeded = errors.New("maximum decoding depth exceeded") - errBytesDecReaderCannotUnread = errors.New("cannot unread last byte read") + // errBytesDecReaderCannotUnread = errors.New("cannot unread last byte read") ) type decDriver interface { @@ -82,7 +72,7 @@ type decDriver interface { // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt. // For maps and arrays, it will not do the decoding in-band, but will signal - // the decoder, so that is done later, by setting the decNaked.valueType field. + // the decoder, so that is done later, by setting the fauxUnion.valueType field. // // Note: Numbers are decoded as int64, uint64, float64 only (no smaller sized number types). // for extensions, DecodeNaked must read the tag and the []byte if it exists. @@ -119,20 +109,21 @@ type decDriver interface { DecodeTime() (t time.Time) // ReadArrayStart will return the length of the array. - // If the format doesn't prefix the length, it returns decContainerLenUnknown. - // If the expected array was a nil in the stream, it returns decContainerLenNil. + // If the format doesn't prefix the length, it returns containerLenUnknown. + // If the expected array was a nil in the stream, it returns containerLenNil. ReadArrayStart() int ReadArrayEnd() // ReadMapStart will return the length of the array. - // If the format doesn't prefix the length, it returns decContainerLenUnknown. - // If the expected array was a nil in the stream, it returns decContainerLenNil. + // If the format doesn't prefix the length, it returns containerLenUnknown. + // If the expected array was a nil in the stream, it returns containerLenNil. ReadMapStart() int ReadMapEnd() reset() atEndOfDecode() - uncacheRead() + + nextValueBytes(start []byte) []byte decoder() *Decoder } @@ -269,6 +260,25 @@ type DecodeOptions struct { // RawToString controls how raw bytes in a stream are decoded into a nil interface{}. // By default, they are decoded as []byte, but can be decoded as string (if configured). RawToString bool + + // ZeroCopy controls whether decoded values point into the + // input bytes passed into a NewDecoderBytes/ResetBytes(...) call. + // + // To illustrate, if ZeroCopy and decoding from a []byte (not io.Writer), + // then a []byte in the output result may just be a slice of (point into) + // the input bytes. + // + // This optimization prevents unnecessary copying. + // + // However, it is made optional, as the caller MUST ensure that the input parameter + // is not modified after the Decode() happens. + ZeroCopy bool + + // PreferPointerForStructOrArray controls whether a struct or array + // is stored in a nil interface{}, or a pointer to it. + // + // This mostly impacts when we decode registered extensions. + PreferPointerForStructOrArray bool } // ---------------------------------------- @@ -288,27 +298,25 @@ func (d *Decoder) selferUnmarshal(f *codecFnInfo, rv reflect.Value) { func (d *Decoder) binaryUnmarshal(f *codecFnInfo, rv reflect.Value) { bm := rv2i(rv).(encoding.BinaryUnmarshaler) xbs := d.d.DecodeBytes(nil, true) - if fnerr := bm.UnmarshalBinary(xbs); fnerr != nil { - panic(fnerr) - } + fnerr := bm.UnmarshalBinary(xbs) + halt.onerror(fnerr) } func (d *Decoder) textUnmarshal(f *codecFnInfo, rv reflect.Value) { tm := rv2i(rv).(encoding.TextUnmarshaler) fnerr := tm.UnmarshalText(d.d.DecodeStringAsBytes()) - if fnerr != nil { - panic(fnerr) - } + halt.onerror(fnerr) } func (d *Decoder) jsonUnmarshal(f *codecFnInfo, rv reflect.Value) { tm := rv2i(rv).(jsonUnmarshaler) // bs := d.d.DecodeBytes(d.b[:], true, true) // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. - fnerr := tm.UnmarshalJSON(d.nextValueBytes()) - if fnerr != nil { - panic(fnerr) - } + bs := d.blist.get(256)[:0] + bs = d.d.nextValueBytes(bs) + fnerr := tm.UnmarshalJSON(bs) + d.blist.put(bs) + halt.onerror(fnerr) } func (d *Decoder) kErr(f *codecFnInfo, rv reflect.Value) { @@ -399,7 +407,6 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { // Consequently, we should relax this. Put it behind a const flag for now. if decFailNonEmptyIntf && f.ti.numMeth > 0 { d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth) - return } switch n.v { case valueTypeMap: @@ -483,6 +490,12 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { rvn = rvn.Elem() } } + // if struct/array, directly store pointer into the interface + if d.h.PreferPointerForStructOrArray && rvn.CanAddr() { + if rk := rvn.Kind(); rk == reflect.Array || rk == reflect.Struct { + rvn = rvn.Addr() + } + } case valueTypeNil: // rvn = reflect.Zero(f.ti.rt) // no-op @@ -501,7 +514,7 @@ func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { case valueTypeTime: rvn = n.rt() default: - panicv.errorf("kInterfaceNaked: unexpected valueType: %d", n.v) + halt.errorf("kInterfaceNaked: unexpected valueType: %d", n.v) } return } @@ -522,7 +535,6 @@ func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { rv.Set(rvn) } else { rvn = d.kInterfaceNaked(f) - // xdebugf("kInterface: %v", rvn) if rvn.IsValid() { rv.Set(rvn) } else if d.h.InterfaceReset { @@ -575,10 +587,6 @@ func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayL func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { sfn := structFieldNode{v: rv, update: true} ctyp := d.d.ContainerType() - if ctyp == valueTypeNil { - rvSetDirect(rv, f.ti.rv0) - return - } var mf MissingFielder if f.ti.isFlag(tiflagMissingFielder) { mf = rv2i(rv).(MissingFielder) @@ -611,8 +619,7 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { var f interface{} d.decode(&f) if !mf.CodecMissingField(rvkencname, f) && d.h.ErrorIfNoField { - d.errorf("no matching struct field found when decoding stream map with key: %s ", - stringView(rvkencname)) + d.errorf("no matching struct field when decoding stream map with key: %s ", stringView(rvkencname)) } } else { d.structFieldNotFound(-1, stringView(rvkencname)) @@ -653,8 +660,7 @@ func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { } d.arrayEnd() } else { - d.errorstr(errstrOnlyMapOrArrayCanDecodeIntoStruct) - return + d.onerror(errOnlyMapOrArrayCanDecodeIntoStruct) } } @@ -664,14 +670,10 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // Note: rv is a slice type here - guaranteed + rvCanset := rv.CanSet() + rtelem0 := f.ti.elem ctyp := d.d.ContainerType() - if ctyp == valueTypeNil { - if rv.CanSet() { - rvSetDirect(rv, f.ti.rv0) - } - return - } if ctyp == valueTypeBytes || ctyp == valueTypeString { // you can only decode bytes or string in the stream into a slice or array of bytes if !(f.ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { @@ -681,7 +683,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { bs2 := d.d.DecodeBytes(rvbs, false) // if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { if !(len(bs2) > 0 && len(bs2) == len(rvbs) && &bs2[0] == &rvbs[0]) { - if rv.CanSet() { + if rvCanset { rvSetBytes(rv, bs2) } else if len(rvbs) > 0 && len(bs2) > 0 { copy(rvbs, bs2) @@ -694,7 +696,7 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // an array can never return a nil slice. so no need to check f.array here. if containerLenS == 0 { - if rv.CanSet() { + if rvCanset { if rvIsNil(rv) { rvSetDirect(rv, reflect.MakeSlice(f.ti.rt, 0, 0)) } else { @@ -717,9 +719,9 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { var fn *codecFn - var rv0 = rv var rvChanged bool - var rvCanset = rv.CanSet() + + var rv0 = rv var rv9 reflect.Value rvlen := rvGetSliceLen(rv) @@ -728,24 +730,28 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { if hasLen { if containerLenS > rvcap { oldRvlenGtZero := rvlen > 0 - rvlen = decInferLen(containerLenS, d.h.MaxInitLen, int(rtelem0.Size())) - if rvlen <= rvcap { + rvlen1 := decInferLen(containerLenS, d.h.MaxInitLen, int(rtelem0.Size())) + if rvlen1 == rvlen { + } else if rvlen1 <= rvcap { if rvCanset { + rvlen = rvlen1 rvSetSliceLen(rv, rvlen) } - } else if rvCanset { + } else if rvCanset { // rvlen1 > rvcap + rvlen = rvlen1 rv = reflect.MakeSlice(f.ti.rt, rvlen, rvlen) + rvCanset = rv.CanSet() rvcap = rvlen rvChanged = true - } else { + } else { // rvlen1 > rvcap && !canSet d.errorf("cannot decode into non-settable slice") } if rvChanged && oldRvlenGtZero && rtelem0Mut { // !isImmutableKind(rtelem0.Kind()) { rvCopySlice(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap) } } else if containerLenS != rvlen { - rvlen = containerLenS if rvCanset { + rvlen = containerLenS rvSetSliceLen(rv, rvlen) } } @@ -757,63 +763,52 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { var j int for ; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && f.seq == seqTypeSlice && rvIsNil(rv) { - if hasLen { - rvlen = decInferLen(containerLenS, d.h.MaxInitLen, rtelem0Size) - } else { - rvlen = decDefSliceCap - } + if j == 0 && f.seq == seqTypeSlice && rvIsNil(rv) { // means hasLen = false if rvCanset { - rv = reflect.MakeSlice(f.ti.rt, rvlen, rvlen) - rvcap = rvlen + rvlen = decDefSliceCap + rvcap = rvlen * 2 + rv = reflect.MakeSlice(f.ti.rt, rvlen, rvcap) + rvCanset = rv.CanSet() rvChanged = true } else { d.errorf("cannot decode into non-settable slice") } } - slh.ElemContainerState(j) // if indefinite, etc, then expand the slice if necessary if j >= rvlen { if f.seq == seqTypeArray { - d.arrayCannotExpand(rvlen, j+1) - // drain completely and return - d.swallow() - j++ - for ; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - slh.ElemContainerState(j) - d.swallow() - } - slh.End() + decArrayCannotExpand(slh, hasLen, rvlen, j, containerLenS) return } + slh.ElemContainerState(j) // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // append logic + varargs // expand the slice up to the cap. // Note that we did, so we have to reset it later. if rvlen < rvcap { - if rv.CanSet() { - rvSetSliceLen(rv, rvcap) - } else if rvCanset { - rv = rvSlice(rv, rvcap) - rvChanged = true + rvlen = rvcap + if rvCanset { + rvSetSliceLen(rv, rvlen) + } else if rvChanged { + rv = rvSlice(rv, rvlen) } else { d.errorf(errmsgExpandSliceCannotChange) - return } - rvlen = rvcap } else { - if !rvCanset { + if !(rvCanset || rvChanged) { d.errorf(errmsgExpandSliceCannotChange) - return } - rvcap = growCap(rvcap, rtelem0Size, rvcap) - rv9 = reflect.MakeSlice(f.ti.rt, rvcap, rvcap) + rvcap = growCap(rvcap, rtelem0Size, 1) + rvlen = rvcap + rv9 = reflect.MakeSlice(f.ti.rt, rvlen, rvcap) rvCopySlice(rv9, rv) rv = rv9 + rvCanset = rv.CanSet() rvChanged = true - rvlen = rvcap } + } else { + slh.ElemContainerState(j) } rv9 = rvSliceIndex(rv, j, f.ti) if d.h.SliceElementReset { @@ -830,16 +825,16 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { d.decodeValue(rv9, fn) } if j < rvlen { - if rv.CanSet() { + if rvCanset { rvSetSliceLen(rv, j) - } else if rvCanset { + } else if rvChanged { rv = rvSlice(rv, j) - rvChanged = true } rvlen = j } else if j == 0 && rvIsNil(rv) { if rvCanset { rv = reflect.MakeSlice(f.ti.rt, 0, 0) + // rvCanset = rv.CanSet() rvChanged = true } } @@ -848,7 +843,6 @@ func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { if rvChanged { // infers rvCanset=true, so it can be reset rv0.Set(rv) } - } func (d *Decoder) kSliceForChan(f *codecFnInfo, rv reflect.Value) { @@ -860,10 +854,6 @@ func (d *Decoder) kSliceForChan(f *codecFnInfo, rv reflect.Value) { } rtelem0 := f.ti.elem ctyp := d.d.ContainerType() - if ctyp == valueTypeNil { - rvSetDirect(rv, f.ti.rv0) - return - } if ctyp == valueTypeBytes || ctyp == valueTypeString { // you can only decode bytes or string in the stream into a slice or array of bytes if !(f.ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { @@ -949,10 +939,6 @@ func (d *Decoder) kSliceForChan(f *codecFnInfo, rv reflect.Value) { func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - rvSetDirect(rv, f.ti.rv0) - return - } ti := f.ti if rvIsNil(rv) { rvlen := decInferLen(containerLen, d.h.MaxInitLen, int(ti.key.Size()+ti.elem.Size())) @@ -1082,51 +1068,18 @@ func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { if doMapSet && ktypeIsString { // set to a real string (not string view) rvk.SetString(d.string(kstrbs)) } - d.decodeValue(rvv, valFn) + // since a map, we have to set zero value if needed + if d.d.TryNil() { + rvv = reflect.Zero(rvv.Type()) + } else { + d.decodeValueNoCheckNil(rvv, valFn) + } if doMapSet { mapSet(rv, rvk, rvv) } } d.mapEnd() - -} - -// decNaked is used to keep track of the primitives decoded. -// Without it, we would have to decode each primitive and wrap it -// in an interface{}, causing an allocation. -// In this model, the primitives are decoded in a "pseudo-atomic" fashion, -// so we can rest assured that no other decoding happens while these -// primitives are being decoded. -// -// maps and arrays are not handled by this mechanism. -// However, RawExt is, and we accommodate for extensions that decode -// RawExt from DecodeNaked, but need to decode the value subsequently. -// kInterfaceNaked and swallow, which call DecodeNaked, handle this caveat. -// -// However, decNaked also keeps some arrays of default maps and slices -// used in DecodeNaked. This way, we can get a pointer to it -// without causing a new heap allocation. -// -// kInterfaceNaked will ensure that there is no allocation for the common -// uses. - -type decNaked struct { - // r RawExt // used for RawExt, uint, []byte. - - // primitives below - u uint64 - i int64 - f float64 - l []byte - s string - - // ---- cpu cache line boundary? - t time.Time - b bool - - // state - v valueType } // Decoder reads and decodes an object from an input stream in a supported format. @@ -1139,8 +1092,6 @@ type decNaked struct { // This is the idiomatic way to use. type Decoder struct { panicHdl - // hopefully, reduce derefencing cost by laying the decReader inside the Decoder. - // Try to put things that go together to fit within a cache line (8 words). d decDriver @@ -1156,7 +1107,7 @@ type Decoder struct { decRd // ---- cpu cache line boundary? - n decNaked + n fauxUnion hh Handle err error @@ -1269,13 +1220,16 @@ func (d *Decoder) ResetBytes(in []byte) { if in == nil { return } - d.bytes = true d.bufio = false + d.bytes = true + // if d.rb == nil { + // d.rb = new(bytesDecReader) + // } d.rb.reset(in) d.resetCommon() } -func (d *Decoder) naked() *decNaked { +func (d *Decoder) naked() *fauxUnion { return &d.n } @@ -1349,16 +1303,14 @@ func (d *Decoder) Decode(v interface{}) (err error) { if d.err != nil { return d.err } - if recoverPanicToErr { - defer func() { - if x := recover(); x != nil { - panicValToErr(d, x, &d.err) - if d.err != err { - err = d.err - } + defer func() { + if x := recover(); x != nil { + panicValToErr(d, x, &d.err) + if d.err != err { + err = d.err } - }() - } + } + }() // defer d.deferred(&err) d.mustDecode(v) @@ -1368,9 +1320,7 @@ func (d *Decoder) Decode(v interface{}) (err error) { // MustDecode is like Decode, but panics if unable to Decode. // This provides insight to the code location that triggered the error. func (d *Decoder) MustDecode(v interface{}) { - if d.err != nil { - panic(d.err) - } + halt.onerror(d.err) d.mustDecode(v) } @@ -1400,40 +1350,9 @@ func (d *Decoder) Release() { } func (d *Decoder) swallow() { - switch d.d.ContainerType() { - case valueTypeNil: - case valueTypeMap: - containerLen := d.mapStart() - hasLen := containerLen >= 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - d.swallow() - d.mapElemValue() - d.swallow() - } - d.mapEnd() - case valueTypeArray: - containerLen := d.arrayStart() - hasLen := containerLen >= 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.arrayElem() - d.swallow() - } - d.arrayEnd() - case valueTypeBytes: - d.d.DecodeBytes(d.b[:], true) - case valueTypeString: - d.d.DecodeStringAsBytes() - default: - // these are all primitives, which we can get from decodeNaked - // if RawExt using Value, complete the processing. - n := d.naked() - d.d.DecodeNaked() - if n.v == valueTypeExt && n.l == nil { - var v2 interface{} - d.decode(&v2) - } - } + bs := d.blist.get(256)[:0] + bs = d.d.nextValueBytes(bs) // discard it + d.blist.put(bs) } func setZero(iv interface{}) { @@ -1473,7 +1392,7 @@ func setZero(iv interface{}) { *v = 0 case *float64: *v = 0 - case *[]uint8: + case *[]byte: *v = nil case *Raw: *v = nil @@ -1512,15 +1431,16 @@ func (d *Decoder) decode(iv interface{}) { // consequently, we deal with nil and interfaces outside the switch. if iv == nil { - d.errorstr(errstrCannotDecodeIntoNil) - return + d.onerror(errCannotDecodeIntoNil) } switch v := iv.(type) { // case nil: // case Selfer: case reflect.Value: - d.ensureDecodeable(v) + if !isDecodeable(v) { + d.haltAsNotDecodeable(v) + } d.decodeValue(v, nil) case *string: @@ -1551,9 +1471,9 @@ func (d *Decoder) decode(iv interface{}) { *v = float32(d.decodeFloat32()) case *float64: *v = d.d.DecodeFloat64() - case *[]uint8: + case *[]byte: *v = d.d.DecodeBytes(*v, false) - case []uint8: + case []byte: b := d.d.DecodeBytes(v, false) if !(len(b) > 0 && len(b) == len(v) && &b[0] == &v[0]) { copy(v, b) @@ -1567,11 +1487,22 @@ func (d *Decoder) decode(iv interface{}) { d.decodeValue(rv4i(iv), nil) default: - if v, ok := iv.(Selfer); ok { - v.CodecDecodeSelf(d) - } else if !fastpathDecodeTypeSwitch(iv, d) { + // if xfFn := d.h.getExt(i2rtid(iv), true); xfFn != nil { + // d.d.DecodeExt(iv, xfFn.tag, xfFn.ext) + // } else if v, ok := iv.(Selfer); ok { + // v.CodecDecodeSelf(d) + // } else if !fastpathDecodeTypeSwitch(iv, d) { + // v := rv4i(iv) + // if !isDecodeable(v) { + // d.haltAsNotDecodeable(v) + // } + // d.decodeValue(v, nil) + // } + if !fastpathDecodeTypeSwitch(iv, d) { v := rv4i(iv) - d.ensureDecodeable(v) + if !isDecodeable(v) { + d.haltAsNotDecodeable(v) + } d.decodeValue(v, nil) } } @@ -1582,26 +1513,37 @@ func (d *Decoder) decode(iv interface{}) { // // This way, we know if it is itself a pointer, and can handle nil in // the stream effectively. +// +// Note that decodeValue will handle nil in the stream early, so that the +// subsequent calls i.e. kXXX methods, etc do not have to handle it themselves. func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn) { + // if rv.Kind() == reflect.Ptr && d.d.TryNil() { + if d.d.TryNil() { + if rv.Kind() == reflect.Ptr { + rv = rv.Elem() + } + if rv.CanSet() { + rv.Set(reflect.Zero(rv.Type())) + } + return + } + d.decodeValueNoCheckNil(rv, fn) +} + +func (d *Decoder) decodeValueNoCheckNil(rv reflect.Value, fn *codecFn) { // If stream is not containing a nil value, then we can deref to the base // non-pointer value, and decode into that. var rvp reflect.Value var rvpValid bool +PTR: if rv.Kind() == reflect.Ptr { - if d.d.TryNil() { - if rvelem := rv.Elem(); rvelem.CanSet() { - rvelem.Set(reflect.Zero(rvelem.Type())) - } - return - } rvpValid = true - for rv.Kind() == reflect.Ptr { - if rvIsNil(rv) { - rvSetDirect(rv, reflect.New(rv.Type().Elem())) - } - rvp = rv - rv = rv.Elem() + if rvIsNil(rv) { + rvSetDirect(rv, reflect.New(rv.Type().Elem())) } + rvp = rv + rv = rv.Elem() + goto PTR } if fn == nil { @@ -1627,10 +1569,8 @@ func (d *Decoder) structFieldNotFound(index int, rvkencname string) { if d.h.ErrorIfNoField { if index >= 0 { d.errorf("no matching struct field found when decoding stream array at index %v", index) - return } else if rvkencname != "" { d.errorf("no matching struct field found when decoding stream map with key " + rvkencname) - return } } d.swallow() @@ -1642,49 +1582,46 @@ func (d *Decoder) arrayCannotExpand(sliceLen, streamLen int) { } } +// isDecodeable checks if value can be decoded into +// +// decode can take any reflect.Value that is a inherently addressable i.e. +// - array +// - non-nil chan (we will SEND to it) +// - non-nil slice (we will set its elements) +// - non-nil map (we will put into it) +// - non-nil pointer (we can "update" it) func isDecodeable(rv reflect.Value) (canDecode bool) { switch rv.Kind() { case reflect.Array: - return rv.CanAddr() - case reflect.Ptr: + canDecode = rv.CanAddr() + case reflect.Ptr, reflect.Slice, reflect.Chan, reflect.Map: if !rvIsNil(rv) { - return true - } - case reflect.Slice, reflect.Chan, reflect.Map: - if !rvIsNil(rv) { - return true + canDecode = true } } return } -func (d *Decoder) ensureDecodeable(rv reflect.Value) { - // decode can take any reflect.Value that is a inherently addressable i.e. - // - array - // - non-nil chan (we will SEND to it) - // - non-nil slice (we will set its elements) - // - non-nil map (we will put into it) - // - non-nil pointer (we can "update" it) - if isDecodeable(rv) { - return - } +// func (d *Decoder) ensureDecodeable(rv reflect.Value) { +// if !isDecodeable(rv) { +// d.haltAsNotDecodeable(rv) +// } +// } + +func (d *Decoder) haltAsNotDecodeable(rv reflect.Value) { if !rv.IsValid() { - d.errorstr(errstrCannotDecodeIntoNil) - return + d.onerror(errCannotDecodeIntoNil) } if !rv.CanInterface() { d.errorf("cannot decode into a value without an interface: %v", rv) - return } - rvi := rv2i(rv) - rvk := rv.Kind() - d.errorf("cannot decode into value of kind: %v, type: %T, %#v", rvk, rvi, rvi) + d.errorf("cannot decode into value of kind: %v, %#v", rv.Kind(), rv2i(rv)) } func (d *Decoder) depthIncr() { d.depth++ if d.depth >= d.maxdepth { - panic(errMaxDepthExceeded) + halt.onerror(errMaxDepthExceeded) } } @@ -1711,25 +1648,13 @@ func (d *Decoder) string(v []byte) (s string) { return } -// nextValueBytes returns the next value in the stream as a set of bytes. -func (d *Decoder) nextValueBytes() (bs []byte) { - d.d.uncacheRead() - d.r().track() - d.swallow() - bs = d.r().stopTrack() - return -} - -func (d *Decoder) rawBytes() []byte { +func (d *Decoder) rawBytes() (v []byte) { // ensure that this is not a view into the bytes - // i.e. make new copy always. - bs := d.nextValueBytes() - bs2 := make([]byte, len(bs)) - copy(bs2, bs) - return bs2 + // i.e. if necessary, make new copy always. + return d.d.nextValueBytes(nil) } -func (d *Decoder) wrapErr(v interface{}, err *error) { +func (d *Decoder) wrapErr(v error, err *error) { *err = decodeError{codecError: codecError{name: d.hh.Name(), err: v}, pos: d.NumBytesRead()} } @@ -1753,12 +1678,11 @@ func (d *Decoder) decodeFloat32() float32 { // Note: We update the .c after calling the callback. // This way, the callback can know what the last status was. -// Note: if you call mapStart and it returns decContainerLenNil, -// then do NOT call mapEnd. +// MARKER: do not call mapEnd if mapStart returns containerLenNil. func (d *Decoder) mapStart() (v int) { v = d.d.ReadMapStart() - if v != decContainerLenNil { + if v != containerLenNil { d.depthIncr() d.c = containerMapStart } @@ -1788,7 +1712,7 @@ func (d *Decoder) mapEnd() { func (d *Decoder) arrayStart() (v int) { v = d.d.ReadArrayStart() - if v != decContainerLenNil { + if v != containerLenNil { d.depthIncr() d.c = containerArrayStart } @@ -1935,25 +1859,25 @@ func decByteSlice(r *decRd, clen, maxInitLen int, bs []byte) (bsOut []byte) { // It is used to ensure that the []byte returned is not // part of the input stream or input stream buffers. func detachZeroCopyBytes(isBytesReader bool, dest []byte, in []byte) (out []byte) { - if len(in) > 0 { - // if isBytesReader || len(in) <= scratchByteArrayLen { - // if cap(dest) >= len(in) { - // out = dest[:len(in)] - // } else { - // out = make([]byte, len(in)) - // } - // copy(out, in) - // return - // } - if cap(dest) >= len(in) { - out = dest[:len(in)] - } else { - out = make([]byte, len(in)) - } - copy(out, in) - return + if len(in) == 0 { + return in } - return in + // if isBytesReader || len(in) <= scratchByteArrayLen { + // if cap(dest) >= len(in) { + // out = dest[:len(in)] + // } else { + // out = make([]byte, len(in)) + // } + // copy(out, in) + // return + // } + if cap(dest) >= len(in) { + out = dest[:len(in)] + } else { + out = make([]byte, len(in)) + } + copy(out, in) + return } // decInferLen will infer a sensible length, given the following: @@ -1971,13 +1895,10 @@ func decInferLen(clen, maxlen, unit int) (rvlen int) { // maxlen<=0, clen>0: infer maxlen, and cap on it // maxlen> 0, clen>0: cap at maxlen - if clen == 0 { + if clen == 0 || clen == containerLenNil { return } if clen < 0 { - if clen == decContainerLenNil { - return 0 - } return maxLenIfUnset } if unit == 0 { @@ -2006,24 +1927,7 @@ func decInferLen(clen, maxlen, unit int) (rvlen int) { return } -func decReadFull(r io.Reader, bs []byte) (n uint, err error) { - var nn int - for n < uint(len(bs)) && err == nil { - nn, err = r.Read(bs[n:]) - if nn > 0 { - if err == io.EOF { - // leave EOF for next time - err = nil - } - n += uint(nn) - } - } - // do not do this - it serves no purpose - // if n != len(bs) && err == io.EOF { err = io.ErrUnexpectedEOF } - return -} - -func decNakedReadRawBytes(dr decDriver, d *Decoder, n *decNaked, rawToString bool) { +func fauxUnionReadRawBytes(dr decDriver, d *Decoder, n *fauxUnion, rawToString bool) { if rawToString { n.v = valueTypeString n.s = string(dr.DecodeBytes(d.b[:], true)) @@ -2032,3 +1936,16 @@ func decNakedReadRawBytes(dr decDriver, d *Decoder, n *decNaked, rawToString boo n.l = dr.DecodeBytes(nil, false) } } + +func decArrayCannotExpand(slh decSliceHelper, hasLen bool, lenv, j, containerLenS int) { + slh.d.arrayCannotExpand(lenv, j+1) + // drain completely and return + slh.ElemContainerState(j) + slh.d.swallow() + j++ + for ; (hasLen && j < containerLenS) || !(hasLen || slh.d.checkBreak()); j++ { + slh.ElemContainerState(j) + slh.d.swallow() + } + slh.End() +} diff --git a/vendor/github.com/ugorji/go/codec/doc.go b/vendor/github.com/ugorji/go/codec/doc.go index e987fa6..acb25f4 100644 --- a/vendor/github.com/ugorji/go/codec/doc.go +++ b/vendor/github.com/ugorji/go/codec/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. /* diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go index 351dd2d..d4db735 100644 --- a/vendor/github.com/ugorji/go/codec/encode.go +++ b/vendor/github.com/ugorji/go/codec/encode.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -135,6 +135,16 @@ type EncodeOptions struct { // These include encoding.TextMarshaler, time.Format calls, struct field names, etc. StringToRaw bool + // OptimumSize controls whether we optimize for the smallest size. + // + // Some formats will use this flag to determine whether to encode + // in the smallest size possible, even if it takes slightly longer. + // + // For example, some formats that support half-floats might check if it is possible + // to store a float64 as a half float. Doing this check has a small performance cost, + // but the benefit is that the encoded message will be smaller. + OptimumSize bool + // // AsSymbols defines what should be encoded as symbols. // // // // Encoding as symbols can reduce the encoded size significantly. @@ -248,10 +258,6 @@ func (e *Encoder) kUintptr(f *codecFnInfo, rv reflect.Value) { e.e.EncodeUint(uint64(rvGetUintptr(rv))) } -func (e *Encoder) kInvalid(f *codecFnInfo, rv reflect.Value) { - e.e.EncodeNil() -} - func (e *Encoder) kErr(f *codecFnInfo, rv reflect.Value) { e.errorf("unsupported kind %s, for %#v", rv.Kind(), rv) } @@ -304,10 +310,7 @@ func (e *Encoder) kSliceWMbs(rv reflect.Value, ti *typeInfo) { if l == 0 { e.mapStart(0) } else { - if l%2 == 1 { - e.errorf("mapBySlice requires even slice length, but got %v", l) - return - } + e.haltOnMbsOddLen(l) e.mapStart(l / 2) fn := e.kSeqFn(ti.elem) for j := 0; j < l; j++ { @@ -342,7 +345,6 @@ func (e *Encoder) kSeqWMbs(rv reflect.Value, ti *typeInfo) { } else { if l%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", l) - return } e.mapStart(l / 2) fn := e.kSeqFn(ti.elem) @@ -372,13 +374,8 @@ func (e *Encoder) kSeqW(rv reflect.Value, ti *typeInfo) { } func (e *Encoder) kChan(f *codecFnInfo, rv reflect.Value) { - if rvIsNil(rv) { - e.e.EncodeNil() - return - } if f.ti.chandir&uint8(reflect.RecvDir) == 0 { e.errorf("send-only channel cannot be encoded") - return } if !f.ti.mbs && uint8TypId == rt2id(f.ti.elem) { e.kSliceBytesChan(rv) @@ -395,10 +392,6 @@ func (e *Encoder) kChan(f *codecFnInfo, rv reflect.Value) { } func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { - if rvIsNil(rv) { - e.e.EncodeNil() - return - } if f.ti.mbs { e.kSliceWMbs(rv, f.ti) } else { @@ -592,11 +585,6 @@ func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { } func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { - if rvIsNil(rv) { - e.e.EncodeNil() - return - } - l := rv.Len() e.mapStart(l) if l == 0 { @@ -915,6 +903,9 @@ func (e *Encoder) ResetBytes(out *[]byte) { in = make([]byte, defEncByteBufSize) } e.bytes = true + // if e.wb == nil { + // e.wb = new(bytesEncAppender) + // } e.wb.reset(in, out) e.resetCommon() } @@ -1012,24 +1003,22 @@ func (e *Encoder) Encode(v interface{}) (err error) { if e.err != nil { return e.err } - if recoverPanicToErr { - defer func() { - // if error occurred during encoding, return that error; - // else if error occurred on end'ing (i.e. during flush), return that error. - err = e.w().endErr() - x := recover() - if x == nil { - if e.err != err { - e.err = err - } - } else { - panicValToErr(e, x, &e.err) - if e.err != err { - err = e.err - } + defer func() { + // if error occurred during encoding, return that error; + // else if error occurred on end'ing (i.e. during flush), return that error. + err = e.w().endErr() + x := recover() + if x == nil { + if e.err != err { + e.err = err } - }() - } + } else { + panicValToErr(e, x, &e.err) + if e.err != err { + err = e.err + } + } + }() // defer e.deferred(&err) e.mustEncode(v) @@ -1039,9 +1028,7 @@ func (e *Encoder) Encode(v interface{}) (err error) { // MustEncode is like Encode, but panics if unable to Encode. // This provides insight to the code location that triggered the error. func (e *Encoder) MustEncode(v interface{}) { - if e.err != nil { - panic(e.err) - } + halt.onerror(e.err) e.mustEncode(v) } @@ -1080,8 +1067,6 @@ func (e *Encoder) encode(iv interface{}) { return } - var vself Selfer - switch v := iv.(type) { // case nil: // case Selfer: @@ -1122,7 +1107,7 @@ func (e *Encoder) encode(iv interface{}) { e.e.EncodeFloat64(v) case time.Time: e.e.EncodeTime(v) - case []uint8: + case []byte: e.e.EncodeStringBytesRaw(v) case *Raw: e.rawBytes(*v) @@ -1158,16 +1143,25 @@ func (e *Encoder) encode(iv interface{}) { e.e.EncodeFloat64(*v) case *time.Time: e.e.EncodeTime(*v) - case *[]uint8: + case *[]byte: if *v == nil { e.e.EncodeNil() } else { e.e.EncodeStringBytesRaw(*v) } default: - if vself, ok = iv.(Selfer); ok { - vself.CodecEncodeSelf(e) - } else if !fastpathEncodeTypeSwitch(iv, e) { + // var vself Selfer + // if xfFn := e.h.getExt(i2rtid(iv), true); xfFn != nil { + // e.e.EncodeExt(iv, xfFn.tag, xfFn.ext) + // } else if vself, ok = iv.(Selfer); ok { + // vself.CodecEncodeSelf(e) + // } else if !fastpathEncodeTypeSwitch(iv, e) { + // if !rv.IsValid() { + // rv = rv4i(iv) + // } + // e.encodeValue(rv, nil) + // } + if !fastpathEncodeTypeSwitch(iv, e) { if !rv.IsValid() { rv = rv4i(iv) } @@ -1176,6 +1170,10 @@ func (e *Encoder) encode(iv interface{}) { } } +// encodeValue will encode a value. +// +// Note that encodeValue will handle nil in the stream early, so that the +// subsequent calls i.e. kXXX methods, etc do not have to handle it themselves. func (e *Encoder) encodeValue(rv reflect.Value, fn *codecFn) { // if a valid fn is passed, it MUST BE for the dereferenced type of rv @@ -1184,6 +1182,9 @@ func (e *Encoder) encodeValue(rv reflect.Value, fn *codecFn) { // type T struct { tHelper } // Here, for var v T; &v and &v.tHelper are the same pointer. // Consequently, we need a tuple of type and pointer, which interface{} natively provides. + + // MARKER: We check if value is nil here, so that the kXXX method do not have to. + var sptr interface{} // uintptr var rvp reflect.Value var rvpValid bool @@ -1209,7 +1210,7 @@ TOP: } rv = rv.Elem() goto TOP - case reflect.Slice, reflect.Map: + case reflect.Slice, reflect.Map, reflect.Chan: if rvIsNil(rv) { e.e.EncodeNil() return @@ -1250,9 +1251,7 @@ TOP: } func (e *Encoder) marshalUtf8(bs []byte, fnerr error) { - if fnerr != nil { - panic(fnerr) - } + halt.onerror(fnerr) if bs == nil { e.e.EncodeNil() } else { @@ -1262,9 +1261,7 @@ func (e *Encoder) marshalUtf8(bs []byte, fnerr error) { } func (e *Encoder) marshalAsis(bs []byte, fnerr error) { - if fnerr != nil { - panic(fnerr) - } + halt.onerror(fnerr) if bs == nil { e.e.EncodeNil() } else { @@ -1273,9 +1270,7 @@ func (e *Encoder) marshalAsis(bs []byte, fnerr error) { } func (e *Encoder) marshalRaw(bs []byte, fnerr error) { - if fnerr != nil { - panic(fnerr) - } + halt.onerror(fnerr) if bs == nil { e.e.EncodeNil() } else { @@ -1291,7 +1286,7 @@ func (e *Encoder) rawBytes(vv Raw) { e.encWr.writeb(v) // e.asis(v) } -func (e *Encoder) wrapErr(v interface{}, err *error) { +func (e *Encoder) wrapErr(v error, err *error) { *err = encodeError{codecError{name: e.hh.Name(), err: v}} } @@ -1344,6 +1339,12 @@ func (e *Encoder) arrayEnd() { // ---------- +func (e *Encoder) haltOnMbsOddLen(length int) { + if length%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", length) + } +} + func (e *Encoder) sideEncode(v interface{}, bs *[]byte) { rv := baseRV(v) e2 := NewEncoderBytes(bs, e.hh) @@ -1354,7 +1355,6 @@ func (e *Encoder) sideEncode(v interface{}, bs *[]byte) { func encStructFieldKey(encName string, ee encDriver, w *encWr, keyType valueType, encNameAsciiAlphaNum bool, js bool) { - var m must // use if-else-if, not switch (which compiles to binary-search) // since keyType is typically valueTypeString, branch prediction is pretty good. if keyType == valueTypeString { @@ -1364,10 +1364,10 @@ func encStructFieldKey(encName string, ee encDriver, w *encWr, ee.EncodeString(encName) } } else if keyType == valueTypeInt { - ee.EncodeInt(m.Int(strconv.ParseInt(encName, 10, 64))) + ee.EncodeInt(must.Int(strconv.ParseInt(encName, 10, 64))) } else if keyType == valueTypeUint { - ee.EncodeUint(m.Uint(strconv.ParseUint(encName, 10, 64))) + ee.EncodeUint(must.Uint(strconv.ParseUint(encName, 10, 64))) } else if keyType == valueTypeFloat { - ee.EncodeFloat64(m.Float(strconv.ParseFloat(encName, 64))) + ee.EncodeFloat64(must.Float(strconv.ParseFloat(encName, 64))) } } diff --git a/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/vendor/github.com/ugorji/go/codec/fast-path.generated.go index e9b7f23..1436e5e 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.generated.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.generated.go @@ -1,6 +1,6 @@ // +build !notfastpath -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from fast-path.go.tmpl - DO NOT EDIT. @@ -38,8 +38,6 @@ import ( const fastpathEnabled = true -const fastpathMapBySliceErrMsg = "mapBySlice requires even slice length, but got %v" - type fastpathT struct{} var fastpathTV fastpathT @@ -51,7 +49,7 @@ type fastpathE struct { decfn func(*Decoder, *codecFnInfo, reflect.Value) } -type fastpathA [81]fastpathE +type fastpathA [54]fastpathE func (x *fastpathA) index(rtid uintptr) int { // use binary search to grab the index (adapted from sort/search.go) @@ -98,15 +96,9 @@ func init() { fn([]interface{}(nil), (*Encoder).fastpathEncSliceIntfR, (*Decoder).fastpathDecSliceIntfR) fn([]string(nil), (*Encoder).fastpathEncSliceStringR, (*Decoder).fastpathDecSliceStringR) fn([][]byte(nil), (*Encoder).fastpathEncSliceBytesR, (*Decoder).fastpathDecSliceBytesR) - fn([]float32(nil), (*Encoder).fastpathEncSliceFloat32R, (*Decoder).fastpathDecSliceFloat32R) fn([]float64(nil), (*Encoder).fastpathEncSliceFloat64R, (*Decoder).fastpathDecSliceFloat64R) - fn([]uint(nil), (*Encoder).fastpathEncSliceUintR, (*Decoder).fastpathDecSliceUintR) - fn([]uint16(nil), (*Encoder).fastpathEncSliceUint16R, (*Decoder).fastpathDecSliceUint16R) - fn([]uint32(nil), (*Encoder).fastpathEncSliceUint32R, (*Decoder).fastpathDecSliceUint32R) fn([]uint64(nil), (*Encoder).fastpathEncSliceUint64R, (*Decoder).fastpathDecSliceUint64R) fn([]int(nil), (*Encoder).fastpathEncSliceIntR, (*Decoder).fastpathDecSliceIntR) - fn([]int8(nil), (*Encoder).fastpathEncSliceInt8R, (*Decoder).fastpathDecSliceInt8R) - fn([]int16(nil), (*Encoder).fastpathEncSliceInt16R, (*Decoder).fastpathDecSliceInt16R) fn([]int32(nil), (*Encoder).fastpathEncSliceInt32R, (*Decoder).fastpathDecSliceInt32R) fn([]int64(nil), (*Encoder).fastpathEncSliceInt64R, (*Decoder).fastpathDecSliceInt64R) fn([]bool(nil), (*Encoder).fastpathEncSliceBoolR, (*Decoder).fastpathDecSliceBoolR) @@ -114,67 +106,46 @@ func init() { fn(map[string]interface{}(nil), (*Encoder).fastpathEncMapStringIntfR, (*Decoder).fastpathDecMapStringIntfR) fn(map[string]string(nil), (*Encoder).fastpathEncMapStringStringR, (*Decoder).fastpathDecMapStringStringR) fn(map[string][]byte(nil), (*Encoder).fastpathEncMapStringBytesR, (*Decoder).fastpathDecMapStringBytesR) - fn(map[string]uint(nil), (*Encoder).fastpathEncMapStringUintR, (*Decoder).fastpathDecMapStringUintR) fn(map[string]uint8(nil), (*Encoder).fastpathEncMapStringUint8R, (*Decoder).fastpathDecMapStringUint8R) fn(map[string]uint64(nil), (*Encoder).fastpathEncMapStringUint64R, (*Decoder).fastpathDecMapStringUint64R) fn(map[string]int(nil), (*Encoder).fastpathEncMapStringIntR, (*Decoder).fastpathDecMapStringIntR) fn(map[string]int64(nil), (*Encoder).fastpathEncMapStringInt64R, (*Decoder).fastpathDecMapStringInt64R) - fn(map[string]float32(nil), (*Encoder).fastpathEncMapStringFloat32R, (*Decoder).fastpathDecMapStringFloat32R) fn(map[string]float64(nil), (*Encoder).fastpathEncMapStringFloat64R, (*Decoder).fastpathDecMapStringFloat64R) fn(map[string]bool(nil), (*Encoder).fastpathEncMapStringBoolR, (*Decoder).fastpathDecMapStringBoolR) - fn(map[uint]interface{}(nil), (*Encoder).fastpathEncMapUintIntfR, (*Decoder).fastpathDecMapUintIntfR) - fn(map[uint]string(nil), (*Encoder).fastpathEncMapUintStringR, (*Decoder).fastpathDecMapUintStringR) - fn(map[uint][]byte(nil), (*Encoder).fastpathEncMapUintBytesR, (*Decoder).fastpathDecMapUintBytesR) - fn(map[uint]uint(nil), (*Encoder).fastpathEncMapUintUintR, (*Decoder).fastpathDecMapUintUintR) - fn(map[uint]uint8(nil), (*Encoder).fastpathEncMapUintUint8R, (*Decoder).fastpathDecMapUintUint8R) - fn(map[uint]uint64(nil), (*Encoder).fastpathEncMapUintUint64R, (*Decoder).fastpathDecMapUintUint64R) - fn(map[uint]int(nil), (*Encoder).fastpathEncMapUintIntR, (*Decoder).fastpathDecMapUintIntR) - fn(map[uint]int64(nil), (*Encoder).fastpathEncMapUintInt64R, (*Decoder).fastpathDecMapUintInt64R) - fn(map[uint]float32(nil), (*Encoder).fastpathEncMapUintFloat32R, (*Decoder).fastpathDecMapUintFloat32R) - fn(map[uint]float64(nil), (*Encoder).fastpathEncMapUintFloat64R, (*Decoder).fastpathDecMapUintFloat64R) - fn(map[uint]bool(nil), (*Encoder).fastpathEncMapUintBoolR, (*Decoder).fastpathDecMapUintBoolR) fn(map[uint8]interface{}(nil), (*Encoder).fastpathEncMapUint8IntfR, (*Decoder).fastpathDecMapUint8IntfR) fn(map[uint8]string(nil), (*Encoder).fastpathEncMapUint8StringR, (*Decoder).fastpathDecMapUint8StringR) fn(map[uint8][]byte(nil), (*Encoder).fastpathEncMapUint8BytesR, (*Decoder).fastpathDecMapUint8BytesR) - fn(map[uint8]uint(nil), (*Encoder).fastpathEncMapUint8UintR, (*Decoder).fastpathDecMapUint8UintR) fn(map[uint8]uint8(nil), (*Encoder).fastpathEncMapUint8Uint8R, (*Decoder).fastpathDecMapUint8Uint8R) fn(map[uint8]uint64(nil), (*Encoder).fastpathEncMapUint8Uint64R, (*Decoder).fastpathDecMapUint8Uint64R) fn(map[uint8]int(nil), (*Encoder).fastpathEncMapUint8IntR, (*Decoder).fastpathDecMapUint8IntR) fn(map[uint8]int64(nil), (*Encoder).fastpathEncMapUint8Int64R, (*Decoder).fastpathDecMapUint8Int64R) - fn(map[uint8]float32(nil), (*Encoder).fastpathEncMapUint8Float32R, (*Decoder).fastpathDecMapUint8Float32R) fn(map[uint8]float64(nil), (*Encoder).fastpathEncMapUint8Float64R, (*Decoder).fastpathDecMapUint8Float64R) fn(map[uint8]bool(nil), (*Encoder).fastpathEncMapUint8BoolR, (*Decoder).fastpathDecMapUint8BoolR) fn(map[uint64]interface{}(nil), (*Encoder).fastpathEncMapUint64IntfR, (*Decoder).fastpathDecMapUint64IntfR) fn(map[uint64]string(nil), (*Encoder).fastpathEncMapUint64StringR, (*Decoder).fastpathDecMapUint64StringR) fn(map[uint64][]byte(nil), (*Encoder).fastpathEncMapUint64BytesR, (*Decoder).fastpathDecMapUint64BytesR) - fn(map[uint64]uint(nil), (*Encoder).fastpathEncMapUint64UintR, (*Decoder).fastpathDecMapUint64UintR) fn(map[uint64]uint8(nil), (*Encoder).fastpathEncMapUint64Uint8R, (*Decoder).fastpathDecMapUint64Uint8R) fn(map[uint64]uint64(nil), (*Encoder).fastpathEncMapUint64Uint64R, (*Decoder).fastpathDecMapUint64Uint64R) fn(map[uint64]int(nil), (*Encoder).fastpathEncMapUint64IntR, (*Decoder).fastpathDecMapUint64IntR) fn(map[uint64]int64(nil), (*Encoder).fastpathEncMapUint64Int64R, (*Decoder).fastpathDecMapUint64Int64R) - fn(map[uint64]float32(nil), (*Encoder).fastpathEncMapUint64Float32R, (*Decoder).fastpathDecMapUint64Float32R) fn(map[uint64]float64(nil), (*Encoder).fastpathEncMapUint64Float64R, (*Decoder).fastpathDecMapUint64Float64R) fn(map[uint64]bool(nil), (*Encoder).fastpathEncMapUint64BoolR, (*Decoder).fastpathDecMapUint64BoolR) fn(map[int]interface{}(nil), (*Encoder).fastpathEncMapIntIntfR, (*Decoder).fastpathDecMapIntIntfR) fn(map[int]string(nil), (*Encoder).fastpathEncMapIntStringR, (*Decoder).fastpathDecMapIntStringR) fn(map[int][]byte(nil), (*Encoder).fastpathEncMapIntBytesR, (*Decoder).fastpathDecMapIntBytesR) - fn(map[int]uint(nil), (*Encoder).fastpathEncMapIntUintR, (*Decoder).fastpathDecMapIntUintR) fn(map[int]uint8(nil), (*Encoder).fastpathEncMapIntUint8R, (*Decoder).fastpathDecMapIntUint8R) fn(map[int]uint64(nil), (*Encoder).fastpathEncMapIntUint64R, (*Decoder).fastpathDecMapIntUint64R) fn(map[int]int(nil), (*Encoder).fastpathEncMapIntIntR, (*Decoder).fastpathDecMapIntIntR) fn(map[int]int64(nil), (*Encoder).fastpathEncMapIntInt64R, (*Decoder).fastpathDecMapIntInt64R) - fn(map[int]float32(nil), (*Encoder).fastpathEncMapIntFloat32R, (*Decoder).fastpathDecMapIntFloat32R) fn(map[int]float64(nil), (*Encoder).fastpathEncMapIntFloat64R, (*Decoder).fastpathDecMapIntFloat64R) fn(map[int]bool(nil), (*Encoder).fastpathEncMapIntBoolR, (*Decoder).fastpathDecMapIntBoolR) fn(map[int64]interface{}(nil), (*Encoder).fastpathEncMapInt64IntfR, (*Decoder).fastpathDecMapInt64IntfR) fn(map[int64]string(nil), (*Encoder).fastpathEncMapInt64StringR, (*Decoder).fastpathDecMapInt64StringR) fn(map[int64][]byte(nil), (*Encoder).fastpathEncMapInt64BytesR, (*Decoder).fastpathDecMapInt64BytesR) - fn(map[int64]uint(nil), (*Encoder).fastpathEncMapInt64UintR, (*Decoder).fastpathDecMapInt64UintR) fn(map[int64]uint8(nil), (*Encoder).fastpathEncMapInt64Uint8R, (*Decoder).fastpathDecMapInt64Uint8R) fn(map[int64]uint64(nil), (*Encoder).fastpathEncMapInt64Uint64R, (*Decoder).fastpathDecMapInt64Uint64R) fn(map[int64]int(nil), (*Encoder).fastpathEncMapInt64IntR, (*Decoder).fastpathDecMapInt64IntR) fn(map[int64]int64(nil), (*Encoder).fastpathEncMapInt64Int64R, (*Decoder).fastpathDecMapInt64Int64R) - fn(map[int64]float32(nil), (*Encoder).fastpathEncMapInt64Float32R, (*Decoder).fastpathDecMapInt64Float32R) fn(map[int64]float64(nil), (*Encoder).fastpathEncMapInt64Float64R, (*Decoder).fastpathDecMapInt64Float64R) fn(map[int64]bool(nil), (*Encoder).fastpathEncMapInt64BoolR, (*Decoder).fastpathDecMapInt64BoolR) @@ -210,14 +181,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncSliceBytesV(*v, e) } - case []float32: - fastpathTV.EncSliceFloat32V(v, e) - case *[]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceFloat32V(*v, e) - } case []float64: fastpathTV.EncSliceFloat64V(v, e) case *[]float64: @@ -226,30 +189,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncSliceFloat64V(*v, e) } - case []uint: - fastpathTV.EncSliceUintV(v, e) - case *[]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUintV(*v, e) - } - case []uint16: - fastpathTV.EncSliceUint16V(v, e) - case *[]uint16: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUint16V(*v, e) - } - case []uint32: - fastpathTV.EncSliceUint32V(v, e) - case *[]uint32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceUint32V(*v, e) - } case []uint64: fastpathTV.EncSliceUint64V(v, e) case *[]uint64: @@ -266,22 +205,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncSliceIntV(*v, e) } - case []int8: - fastpathTV.EncSliceInt8V(v, e) - case *[]int8: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceInt8V(*v, e) - } - case []int16: - fastpathTV.EncSliceInt16V(v, e) - case *[]int16: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncSliceInt16V(*v, e) - } case []int32: fastpathTV.EncSliceInt32V(v, e) case *[]int32: @@ -330,14 +253,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapStringBytesV(*v, e) } - case map[string]uint: - fastpathTV.EncMapStringUintV(v, e) - case *map[string]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapStringUintV(*v, e) - } case map[string]uint8: fastpathTV.EncMapStringUint8V(v, e) case *map[string]uint8: @@ -370,14 +285,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapStringInt64V(*v, e) } - case map[string]float32: - fastpathTV.EncMapStringFloat32V(v, e) - case *map[string]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapStringFloat32V(*v, e) - } case map[string]float64: fastpathTV.EncMapStringFloat64V(v, e) case *map[string]float64: @@ -394,94 +301,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapStringBoolV(*v, e) } - case map[uint]interface{}: - fastpathTV.EncMapUintIntfV(v, e) - case *map[uint]interface{}: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintIntfV(*v, e) - } - case map[uint]string: - fastpathTV.EncMapUintStringV(v, e) - case *map[uint]string: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintStringV(*v, e) - } - case map[uint][]byte: - fastpathTV.EncMapUintBytesV(v, e) - case *map[uint][]byte: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintBytesV(*v, e) - } - case map[uint]uint: - fastpathTV.EncMapUintUintV(v, e) - case *map[uint]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintUintV(*v, e) - } - case map[uint]uint8: - fastpathTV.EncMapUintUint8V(v, e) - case *map[uint]uint8: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintUint8V(*v, e) - } - case map[uint]uint64: - fastpathTV.EncMapUintUint64V(v, e) - case *map[uint]uint64: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintUint64V(*v, e) - } - case map[uint]int: - fastpathTV.EncMapUintIntV(v, e) - case *map[uint]int: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintIntV(*v, e) - } - case map[uint]int64: - fastpathTV.EncMapUintInt64V(v, e) - case *map[uint]int64: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintInt64V(*v, e) - } - case map[uint]float32: - fastpathTV.EncMapUintFloat32V(v, e) - case *map[uint]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintFloat32V(*v, e) - } - case map[uint]float64: - fastpathTV.EncMapUintFloat64V(v, e) - case *map[uint]float64: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintFloat64V(*v, e) - } - case map[uint]bool: - fastpathTV.EncMapUintBoolV(v, e) - case *map[uint]bool: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUintBoolV(*v, e) - } case map[uint8]interface{}: fastpathTV.EncMapUint8IntfV(v, e) case *map[uint8]interface{}: @@ -506,14 +325,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapUint8BytesV(*v, e) } - case map[uint8]uint: - fastpathTV.EncMapUint8UintV(v, e) - case *map[uint8]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUint8UintV(*v, e) - } case map[uint8]uint8: fastpathTV.EncMapUint8Uint8V(v, e) case *map[uint8]uint8: @@ -546,14 +357,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapUint8Int64V(*v, e) } - case map[uint8]float32: - fastpathTV.EncMapUint8Float32V(v, e) - case *map[uint8]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUint8Float32V(*v, e) - } case map[uint8]float64: fastpathTV.EncMapUint8Float64V(v, e) case *map[uint8]float64: @@ -594,14 +397,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapUint64BytesV(*v, e) } - case map[uint64]uint: - fastpathTV.EncMapUint64UintV(v, e) - case *map[uint64]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUint64UintV(*v, e) - } case map[uint64]uint8: fastpathTV.EncMapUint64Uint8V(v, e) case *map[uint64]uint8: @@ -634,14 +429,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapUint64Int64V(*v, e) } - case map[uint64]float32: - fastpathTV.EncMapUint64Float32V(v, e) - case *map[uint64]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapUint64Float32V(*v, e) - } case map[uint64]float64: fastpathTV.EncMapUint64Float64V(v, e) case *map[uint64]float64: @@ -682,14 +469,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapIntBytesV(*v, e) } - case map[int]uint: - fastpathTV.EncMapIntUintV(v, e) - case *map[int]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapIntUintV(*v, e) - } case map[int]uint8: fastpathTV.EncMapIntUint8V(v, e) case *map[int]uint8: @@ -722,14 +501,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapIntInt64V(*v, e) } - case map[int]float32: - fastpathTV.EncMapIntFloat32V(v, e) - case *map[int]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapIntFloat32V(*v, e) - } case map[int]float64: fastpathTV.EncMapIntFloat64V(v, e) case *map[int]float64: @@ -770,14 +541,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapInt64BytesV(*v, e) } - case map[int64]uint: - fastpathTV.EncMapInt64UintV(v, e) - case *map[int64]uint: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapInt64UintV(*v, e) - } case map[int64]uint8: fastpathTV.EncMapInt64Uint8V(v, e) case *map[int64]uint8: @@ -810,14 +573,6 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { } else { fastpathTV.EncMapInt64Int64V(*v, e) } - case map[int64]float32: - fastpathTV.EncMapInt64Float32V(v, e) - case *map[int64]float32: - if *v == nil { - e.e.EncodeNil() - } else { - fastpathTV.EncMapInt64Float32V(*v, e) - } case map[int64]float64: fastpathTV.EncMapInt64Float64V(v, e) case *map[int64]float64: @@ -858,20 +613,17 @@ func (fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.encode(v[j]) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.encode(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -889,20 +641,17 @@ func (fastpathT) EncSliceStringV(v []string, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeString(v[j]) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.e.EncodeString(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceBytesR(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -920,51 +669,17 @@ func (fastpathT) EncSliceBytesV(v [][]byte, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceBytesV(v [][]byte, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeStringBytesRaw(v[j]) - } - e.mapEnd() - } -} -func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceFloat32V(rv2i(rv).([]float32), e) - } else { - fastpathTV.EncSliceFloat32V(rv2i(rv).([]float32), e) - } -} -func (fastpathT) EncSliceFloat32V(v []float32, e *Encoder) { - e.arrayStart(len(v)) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) for j := range v { - e.arrayElem() - e.e.EncodeFloat32(v[j]) - } - e.arrayEnd() -} -func (fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeFloat32(v[j]) + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.e.EncodeStringBytesRaw(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -982,113 +697,17 @@ func (fastpathT) EncSliceFloat64V(v []float64, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeFloat64(v[j]) - } - e.mapEnd() - } -} -func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUintV(rv2i(rv).([]uint), e) - } else { - fastpathTV.EncSliceUintV(rv2i(rv).([]uint), e) - } -} -func (fastpathT) EncSliceUintV(v []uint, e *Encoder) { - e.arrayStart(len(v)) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) for j := range v { - e.arrayElem() - e.e.EncodeUint(uint64(v[j])) - } - e.arrayEnd() -} -func (fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeUint(uint64(v[j])) + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() - } -} -func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUint16V(rv2i(rv).([]uint16), e) - } else { - fastpathTV.EncSliceUint16V(rv2i(rv).([]uint16), e) - } -} -func (fastpathT) EncSliceUint16V(v []uint16, e *Encoder) { - e.arrayStart(len(v)) - for j := range v { - e.arrayElem() - e.e.EncodeUint(uint64(v[j])) - } - e.arrayEnd() -} -func (fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeUint(uint64(v[j])) - } - e.mapEnd() - } -} -func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUint32V(rv2i(rv).([]uint32), e) - } else { - fastpathTV.EncSliceUint32V(rv2i(rv).([]uint32), e) - } -} -func (fastpathT) EncSliceUint32V(v []uint32, e *Encoder) { - e.arrayStart(len(v)) - for j := range v { - e.arrayElem() - e.e.EncodeUint(uint64(v[j])) - } - e.arrayEnd() -} -func (fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeUint(uint64(v[j])) - } - e.mapEnd() + e.e.EncodeFloat64(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -1106,20 +725,17 @@ func (fastpathT) EncSliceUint64V(v []uint64, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeUint(v[j]) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.e.EncodeUint(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -1137,82 +753,17 @@ func (fastpathT) EncSliceIntV(v []int, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeInt(int64(v[j])) - } - e.mapEnd() - } -} -func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceInt8V(rv2i(rv).([]int8), e) - } else { - fastpathTV.EncSliceInt8V(rv2i(rv).([]int8), e) - } -} -func (fastpathT) EncSliceInt8V(v []int8, e *Encoder) { - e.arrayStart(len(v)) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) for j := range v { - e.arrayElem() + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() + } e.e.EncodeInt(int64(v[j])) } - e.arrayEnd() -} -func (fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeInt(int64(v[j])) - } - e.mapEnd() - } -} -func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceInt16V(rv2i(rv).([]int16), e) - } else { - fastpathTV.EncSliceInt16V(rv2i(rv).([]int16), e) - } -} -func (fastpathT) EncSliceInt16V(v []int16, e *Encoder) { - e.arrayStart(len(v)) - for j := range v { - e.arrayElem() - e.e.EncodeInt(int64(v[j])) - } - e.arrayEnd() -} -func (fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeInt(int64(v[j])) - } - e.mapEnd() - } + e.mapEnd() } func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -1230,20 +781,17 @@ func (fastpathT) EncSliceInt32V(v []int32, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeInt(int64(v[j])) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.e.EncodeInt(int64(v[j])) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -1261,20 +809,17 @@ func (fastpathT) EncSliceInt64V(v []int64, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeInt(v[j]) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.e.EncodeInt(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { @@ -1292,20 +837,17 @@ func (fastpathT) EncSliceBoolV(v []bool, e *Encoder) { e.arrayEnd() } func (fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { - if len(v)%2 == 1 { - e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - e.e.EncodeBool(v[j]) + e.haltOnMbsOddLen(len(v)) + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() } - e.mapEnd() + e.e.EncodeBool(v[j]) } + e.mapEnd() } func (e *Encoder) fastpathEncMapStringIntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e) @@ -1394,35 +936,6 @@ func (fastpathT) EncMapStringBytesV(v map[string][]byte, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapStringUintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringUintV(rv2i(rv).(map[string]uint), e) -} -func (fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = k - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeString(k2) - e.mapElemValue() - e.e.EncodeUint(uint64(v[k2])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeString(k2) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e) } @@ -1539,35 +1052,6 @@ func (fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapStringFloat32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapStringFloat32V(rv2i(rv).(map[string]float32), e) -} -func (fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]string, len(v)) - var i uint - for k := range v { - v2[i] = k - i++ - } - sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeString(k2) - e.mapElemValue() - e.e.EncodeFloat32(v[k2]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeString(k2) - e.mapElemValue() - e.e.EncodeFloat32(v2) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapStringFloat64V(rv2i(rv).(map[string]float64), e) } @@ -1626,343 +1110,24 @@ func (fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapUintIntfR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintIntfV(rv2i(rv).(map[uint]interface{}), e) -} -func (fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.encode(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.encode(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintStringR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintStringV(rv2i(rv).(map[uint]string), e) -} -func (fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeString(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeString(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintBytesR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintBytesV(rv2i(rv).(map[uint][]byte), e) -} -func (fastpathT) EncMapUintBytesV(v map[uint][]byte, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeStringBytesRaw(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeStringBytesRaw(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintUintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintUintV(rv2i(rv).(map[uint]uint), e) -} -func (fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintUint8R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintUint8V(rv2i(rv).(map[uint]uint8), e) -} -func (fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeUint(uint64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintUint64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintUint64V(rv2i(rv).(map[uint]uint64), e) -} -func (fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeUint(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeUint(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintIntR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintIntV(rv2i(rv).(map[uint]int), e) -} -func (fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeInt(int64(v[uint(k2)])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeInt(int64(v2)) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintInt64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintInt64V(rv2i(rv).(map[uint]int64), e) -} -func (fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeInt(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeInt(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintFloat32V(rv2i(rv).(map[uint]float32), e) -} -func (fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeFloat32(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeFloat32(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintFloat64V(rv2i(rv).(map[uint]float64), e) -} -func (fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeFloat64(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeFloat64(v2) - } - } - e.mapEnd() -} -func (e *Encoder) fastpathEncMapUintBoolR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUintBoolV(rv2i(rv).(map[uint]bool), e) -} -func (fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint(k2))) - e.mapElemValue() - e.e.EncodeBool(v[uint(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeBool(v2) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), e) } func (fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.encode(v[uint8(k2)]) + e.encode(v[k2]) } } else { for k2, v2 := range v { @@ -1980,18 +1145,18 @@ func (e *Encoder) fastpathEncMapUint8StringR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeString(v[uint8(k2)]) + e.e.EncodeString(v[k2]) } } else { for k2, v2 := range v { @@ -2009,18 +1174,18 @@ func (e *Encoder) fastpathEncMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapUint8BytesV(v map[uint8][]byte, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeStringBytesRaw(v[uint8(k2)]) + e.e.EncodeStringBytesRaw(v[k2]) } } else { for k2, v2 := range v { @@ -2032,53 +1197,24 @@ func (fastpathT) EncMapUint8BytesV(v map[uint8][]byte, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapUint8UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8UintV(rv2i(rv).(map[uint8]uint), e) -} -func (fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) - e.mapElemValue() - e.e.EncodeUint(uint64(v[uint8(k2)])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), e) } func (fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeUint(uint64(v[uint8(k2)])) + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { @@ -2096,18 +1232,18 @@ func (e *Encoder) fastpathEncMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeUint(v[uint8(k2)]) + e.e.EncodeUint(v[k2]) } } else { for k2, v2 := range v { @@ -2125,18 +1261,18 @@ func (e *Encoder) fastpathEncMapUint8IntR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeInt(int64(v[uint8(k2)])) + e.e.EncodeInt(int64(v[k2])) } } else { for k2, v2 := range v { @@ -2154,18 +1290,18 @@ func (e *Encoder) fastpathEncMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeInt(v[uint8(k2)]) + e.e.EncodeInt(v[k2]) } } else { for k2, v2 := range v { @@ -2177,53 +1313,24 @@ func (fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapUint8Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint8Float32V(rv2i(rv).(map[uint8]float32), e) -} -func (fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = uint64(k) - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) - e.mapElemValue() - e.e.EncodeFloat32(v[uint8(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(uint64(k2)) - e.mapElemValue() - e.e.EncodeFloat32(v2) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint8Float64V(rv2i(rv).(map[uint8]float64), e) } func (fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeFloat64(v[uint8(k2)]) + e.e.EncodeFloat64(v[k2]) } } else { for k2, v2 := range v { @@ -2241,18 +1348,18 @@ func (e *Encoder) fastpathEncMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]uint64, len(v)) + v2 := make([]uint8, len(v)) var i uint for k := range v { - v2[i] = uint64(k) + v2[i] = k i++ } - sort.Sort(uint64Slice(v2)) + sort.Sort(uint8Slice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeUint(uint64(uint8(k2))) + e.e.EncodeUint(uint64(k2)) e.mapElemValue() - e.e.EncodeBool(v[uint8(k2)]) + e.e.EncodeBool(v[k2]) } } else { for k2, v2 := range v { @@ -2351,35 +1458,6 @@ func (fastpathT) EncMapUint64BytesV(v map[uint64][]byte, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapUint64UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64UintV(rv2i(rv).(map[uint64]uint), e) -} -func (fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = k - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(k2) - e.mapElemValue() - e.e.EncodeUint(uint64(v[k2])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(k2) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), e) } @@ -2496,35 +1574,6 @@ func (fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapUint64Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapUint64Float32V(rv2i(rv).(map[uint64]float32), e) -} -func (fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]uint64, len(v)) - var i uint - for k := range v { - v2[i] = k - i++ - } - sort.Sort(uint64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeUint(k2) - e.mapElemValue() - e.e.EncodeFloat32(v[k2]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeUint(k2) - e.mapElemValue() - e.e.EncodeFloat32(v2) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapUint64Float64V(rv2i(rv).(map[uint64]float64), e) } @@ -2589,18 +1638,18 @@ func (e *Encoder) fastpathEncMapIntIntfR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.encode(v[int(k2)]) + e.encode(v[k2]) } } else { for k2, v2 := range v { @@ -2618,18 +1667,18 @@ func (e *Encoder) fastpathEncMapIntStringR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeString(v[int(k2)]) + e.e.EncodeString(v[k2]) } } else { for k2, v2 := range v { @@ -2647,18 +1696,18 @@ func (e *Encoder) fastpathEncMapIntBytesR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntBytesV(v map[int][]byte, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeStringBytesRaw(v[int(k2)]) + e.e.EncodeStringBytesRaw(v[k2]) } } else { for k2, v2 := range v { @@ -2670,53 +1719,24 @@ func (fastpathT) EncMapIntBytesV(v map[int][]byte, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapIntUintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntUintV(rv2i(rv).(map[int]uint), e) -} -func (fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(int64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) - e.mapElemValue() - e.e.EncodeUint(uint64(v[int(k2)])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeInt(int64(k2)) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapIntUint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntUint8V(rv2i(rv).(map[int]uint8), e) } func (fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeUint(uint64(v[int(k2)])) + e.e.EncodeUint(uint64(v[k2])) } } else { for k2, v2 := range v { @@ -2734,18 +1754,18 @@ func (e *Encoder) fastpathEncMapIntUint64R(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeUint(v[int(k2)]) + e.e.EncodeUint(v[k2]) } } else { for k2, v2 := range v { @@ -2763,18 +1783,18 @@ func (e *Encoder) fastpathEncMapIntIntR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeInt(int64(v[int(k2)])) + e.e.EncodeInt(int64(v[k2])) } } else { for k2, v2 := range v { @@ -2792,18 +1812,18 @@ func (e *Encoder) fastpathEncMapIntInt64R(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeInt(v[int(k2)]) + e.e.EncodeInt(v[k2]) } } else { for k2, v2 := range v { @@ -2815,53 +1835,24 @@ func (fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapIntFloat32V(rv2i(rv).(map[int]float32), e) -} -func (fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = int64(k) - i++ - } - sort.Sort(int64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) - e.mapElemValue() - e.e.EncodeFloat32(v[int(k2)]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeInt(int64(k2)) - e.mapElemValue() - e.e.EncodeFloat32(v2) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapIntFloat64V(rv2i(rv).(map[int]float64), e) } func (fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeFloat64(v[int(k2)]) + e.e.EncodeFloat64(v[k2]) } } else { for k2, v2 := range v { @@ -2879,18 +1870,18 @@ func (e *Encoder) fastpathEncMapIntBoolR(f *codecFnInfo, rv reflect.Value) { func (fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { e.mapStart(len(v)) if e.h.Canonical { - v2 := make([]int64, len(v)) + v2 := make([]int, len(v)) var i uint for k := range v { - v2[i] = int64(k) + v2[i] = k i++ } - sort.Sort(int64Slice(v2)) + sort.Sort(intSlice(v2)) for _, k2 := range v2 { e.mapElemKey() - e.e.EncodeInt(int64(int(k2))) + e.e.EncodeInt(int64(k2)) e.mapElemValue() - e.e.EncodeBool(v[int(k2)]) + e.e.EncodeBool(v[k2]) } } else { for k2, v2 := range v { @@ -2989,35 +1980,6 @@ func (fastpathT) EncMapInt64BytesV(v map[int64][]byte, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapInt64UintR(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64UintV(rv2i(rv).(map[int64]uint), e) -} -func (fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = k - i++ - } - sort.Sort(int64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeInt(k2) - e.mapElemValue() - e.e.EncodeUint(uint64(v[k2])) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeInt(k2) - e.mapElemValue() - e.e.EncodeUint(uint64(v2)) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Uint8V(rv2i(rv).(map[int64]uint8), e) } @@ -3134,35 +2096,6 @@ func (fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) { } e.mapEnd() } -func (e *Encoder) fastpathEncMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { - fastpathTV.EncMapInt64Float32V(rv2i(rv).(map[int64]float32), e) -} -func (fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) { - e.mapStart(len(v)) - if e.h.Canonical { - v2 := make([]int64, len(v)) - var i uint - for k := range v { - v2[i] = k - i++ - } - sort.Sort(int64Slice(v2)) - for _, k2 := range v2 { - e.mapElemKey() - e.e.EncodeInt(k2) - e.mapElemValue() - e.e.EncodeFloat32(v[k2]) - } - } else { - for k2, v2 := range v { - e.mapElemKey() - e.e.EncodeInt(k2) - e.mapElemValue() - e.e.EncodeFloat32(v2) - } - } - e.mapEnd() -} func (e *Encoder) fastpathEncMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { fastpathTV.EncMapInt64Float64V(rv2i(rv).(map[int64]float64), e) } @@ -3250,13 +2183,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if v2, changed = fastpathTV.DecSliceBytesY(*v, d); changed { *v = v2 } - case []float32: - fastpathTV.DecSliceFloat32N(v, d) - case *[]float32: - var v2 []float32 - if v2, changed = fastpathTV.DecSliceFloat32Y(*v, d); changed { - *v = v2 - } case []float64: fastpathTV.DecSliceFloat64N(v, d) case *[]float64: @@ -3264,27 +2190,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if v2, changed = fastpathTV.DecSliceFloat64Y(*v, d); changed { *v = v2 } - case []uint: - fastpathTV.DecSliceUintN(v, d) - case *[]uint: - var v2 []uint - if v2, changed = fastpathTV.DecSliceUintY(*v, d); changed { - *v = v2 - } - case []uint16: - fastpathTV.DecSliceUint16N(v, d) - case *[]uint16: - var v2 []uint16 - if v2, changed = fastpathTV.DecSliceUint16Y(*v, d); changed { - *v = v2 - } - case []uint32: - fastpathTV.DecSliceUint32N(v, d) - case *[]uint32: - var v2 []uint32 - if v2, changed = fastpathTV.DecSliceUint32Y(*v, d); changed { - *v = v2 - } case []uint64: fastpathTV.DecSliceUint64N(v, d) case *[]uint64: @@ -3299,20 +2204,6 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { if v2, changed = fastpathTV.DecSliceIntY(*v, d); changed { *v = v2 } - case []int8: - fastpathTV.DecSliceInt8N(v, d) - case *[]int8: - var v2 []int8 - if v2, changed = fastpathTV.DecSliceInt8Y(*v, d); changed { - *v = v2 - } - case []int16: - fastpathTV.DecSliceInt16N(v, d) - case *[]int16: - var v2 []int16 - if v2, changed = fastpathTV.DecSliceInt16Y(*v, d); changed { - *v = v2 - } case []int32: fastpathTV.DecSliceInt32N(v, d) case *[]int32: @@ -3336,7 +2227,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case map[string]interface{}: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringIntfL(v, containerLen, d) } @@ -3346,7 +2237,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapStringIntfX(v, d) case map[string]string: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringStringL(v, containerLen, d) } @@ -3356,7 +2247,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapStringStringX(v, d) case map[string][]byte: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringBytesL(v, containerLen, d) } @@ -3364,19 +2255,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[string][]byte: fastpathTV.DecMapStringBytesX(v, d) - case map[string]uint: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapStringUintL(v, containerLen, d) - } - d.mapEnd() - } - case *map[string]uint: - fastpathTV.DecMapStringUintX(v, d) case map[string]uint8: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringUint8L(v, containerLen, d) } @@ -3386,7 +2267,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapStringUint8X(v, d) case map[string]uint64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringUint64L(v, containerLen, d) } @@ -3396,7 +2277,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapStringUint64X(v, d) case map[string]int: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringIntL(v, containerLen, d) } @@ -3406,7 +2287,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapStringIntX(v, d) case map[string]int64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringInt64L(v, containerLen, d) } @@ -3414,19 +2295,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[string]int64: fastpathTV.DecMapStringInt64X(v, d) - case map[string]float32: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapStringFloat32L(v, containerLen, d) - } - d.mapEnd() - } - case *map[string]float32: - fastpathTV.DecMapStringFloat32X(v, d) case map[string]float64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringFloat64L(v, containerLen, d) } @@ -3436,7 +2307,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapStringFloat64X(v, d) case map[string]bool: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapStringBoolL(v, containerLen, d) } @@ -3444,119 +2315,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[string]bool: fastpathTV.DecMapStringBoolX(v, d) - case map[uint]interface{}: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintIntfL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]interface{}: - fastpathTV.DecMapUintIntfX(v, d) - case map[uint]string: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintStringL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]string: - fastpathTV.DecMapUintStringX(v, d) - case map[uint][]byte: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintBytesL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint][]byte: - fastpathTV.DecMapUintBytesX(v, d) - case map[uint]uint: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintUintL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]uint: - fastpathTV.DecMapUintUintX(v, d) - case map[uint]uint8: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintUint8L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]uint8: - fastpathTV.DecMapUintUint8X(v, d) - case map[uint]uint64: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintUint64L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]uint64: - fastpathTV.DecMapUintUint64X(v, d) - case map[uint]int: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintIntL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]int: - fastpathTV.DecMapUintIntX(v, d) - case map[uint]int64: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintInt64L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]int64: - fastpathTV.DecMapUintInt64X(v, d) - case map[uint]float32: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintFloat32L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]float32: - fastpathTV.DecMapUintFloat32X(v, d) - case map[uint]float64: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintFloat64L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]float64: - fastpathTV.DecMapUintFloat64X(v, d) - case map[uint]bool: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUintBoolL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint]bool: - fastpathTV.DecMapUintBoolX(v, d) case map[uint8]interface{}: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8IntfL(v, containerLen, d) } @@ -3566,7 +2327,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8IntfX(v, d) case map[uint8]string: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8StringL(v, containerLen, d) } @@ -3576,7 +2337,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8StringX(v, d) case map[uint8][]byte: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8BytesL(v, containerLen, d) } @@ -3584,19 +2345,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[uint8][]byte: fastpathTV.DecMapUint8BytesX(v, d) - case map[uint8]uint: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUint8UintL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint8]uint: - fastpathTV.DecMapUint8UintX(v, d) case map[uint8]uint8: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8Uint8L(v, containerLen, d) } @@ -3606,7 +2357,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8Uint8X(v, d) case map[uint8]uint64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8Uint64L(v, containerLen, d) } @@ -3616,7 +2367,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8Uint64X(v, d) case map[uint8]int: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8IntL(v, containerLen, d) } @@ -3626,7 +2377,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8IntX(v, d) case map[uint8]int64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8Int64L(v, containerLen, d) } @@ -3634,19 +2385,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[uint8]int64: fastpathTV.DecMapUint8Int64X(v, d) - case map[uint8]float32: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUint8Float32L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint8]float32: - fastpathTV.DecMapUint8Float32X(v, d) case map[uint8]float64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8Float64L(v, containerLen, d) } @@ -3656,7 +2397,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8Float64X(v, d) case map[uint8]bool: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint8BoolL(v, containerLen, d) } @@ -3666,7 +2407,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint8BoolX(v, d) case map[uint64]interface{}: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64IntfL(v, containerLen, d) } @@ -3676,7 +2417,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64IntfX(v, d) case map[uint64]string: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64StringL(v, containerLen, d) } @@ -3686,7 +2427,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64StringX(v, d) case map[uint64][]byte: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64BytesL(v, containerLen, d) } @@ -3694,19 +2435,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[uint64][]byte: fastpathTV.DecMapUint64BytesX(v, d) - case map[uint64]uint: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUint64UintL(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint64]uint: - fastpathTV.DecMapUint64UintX(v, d) case map[uint64]uint8: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64Uint8L(v, containerLen, d) } @@ -3716,7 +2447,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64Uint8X(v, d) case map[uint64]uint64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64Uint64L(v, containerLen, d) } @@ -3726,7 +2457,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64Uint64X(v, d) case map[uint64]int: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64IntL(v, containerLen, d) } @@ -3736,7 +2467,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64IntX(v, d) case map[uint64]int64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64Int64L(v, containerLen, d) } @@ -3744,19 +2475,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[uint64]int64: fastpathTV.DecMapUint64Int64X(v, d) - case map[uint64]float32: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapUint64Float32L(v, containerLen, d) - } - d.mapEnd() - } - case *map[uint64]float32: - fastpathTV.DecMapUint64Float32X(v, d) case map[uint64]float64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64Float64L(v, containerLen, d) } @@ -3766,7 +2487,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64Float64X(v, d) case map[uint64]bool: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapUint64BoolL(v, containerLen, d) } @@ -3776,7 +2497,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapUint64BoolX(v, d) case map[int]interface{}: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntIntfL(v, containerLen, d) } @@ -3786,7 +2507,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntIntfX(v, d) case map[int]string: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntStringL(v, containerLen, d) } @@ -3796,7 +2517,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntStringX(v, d) case map[int][]byte: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntBytesL(v, containerLen, d) } @@ -3804,19 +2525,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[int][]byte: fastpathTV.DecMapIntBytesX(v, d) - case map[int]uint: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapIntUintL(v, containerLen, d) - } - d.mapEnd() - } - case *map[int]uint: - fastpathTV.DecMapIntUintX(v, d) case map[int]uint8: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntUint8L(v, containerLen, d) } @@ -3826,7 +2537,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntUint8X(v, d) case map[int]uint64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntUint64L(v, containerLen, d) } @@ -3836,7 +2547,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntUint64X(v, d) case map[int]int: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntIntL(v, containerLen, d) } @@ -3846,7 +2557,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntIntX(v, d) case map[int]int64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntInt64L(v, containerLen, d) } @@ -3854,19 +2565,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[int]int64: fastpathTV.DecMapIntInt64X(v, d) - case map[int]float32: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapIntFloat32L(v, containerLen, d) - } - d.mapEnd() - } - case *map[int]float32: - fastpathTV.DecMapIntFloat32X(v, d) case map[int]float64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntFloat64L(v, containerLen, d) } @@ -3876,7 +2577,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntFloat64X(v, d) case map[int]bool: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapIntBoolL(v, containerLen, d) } @@ -3886,7 +2587,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapIntBoolX(v, d) case map[int64]interface{}: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64IntfL(v, containerLen, d) } @@ -3896,7 +2597,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapInt64IntfX(v, d) case map[int64]string: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64StringL(v, containerLen, d) } @@ -3906,7 +2607,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapInt64StringX(v, d) case map[int64][]byte: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64BytesL(v, containerLen, d) } @@ -3914,19 +2615,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[int64][]byte: fastpathTV.DecMapInt64BytesX(v, d) - case map[int64]uint: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapInt64UintL(v, containerLen, d) - } - d.mapEnd() - } - case *map[int64]uint: - fastpathTV.DecMapInt64UintX(v, d) case map[int64]uint8: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64Uint8L(v, containerLen, d) } @@ -3936,7 +2627,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapInt64Uint8X(v, d) case map[int64]uint64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64Uint64L(v, containerLen, d) } @@ -3946,7 +2637,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapInt64Uint64X(v, d) case map[int64]int: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64IntL(v, containerLen, d) } @@ -3956,7 +2647,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapInt64IntX(v, d) case map[int64]int64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64Int64L(v, containerLen, d) } @@ -3964,19 +2655,9 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { } case *map[int64]int64: fastpathTV.DecMapInt64Int64X(v, d) - case map[int64]float32: - containerLen = d.mapStart() - if containerLen != decContainerLenNil { - if containerLen != 0 { - fastpathTV.DecMapInt64Float32L(v, containerLen, d) - } - d.mapEnd() - } - case *map[int64]float32: - fastpathTV.DecMapInt64Float32X(v, d) case map[int64]float64: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64Float64L(v, containerLen, d) } @@ -3986,7 +2667,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { fastpathTV.DecMapInt64Float64X(v, d) case map[int64]bool: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.DecMapInt64BoolL(v, containerLen, d) } @@ -4009,24 +2690,12 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *[][]byte: *v = nil - case *[]float32: - *v = nil case *[]float64: *v = nil - case *[]uint: - *v = nil - case *[]uint16: - *v = nil - case *[]uint32: - *v = nil case *[]uint64: *v = nil case *[]int: *v = nil - case *[]int8: - *v = nil - case *[]int16: - *v = nil case *[]int32: *v = nil case *[]int64: @@ -4040,8 +2709,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[string][]byte: *v = nil - case *map[string]uint: - *v = nil case *map[string]uint8: *v = nil case *map[string]uint64: @@ -4050,42 +2717,16 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[string]int64: *v = nil - case *map[string]float32: - *v = nil case *map[string]float64: *v = nil case *map[string]bool: *v = nil - case *map[uint]interface{}: - *v = nil - case *map[uint]string: - *v = nil - case *map[uint][]byte: - *v = nil - case *map[uint]uint: - *v = nil - case *map[uint]uint8: - *v = nil - case *map[uint]uint64: - *v = nil - case *map[uint]int: - *v = nil - case *map[uint]int64: - *v = nil - case *map[uint]float32: - *v = nil - case *map[uint]float64: - *v = nil - case *map[uint]bool: - *v = nil case *map[uint8]interface{}: *v = nil case *map[uint8]string: *v = nil case *map[uint8][]byte: *v = nil - case *map[uint8]uint: - *v = nil case *map[uint8]uint8: *v = nil case *map[uint8]uint64: @@ -4094,8 +2735,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[uint8]int64: *v = nil - case *map[uint8]float32: - *v = nil case *map[uint8]float64: *v = nil case *map[uint8]bool: @@ -4106,8 +2745,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[uint64][]byte: *v = nil - case *map[uint64]uint: - *v = nil case *map[uint64]uint8: *v = nil case *map[uint64]uint64: @@ -4116,8 +2753,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[uint64]int64: *v = nil - case *map[uint64]float32: - *v = nil case *map[uint64]float64: *v = nil case *map[uint64]bool: @@ -4128,8 +2763,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[int][]byte: *v = nil - case *map[int]uint: - *v = nil case *map[int]uint8: *v = nil case *map[int]uint64: @@ -4138,8 +2771,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[int]int64: *v = nil - case *map[int]float32: - *v = nil case *map[int]float64: *v = nil case *map[int]bool: @@ -4150,8 +2781,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[int64][]byte: *v = nil - case *map[int64]uint: - *v = nil case *map[int64]uint8: *v = nil case *map[int64]uint64: @@ -4160,8 +2789,6 @@ func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { *v = nil case *map[int64]int64: *v = nil - case *map[int64]float32: - *v = nil case *map[int64]float64: *v = nil case *map[int64]bool: @@ -4226,12 +2853,8 @@ func (fastpathT) DecSliceIntfY(v []interface{}, d *Decoder) (_ []interface{}, ch } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]interface{}, uint(xlen)) changed = true } @@ -4264,7 +2887,7 @@ func (fastpathT) DecSliceIntfN(v []interface{}, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -4323,12 +2946,8 @@ func (fastpathT) DecSliceStringY(v []string, d *Decoder) (_ []string, changed bo } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]string, uint(xlen)) changed = true } @@ -4361,7 +2980,7 @@ func (fastpathT) DecSliceStringN(v []string, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -4420,12 +3039,8 @@ func (fastpathT) DecSliceBytesY(v [][]byte, d *Decoder) (_ [][]byte, changed boo } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 24) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([][]byte, uint(xlen)) changed = true } @@ -4458,7 +3073,7 @@ func (fastpathT) DecSliceBytesN(v [][]byte, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -4467,103 +3082,6 @@ func (fastpathT) DecSliceBytesN(v [][]byte, d *Decoder) { slh.End() } -func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) { - if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*[]float32) - if v, changed := fastpathTV.DecSliceFloat32Y(*vp, d); changed { - *vp = v - } - } else { - fastpathTV.DecSliceFloat32N(rv2i(rv).([]float32), d) - } -} -func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) { - if v, changed := f.DecSliceFloat32Y(*vp, d); changed { - *vp = v - } -} -func (fastpathT) DecSliceFloat32Y(v []float32, d *Decoder) (_ []float32, changed bool) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - if v == nil { - return - } - return nil, true - } - if containerLenS == 0 { - if v == nil { - v = []float32{} - } else if len(v) != 0 { - v = v[:0] - } - slh.End() - return v, true - } - hasLen := containerLenS > 0 - var xlen int - if hasLen { - if containerLenS > cap(v) { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) - if xlen <= cap(v) { - v = v[:uint(xlen)] - } else { - v = make([]float32, uint(xlen)) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) - } else { - xlen = 8 - } - v = make([]float32, uint(xlen)) - changed = true - } - if j >= len(v) { - v = append(v, 0) - changed = true - } - slh.ElemContainerState(j) - v[uint(j)] = float32(d.decodeFloat32()) - } - if j < len(v) { - v = v[:uint(j)] - changed = true - } else if j == 0 && v == nil { - v = []float32{} - changed = true - } - slh.End() - return v, changed -} -func (fastpathT) DecSliceFloat32N(v []float32, d *Decoder) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - return - } - if containerLenS == 0 { - slh.End() - return - } - hasLen := containerLenS > 0 - for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) - return - } - slh.ElemContainerState(j) - v[uint(j)] = float32(d.decodeFloat32()) - } - slh.End() -} - func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) { if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]float64) @@ -4614,12 +3132,8 @@ func (fastpathT) DecSliceFloat64Y(v []float64, d *Decoder) (_ []float64, changed } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]float64, uint(xlen)) changed = true } @@ -4652,7 +3166,7 @@ func (fastpathT) DecSliceFloat64N(v []float64, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -4661,297 +3175,6 @@ func (fastpathT) DecSliceFloat64N(v []float64, d *Decoder) { slh.End() } -func (d *Decoder) fastpathDecSliceUintR(f *codecFnInfo, rv reflect.Value) { - if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*[]uint) - if v, changed := fastpathTV.DecSliceUintY(*vp, d); changed { - *vp = v - } - } else { - fastpathTV.DecSliceUintN(rv2i(rv).([]uint), d) - } -} -func (f fastpathT) DecSliceUintX(vp *[]uint, d *Decoder) { - if v, changed := f.DecSliceUintY(*vp, d); changed { - *vp = v - } -} -func (fastpathT) DecSliceUintY(v []uint, d *Decoder) (_ []uint, changed bool) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - if v == nil { - return - } - return nil, true - } - if containerLenS == 0 { - if v == nil { - v = []uint{} - } else if len(v) != 0 { - v = v[:0] - } - slh.End() - return v, true - } - hasLen := containerLenS > 0 - var xlen int - if hasLen { - if containerLenS > cap(v) { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xlen <= cap(v) { - v = v[:uint(xlen)] - } else { - v = make([]uint, uint(xlen)) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) - } else { - xlen = 8 - } - v = make([]uint, uint(xlen)) - changed = true - } - if j >= len(v) { - v = append(v, 0) - changed = true - } - slh.ElemContainerState(j) - v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - } - if j < len(v) { - v = v[:uint(j)] - changed = true - } else if j == 0 && v == nil { - v = []uint{} - changed = true - } - slh.End() - return v, changed -} -func (fastpathT) DecSliceUintN(v []uint, d *Decoder) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - return - } - if containerLenS == 0 { - slh.End() - return - } - hasLen := containerLenS > 0 - for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) - return - } - slh.ElemContainerState(j) - v[uint(j)] = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - } - slh.End() -} - -func (d *Decoder) fastpathDecSliceUint16R(f *codecFnInfo, rv reflect.Value) { - if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*[]uint16) - if v, changed := fastpathTV.DecSliceUint16Y(*vp, d); changed { - *vp = v - } - } else { - fastpathTV.DecSliceUint16N(rv2i(rv).([]uint16), d) - } -} -func (f fastpathT) DecSliceUint16X(vp *[]uint16, d *Decoder) { - if v, changed := f.DecSliceUint16Y(*vp, d); changed { - *vp = v - } -} -func (fastpathT) DecSliceUint16Y(v []uint16, d *Decoder) (_ []uint16, changed bool) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - if v == nil { - return - } - return nil, true - } - if containerLenS == 0 { - if v == nil { - v = []uint16{} - } else if len(v) != 0 { - v = v[:0] - } - slh.End() - return v, true - } - hasLen := containerLenS > 0 - var xlen int - if hasLen { - if containerLenS > cap(v) { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) - if xlen <= cap(v) { - v = v[:uint(xlen)] - } else { - v = make([]uint16, uint(xlen)) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) - } else { - xlen = 8 - } - v = make([]uint16, uint(xlen)) - changed = true - } - if j >= len(v) { - v = append(v, 0) - changed = true - } - slh.ElemContainerState(j) - v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) - } - if j < len(v) { - v = v[:uint(j)] - changed = true - } else if j == 0 && v == nil { - v = []uint16{} - changed = true - } - slh.End() - return v, changed -} -func (fastpathT) DecSliceUint16N(v []uint16, d *Decoder) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - return - } - if containerLenS == 0 { - slh.End() - return - } - hasLen := containerLenS > 0 - for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) - return - } - slh.ElemContainerState(j) - v[uint(j)] = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) - } - slh.End() -} - -func (d *Decoder) fastpathDecSliceUint32R(f *codecFnInfo, rv reflect.Value) { - if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*[]uint32) - if v, changed := fastpathTV.DecSliceUint32Y(*vp, d); changed { - *vp = v - } - } else { - fastpathTV.DecSliceUint32N(rv2i(rv).([]uint32), d) - } -} -func (f fastpathT) DecSliceUint32X(vp *[]uint32, d *Decoder) { - if v, changed := f.DecSliceUint32Y(*vp, d); changed { - *vp = v - } -} -func (fastpathT) DecSliceUint32Y(v []uint32, d *Decoder) (_ []uint32, changed bool) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - if v == nil { - return - } - return nil, true - } - if containerLenS == 0 { - if v == nil { - v = []uint32{} - } else if len(v) != 0 { - v = v[:0] - } - slh.End() - return v, true - } - hasLen := containerLenS > 0 - var xlen int - if hasLen { - if containerLenS > cap(v) { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) - if xlen <= cap(v) { - v = v[:uint(xlen)] - } else { - v = make([]uint32, uint(xlen)) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) - } else { - xlen = 8 - } - v = make([]uint32, uint(xlen)) - changed = true - } - if j >= len(v) { - v = append(v, 0) - changed = true - } - slh.ElemContainerState(j) - v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) - } - if j < len(v) { - v = v[:uint(j)] - changed = true - } else if j == 0 && v == nil { - v = []uint32{} - changed = true - } - slh.End() - return v, changed -} -func (fastpathT) DecSliceUint32N(v []uint32, d *Decoder) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - return - } - if containerLenS == 0 { - slh.End() - return - } - hasLen := containerLenS > 0 - for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) - return - } - slh.ElemContainerState(j) - v[uint(j)] = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) - } - slh.End() -} - func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) { if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]uint64) @@ -5002,12 +3225,8 @@ func (fastpathT) DecSliceUint64Y(v []uint64, d *Decoder) (_ []uint64, changed bo } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]uint64, uint(xlen)) changed = true } @@ -5040,7 +3259,7 @@ func (fastpathT) DecSliceUint64N(v []uint64, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -5099,12 +3318,8 @@ func (fastpathT) DecSliceIntY(v []int, d *Decoder) (_ []int, changed bool) { } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]int, uint(xlen)) changed = true } @@ -5137,7 +3352,7 @@ func (fastpathT) DecSliceIntN(v []int, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -5146,200 +3361,6 @@ func (fastpathT) DecSliceIntN(v []int, d *Decoder) { slh.End() } -func (d *Decoder) fastpathDecSliceInt8R(f *codecFnInfo, rv reflect.Value) { - if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*[]int8) - if v, changed := fastpathTV.DecSliceInt8Y(*vp, d); changed { - *vp = v - } - } else { - fastpathTV.DecSliceInt8N(rv2i(rv).([]int8), d) - } -} -func (f fastpathT) DecSliceInt8X(vp *[]int8, d *Decoder) { - if v, changed := f.DecSliceInt8Y(*vp, d); changed { - *vp = v - } -} -func (fastpathT) DecSliceInt8Y(v []int8, d *Decoder) (_ []int8, changed bool) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - if v == nil { - return - } - return nil, true - } - if containerLenS == 0 { - if v == nil { - v = []int8{} - } else if len(v) != 0 { - v = v[:0] - } - slh.End() - return v, true - } - hasLen := containerLenS > 0 - var xlen int - if hasLen { - if containerLenS > cap(v) { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) - if xlen <= cap(v) { - v = v[:uint(xlen)] - } else { - v = make([]int8, uint(xlen)) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) - } else { - xlen = 8 - } - v = make([]int8, uint(xlen)) - changed = true - } - if j >= len(v) { - v = append(v, 0) - changed = true - } - slh.ElemContainerState(j) - v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) - } - if j < len(v) { - v = v[:uint(j)] - changed = true - } else if j == 0 && v == nil { - v = []int8{} - changed = true - } - slh.End() - return v, changed -} -func (fastpathT) DecSliceInt8N(v []int8, d *Decoder) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - return - } - if containerLenS == 0 { - slh.End() - return - } - hasLen := containerLenS > 0 - for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) - return - } - slh.ElemContainerState(j) - v[uint(j)] = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) - } - slh.End() -} - -func (d *Decoder) fastpathDecSliceInt16R(f *codecFnInfo, rv reflect.Value) { - if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { - vp := rv2i(rv).(*[]int16) - if v, changed := fastpathTV.DecSliceInt16Y(*vp, d); changed { - *vp = v - } - } else { - fastpathTV.DecSliceInt16N(rv2i(rv).([]int16), d) - } -} -func (f fastpathT) DecSliceInt16X(vp *[]int16, d *Decoder) { - if v, changed := f.DecSliceInt16Y(*vp, d); changed { - *vp = v - } -} -func (fastpathT) DecSliceInt16Y(v []int16, d *Decoder) (_ []int16, changed bool) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - if v == nil { - return - } - return nil, true - } - if containerLenS == 0 { - if v == nil { - v = []int16{} - } else if len(v) != 0 { - v = v[:0] - } - slh.End() - return v, true - } - hasLen := containerLenS > 0 - var xlen int - if hasLen { - if containerLenS > cap(v) { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) - if xlen <= cap(v) { - v = v[:uint(xlen)] - } else { - v = make([]int16, uint(xlen)) - } - changed = true - } else if containerLenS != len(v) { - v = v[:containerLenS] - changed = true - } - } - var j int - for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) - } else { - xlen = 8 - } - v = make([]int16, uint(xlen)) - changed = true - } - if j >= len(v) { - v = append(v, 0) - changed = true - } - slh.ElemContainerState(j) - v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) - } - if j < len(v) { - v = v[:uint(j)] - changed = true - } else if j == 0 && v == nil { - v = []int16{} - changed = true - } - slh.End() - return v, changed -} -func (fastpathT) DecSliceInt16N(v []int16, d *Decoder) { - slh, containerLenS := d.decSliceHelperStart() - if slh.IsNil { - return - } - if containerLenS == 0 { - slh.End() - return - } - hasLen := containerLenS > 0 - for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) - return - } - slh.ElemContainerState(j) - v[uint(j)] = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) - } - slh.End() -} - func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) { if f.seq != seqTypeArray && rv.Kind() == reflect.Ptr { vp := rv2i(rv).(*[]int32) @@ -5390,12 +3411,8 @@ func (fastpathT) DecSliceInt32Y(v []int32, d *Decoder) (_ []int32, changed bool) } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]int32, uint(xlen)) changed = true } @@ -5428,7 +3445,7 @@ func (fastpathT) DecSliceInt32N(v []int32, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -5487,12 +3504,8 @@ func (fastpathT) DecSliceInt64Y(v []int64, d *Decoder) (_ []int64, changed bool) } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]int64, uint(xlen)) changed = true } @@ -5525,7 +3538,7 @@ func (fastpathT) DecSliceInt64N(v []int64, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -5584,12 +3597,8 @@ func (fastpathT) DecSliceBoolY(v []bool, d *Decoder) (_ []bool, changed bool) { } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]bool, uint(xlen)) changed = true } @@ -5622,7 +3631,7 @@ func (fastpathT) DecSliceBoolN(v []bool, d *Decoder) { hasLen := containerLenS > 0 for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -5630,42 +3639,24 @@ func (fastpathT) DecSliceBoolN(v []bool, d *Decoder) { } slh.End() } -func fastpathDecArrayCannotExpand(slh decSliceHelper, hasLen bool, lenv, j, containerLenS int) { - slh.d.arrayCannotExpand(lenv, j+1) - slh.ElemContainerState(j) - slh.d.swallow() - j++ - for ; (hasLen && j < containerLenS) || !(hasLen || slh.d.checkBreak()); j++ { - slh.ElemContainerState(j) - slh.d.swallow() - } - slh.End() -} - func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]interface{})) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]interface{}) + if *vp == nil { + *vp = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]interface{}) - if *vp == nil { - *vp = make(map[string]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - fastpathTV.DecMapStringIntfL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringIntfL(rv2i(rv).(map[string]interface{}), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringIntfL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringIntfL(rv2i(rv).(map[string]interface{}), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -5699,28 +3690,22 @@ func (fastpathT) DecMapStringIntfL(v map[string]interface{}, containerLen int, d } func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]string)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]string) + if *vp == nil { + *vp = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]string) - if *vp == nil { - *vp = make(map[string]string, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - fastpathTV.DecMapStringStringL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringStringL(rv2i(rv).(map[string]string), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringStringL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringStringL(rv2i(rv).(map[string]string), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -5748,28 +3733,22 @@ func (fastpathT) DecMapStringStringL(v map[string]string, containerLen int, d *D } func (d *Decoder) fastpathDecMapStringBytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string][]byte)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string][]byte) + if *vp == nil { + *vp = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string][]byte) - if *vp == nil { - *vp = make(map[string][]byte, decInferLen(containerLen, d.h.MaxInitLen, 40)) - } - if containerLen != 0 { - fastpathTV.DecMapStringBytesL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringBytesL(rv2i(rv).(map[string][]byte), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringBytesL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringBytesL(rv2i(rv).(map[string][]byte), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringBytesX(vp *map[string][]byte, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -5801,79 +3780,24 @@ func (fastpathT) DecMapStringBytesL(v map[string][]byte, containerLen int, d *De } } } -func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]uint)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]uint) - if *vp == nil { - *vp = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapStringUintL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringUintL(rv2i(rv).(map[string]uint), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapStringUintX(vp *map[string]uint, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[string]uint, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - f.DecMapStringUintL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapStringUintL(v map[string]uint, containerLen int, d *Decoder) { - var mk string - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = string(d.d.DecodeStringAsBytes()) - d.mapElemValue() - mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]uint8)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]uint8) + if *vp == nil { + *vp = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]uint8) - if *vp == nil { - *vp = make(map[string]uint8, decInferLen(containerLen, d.h.MaxInitLen, 17)) - } - if containerLen != 0 { - fastpathTV.DecMapStringUint8L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringUint8L(rv2i(rv).(map[string]uint8), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringUint8L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringUint8L(rv2i(rv).(map[string]uint8), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -5901,28 +3825,22 @@ func (fastpathT) DecMapStringUint8L(v map[string]uint8, containerLen int, d *Dec } func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]uint64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]uint64) + if *vp == nil { + *vp = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]uint64) - if *vp == nil { - *vp = make(map[string]uint64, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapStringUint64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringUint64L(rv2i(rv).(map[string]uint64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringUint64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringUint64L(rv2i(rv).(map[string]uint64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -5950,28 +3868,22 @@ func (fastpathT) DecMapStringUint64L(v map[string]uint64, containerLen int, d *D } func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]int)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]int) + if *vp == nil { + *vp = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]int) - if *vp == nil { - *vp = make(map[string]int, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapStringIntL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringIntL(rv2i(rv).(map[string]int), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringIntL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringIntL(rv2i(rv).(map[string]int), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -5999,28 +3911,22 @@ func (fastpathT) DecMapStringIntL(v map[string]int, containerLen int, d *Decoder } func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]int64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]int64) + if *vp == nil { + *vp = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]int64) - if *vp == nil { - *vp = make(map[string]int64, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapStringInt64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringInt64L(rv2i(rv).(map[string]int64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringInt64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringInt64L(rv2i(rv).(map[string]int64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -6046,79 +3952,24 @@ func (fastpathT) DecMapStringInt64L(v map[string]int64, containerLen int, d *Dec } } } -func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]float32)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]float32) - if *vp == nil { - *vp = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20)) - } - if containerLen != 0 { - fastpathTV.DecMapStringFloat32L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringFloat32L(rv2i(rv).(map[string]float32), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[string]float32, decInferLen(containerLen, d.h.MaxInitLen, 20)) - } - if containerLen != 0 { - f.DecMapStringFloat32L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapStringFloat32L(v map[string]float32, containerLen int, d *Decoder) { - var mk string - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = string(d.d.DecodeStringAsBytes()) - d.mapElemValue() - mv = float32(d.decodeFloat32()) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]float64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]float64) + if *vp == nil { + *vp = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]float64) - if *vp == nil { - *vp = make(map[string]float64, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapStringFloat64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringFloat64L(rv2i(rv).(map[string]float64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringFloat64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringFloat64L(rv2i(rv).(map[string]float64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -6146,28 +3997,22 @@ func (fastpathT) DecMapStringFloat64L(v map[string]float64, containerLen int, d } func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[string]bool)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[string]bool) + if *vp == nil { + *vp = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[string]bool) - if *vp == nil { - *vp = make(map[string]bool, decInferLen(containerLen, d.h.MaxInitLen, 17)) - } - if containerLen != 0 { - fastpathTV.DecMapStringBoolL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapStringBoolL(rv2i(rv).(map[string]bool), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapStringBoolL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapStringBoolL(rv2i(rv).(map[string]bool), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -6193,581 +4038,24 @@ func (fastpathT) DecMapStringBoolL(v map[string]bool, containerLen int, d *Decod } } } -func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]interface{})) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]interface{}) - if *vp == nil { - *vp = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapUintIntfL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintIntfL(rv2i(rv).(map[uint]interface{}), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - f.DecMapUintIntfL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintIntfL(v map[uint]interface{}, containerLen int, d *Decoder) { - mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset - var mk uint - var mv interface{} - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]string)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]string) - if *vp == nil { - *vp = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapUintStringL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintStringL(rv2i(rv).(map[uint]string), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintStringX(vp *map[uint]string, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - f.DecMapUintStringL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintStringL(v map[uint]string, containerLen int, d *Decoder) { - var mk uint - var mv string - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = string(d.d.DecodeStringAsBytes()) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintBytesR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint][]byte)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint][]byte) - if *vp == nil { - *vp = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - fastpathTV.DecMapUintBytesL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintBytesL(rv2i(rv).(map[uint][]byte), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintBytesX(vp *map[uint][]byte, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - f.DecMapUintBytesL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintBytesL(v map[uint][]byte, containerLen int, d *Decoder) { - mapGet := v != nil && !d.h.MapValueReset - var mk uint - var mv []byte - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - if mapGet { - mv = v[mk] - } else { - mv = nil - } - mv = d.d.DecodeBytes(mv, false) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]uint)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]uint) - if *vp == nil { - *vp = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUintUintL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintUintL(rv2i(rv).(map[uint]uint), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapUintUintL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintUintL(v map[uint]uint, containerLen int, d *Decoder) { - var mk uint - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]uint8)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]uint8) - if *vp == nil { - *vp = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUintUint8L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintUint8L(rv2i(rv).(map[uint]uint8), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - f.DecMapUintUint8L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintUint8L(v map[uint]uint8, containerLen int, d *Decoder) { - var mk uint - var mv uint8 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]uint64)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]uint64) - if *vp == nil { - *vp = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUintUint64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintUint64L(rv2i(rv).(map[uint]uint64), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapUintUint64L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintUint64L(v map[uint]uint64, containerLen int, d *Decoder) { - var mk uint - var mv uint64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = d.d.DecodeUint64() - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]int)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]int) - if *vp == nil { - *vp = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUintIntL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintIntL(rv2i(rv).(map[uint]int), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintIntX(vp *map[uint]int, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapUintIntL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintIntL(v map[uint]int, containerLen int, d *Decoder) { - var mk uint - var mv int - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]int64)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]int64) - if *vp == nil { - *vp = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUintInt64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintInt64L(rv2i(rv).(map[uint]int64), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapUintInt64L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintInt64L(v map[uint]int64, containerLen int, d *Decoder) { - var mk uint - var mv int64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = d.d.DecodeInt64() - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]float32)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]float32) - if *vp == nil { - *vp = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - fastpathTV.DecMapUintFloat32L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintFloat32L(rv2i(rv).(map[uint]float32), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - f.DecMapUintFloat32L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintFloat32L(v map[uint]float32, containerLen int, d *Decoder) { - var mk uint - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = float32(d.decodeFloat32()) - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]float64)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]float64) - if *vp == nil { - *vp = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUintFloat64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintFloat64L(rv2i(rv).(map[uint]float64), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapUintFloat64L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintFloat64L(v map[uint]float64, containerLen int, d *Decoder) { - var mk uint - var mv float64 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = d.d.DecodeFloat64() - if v != nil { - v[mk] = mv - } - } -} -func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint]bool)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint]bool) - if *vp == nil { - *vp = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUintBoolL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUintBoolL(rv2i(rv).(map[uint]bool), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - f.DecMapUintBoolL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUintBoolL(v map[uint]bool, containerLen int, d *Decoder) { - var mk uint - var mv bool - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - d.mapElemValue() - mv = d.d.DecodeBool() - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]interface{})) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]interface{}) + if *vp == nil { + *vp = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]interface{}) - if *vp == nil { - *vp = make(map[uint8]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 17)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8IntfL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8IntfL(rv2i(rv).(map[uint8]interface{}), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8IntfL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8IntfL(rv2i(rv).(map[uint8]interface{}), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -6801,28 +4089,22 @@ func (fastpathT) DecMapUint8IntfL(v map[uint8]interface{}, containerLen int, d * } func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]string)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]string) + if *vp == nil { + *vp = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]string) - if *vp == nil { - *vp = make(map[uint8]string, decInferLen(containerLen, d.h.MaxInitLen, 17)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8StringL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8StringL(rv2i(rv).(map[uint8]string), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8StringL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8StringL(rv2i(rv).(map[uint8]string), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -6850,28 +4132,22 @@ func (fastpathT) DecMapUint8StringL(v map[uint8]string, containerLen int, d *Dec } func (d *Decoder) fastpathDecMapUint8BytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8][]byte)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8][]byte) + if *vp == nil { + *vp = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8][]byte) - if *vp == nil { - *vp = make(map[uint8][]byte, decInferLen(containerLen, d.h.MaxInitLen, 25)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8BytesL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8BytesL(rv2i(rv).(map[uint8][]byte), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8BytesL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8BytesL(rv2i(rv).(map[uint8][]byte), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8BytesX(vp *map[uint8][]byte, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -6903,79 +4179,24 @@ func (fastpathT) DecMapUint8BytesL(v map[uint8][]byte, containerLen int, d *Deco } } } -func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]uint)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]uint) - if *vp == nil { - *vp = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8UintL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8UintL(rv2i(rv).(map[uint8]uint), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint8]uint, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - f.DecMapUint8UintL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUint8UintL(v map[uint8]uint, containerLen int, d *Decoder) { - var mk uint8 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) - d.mapElemValue() - mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]uint8)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]uint8) + if *vp == nil { + *vp = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]uint8) - if *vp == nil { - *vp = make(map[uint8]uint8, decInferLen(containerLen, d.h.MaxInitLen, 2)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8Uint8L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8Uint8L(rv2i(rv).(map[uint8]uint8), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8Uint8L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8Uint8L(rv2i(rv).(map[uint8]uint8), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7003,28 +4224,22 @@ func (fastpathT) DecMapUint8Uint8L(v map[uint8]uint8, containerLen int, d *Decod } func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]uint64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]uint64) + if *vp == nil { + *vp = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]uint64) - if *vp == nil { - *vp = make(map[uint8]uint64, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8Uint64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8Uint64L(rv2i(rv).(map[uint8]uint64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8Uint64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8Uint64L(rv2i(rv).(map[uint8]uint64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7052,28 +4267,22 @@ func (fastpathT) DecMapUint8Uint64L(v map[uint8]uint64, containerLen int, d *Dec } func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]int)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]int) + if *vp == nil { + *vp = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]int) - if *vp == nil { - *vp = make(map[uint8]int, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8IntL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8IntL(rv2i(rv).(map[uint8]int), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8IntL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8IntL(rv2i(rv).(map[uint8]int), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7101,28 +4310,22 @@ func (fastpathT) DecMapUint8IntL(v map[uint8]int, containerLen int, d *Decoder) } func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]int64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]int64) + if *vp == nil { + *vp = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]int64) - if *vp == nil { - *vp = make(map[uint8]int64, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8Int64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8Int64L(rv2i(rv).(map[uint8]int64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8Int64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8Int64L(rv2i(rv).(map[uint8]int64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7148,79 +4351,24 @@ func (fastpathT) DecMapUint8Int64L(v map[uint8]int64, containerLen int, d *Decod } } } -func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]float32)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]float32) - if *vp == nil { - *vp = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8Float32L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8Float32L(rv2i(rv).(map[uint8]float32), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint8]float32, decInferLen(containerLen, d.h.MaxInitLen, 5)) - } - if containerLen != 0 { - f.DecMapUint8Float32L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUint8Float32L(v map[uint8]float32, containerLen int, d *Decoder) { - var mk uint8 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) - d.mapElemValue() - mv = float32(d.decodeFloat32()) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]float64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]float64) + if *vp == nil { + *vp = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]float64) - if *vp == nil { - *vp = make(map[uint8]float64, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8Float64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8Float64L(rv2i(rv).(map[uint8]float64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8Float64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8Float64L(rv2i(rv).(map[uint8]float64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7248,28 +4396,22 @@ func (fastpathT) DecMapUint8Float64L(v map[uint8]float64, containerLen int, d *D } func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint8]bool)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint8]bool) + if *vp == nil { + *vp = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint8]bool) - if *vp == nil { - *vp = make(map[uint8]bool, decInferLen(containerLen, d.h.MaxInitLen, 2)) - } - if containerLen != 0 { - fastpathTV.DecMapUint8BoolL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint8BoolL(rv2i(rv).(map[uint8]bool), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint8BoolL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint8BoolL(rv2i(rv).(map[uint8]bool), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7297,28 +4439,22 @@ func (fastpathT) DecMapUint8BoolL(v map[uint8]bool, containerLen int, d *Decoder } func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]interface{})) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]interface{}) + if *vp == nil { + *vp = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]interface{}) - if *vp == nil { - *vp = make(map[uint64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64IntfL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64IntfL(rv2i(rv).(map[uint64]interface{}), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64IntfL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64IntfL(rv2i(rv).(map[uint64]interface{}), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7352,28 +4488,22 @@ func (fastpathT) DecMapUint64IntfL(v map[uint64]interface{}, containerLen int, d } func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]string)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]string) + if *vp == nil { + *vp = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]string) - if *vp == nil { - *vp = make(map[uint64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64StringL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64StringL(rv2i(rv).(map[uint64]string), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64StringL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64StringL(rv2i(rv).(map[uint64]string), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7401,28 +4531,22 @@ func (fastpathT) DecMapUint64StringL(v map[uint64]string, containerLen int, d *D } func (d *Decoder) fastpathDecMapUint64BytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64][]byte)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64][]byte) + if *vp == nil { + *vp = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64][]byte) - if *vp == nil { - *vp = make(map[uint64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64BytesL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64BytesL(rv2i(rv).(map[uint64][]byte), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64BytesL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64BytesL(rv2i(rv).(map[uint64][]byte), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64BytesX(vp *map[uint64][]byte, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7454,79 +4578,24 @@ func (fastpathT) DecMapUint64BytesL(v map[uint64][]byte, containerLen int, d *De } } } -func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]uint)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]uint) - if *vp == nil { - *vp = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64UintL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64UintL(rv2i(rv).(map[uint64]uint), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapUint64UintL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUint64UintL(v map[uint64]uint, containerLen int, d *Decoder) { - var mk uint64 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = d.d.DecodeUint64() - d.mapElemValue() - mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]uint8)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]uint8) + if *vp == nil { + *vp = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]uint8) - if *vp == nil { - *vp = make(map[uint64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64Uint8L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64Uint8L(rv2i(rv).(map[uint64]uint8), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64Uint8L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64Uint8L(rv2i(rv).(map[uint64]uint8), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7554,28 +4623,22 @@ func (fastpathT) DecMapUint64Uint8L(v map[uint64]uint8, containerLen int, d *Dec } func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]uint64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]uint64) + if *vp == nil { + *vp = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]uint64) - if *vp == nil { - *vp = make(map[uint64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64Uint64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64Uint64L(rv2i(rv).(map[uint64]uint64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64Uint64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64Uint64L(rv2i(rv).(map[uint64]uint64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7603,28 +4666,22 @@ func (fastpathT) DecMapUint64Uint64L(v map[uint64]uint64, containerLen int, d *D } func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]int)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]int) + if *vp == nil { + *vp = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]int) - if *vp == nil { - *vp = make(map[uint64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64IntL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64IntL(rv2i(rv).(map[uint64]int), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64IntL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64IntL(rv2i(rv).(map[uint64]int), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7652,28 +4709,22 @@ func (fastpathT) DecMapUint64IntL(v map[uint64]int, containerLen int, d *Decoder } func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]int64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]int64) + if *vp == nil { + *vp = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]int64) - if *vp == nil { - *vp = make(map[uint64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64Int64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64Int64L(rv2i(rv).(map[uint64]int64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64Int64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64Int64L(rv2i(rv).(map[uint64]int64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7699,79 +4750,24 @@ func (fastpathT) DecMapUint64Int64L(v map[uint64]int64, containerLen int, d *Dec } } } -func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]float32)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]float32) - if *vp == nil { - *vp = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64Float32L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64Float32L(rv2i(rv).(map[uint64]float32), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[uint64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - f.DecMapUint64Float32L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapUint64Float32L(v map[uint64]float32, containerLen int, d *Decoder) { - var mk uint64 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = d.d.DecodeUint64() - d.mapElemValue() - mv = float32(d.decodeFloat32()) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]float64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]float64) + if *vp == nil { + *vp = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]float64) - if *vp == nil { - *vp = make(map[uint64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64Float64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64Float64L(rv2i(rv).(map[uint64]float64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64Float64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64Float64L(rv2i(rv).(map[uint64]float64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7799,28 +4795,22 @@ func (fastpathT) DecMapUint64Float64L(v map[uint64]float64, containerLen int, d } func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[uint64]bool)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[uint64]bool) + if *vp == nil { + *vp = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[uint64]bool) - if *vp == nil { - *vp = make(map[uint64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapUint64BoolL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapUint64BoolL(rv2i(rv).(map[uint64]bool), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapUint64BoolL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapUint64BoolL(rv2i(rv).(map[uint64]bool), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7848,28 +4838,22 @@ func (fastpathT) DecMapUint64BoolL(v map[uint64]bool, containerLen int, d *Decod } func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]interface{})) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]interface{}) + if *vp == nil { + *vp = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]interface{}) - if *vp == nil { - *vp = make(map[int]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapIntIntfL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntIntfL(rv2i(rv).(map[int]interface{}), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntIntfL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntIntfL(rv2i(rv).(map[int]interface{}), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7903,28 +4887,22 @@ func (fastpathT) DecMapIntIntfL(v map[int]interface{}, containerLen int, d *Deco } func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]string)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]string) + if *vp == nil { + *vp = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]string) - if *vp == nil { - *vp = make(map[int]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapIntStringL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntStringL(rv2i(rv).(map[int]string), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntStringL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntStringL(rv2i(rv).(map[int]string), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -7952,28 +4930,22 @@ func (fastpathT) DecMapIntStringL(v map[int]string, containerLen int, d *Decoder } func (d *Decoder) fastpathDecMapIntBytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int][]byte)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int][]byte) + if *vp == nil { + *vp = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int][]byte) - if *vp == nil { - *vp = make(map[int][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - fastpathTV.DecMapIntBytesL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntBytesL(rv2i(rv).(map[int][]byte), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntBytesL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntBytesL(rv2i(rv).(map[int][]byte), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntBytesX(vp *map[int][]byte, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8005,79 +4977,24 @@ func (fastpathT) DecMapIntBytesL(v map[int][]byte, containerLen int, d *Decoder) } } } -func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]uint)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]uint) - if *vp == nil { - *vp = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapIntUintL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntUintL(rv2i(rv).(map[int]uint), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapIntUintX(vp *map[int]uint, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[int]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapIntUintL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapIntUintL(v map[int]uint, containerLen int, d *Decoder) { - var mk int - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) - d.mapElemValue() - mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]uint8)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]uint8) + if *vp == nil { + *vp = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]uint8) - if *vp == nil { - *vp = make(map[int]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapIntUint8L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntUint8L(rv2i(rv).(map[int]uint8), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntUint8L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntUint8L(rv2i(rv).(map[int]uint8), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8105,28 +5022,22 @@ func (fastpathT) DecMapIntUint8L(v map[int]uint8, containerLen int, d *Decoder) } func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]uint64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]uint64) + if *vp == nil { + *vp = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]uint64) - if *vp == nil { - *vp = make(map[int]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapIntUint64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntUint64L(rv2i(rv).(map[int]uint64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntUint64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntUint64L(rv2i(rv).(map[int]uint64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8154,28 +5065,22 @@ func (fastpathT) DecMapIntUint64L(v map[int]uint64, containerLen int, d *Decoder } func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]int)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]int) + if *vp == nil { + *vp = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]int) - if *vp == nil { - *vp = make(map[int]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapIntIntL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntIntL(rv2i(rv).(map[int]int), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntIntL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntIntL(rv2i(rv).(map[int]int), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8203,28 +5108,22 @@ func (fastpathT) DecMapIntIntL(v map[int]int, containerLen int, d *Decoder) { } func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]int64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]int64) + if *vp == nil { + *vp = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]int64) - if *vp == nil { - *vp = make(map[int]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapIntInt64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntInt64L(rv2i(rv).(map[int]int64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntInt64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntInt64L(rv2i(rv).(map[int]int64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8250,79 +5149,24 @@ func (fastpathT) DecMapIntInt64L(v map[int]int64, containerLen int, d *Decoder) } } } -func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]float32)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]float32) - if *vp == nil { - *vp = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - fastpathTV.DecMapIntFloat32L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntFloat32L(rv2i(rv).(map[int]float32), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[int]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - f.DecMapIntFloat32L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapIntFloat32L(v map[int]float32, containerLen int, d *Decoder) { - var mk int - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) - d.mapElemValue() - mv = float32(d.decodeFloat32()) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]float64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]float64) + if *vp == nil { + *vp = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]float64) - if *vp == nil { - *vp = make(map[int]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapIntFloat64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntFloat64L(rv2i(rv).(map[int]float64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntFloat64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntFloat64L(rv2i(rv).(map[int]float64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8350,28 +5194,22 @@ func (fastpathT) DecMapIntFloat64L(v map[int]float64, containerLen int, d *Decod } func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int]bool)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int]bool) + if *vp == nil { + *vp = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int]bool) - if *vp == nil { - *vp = make(map[int]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapIntBoolL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapIntBoolL(rv2i(rv).(map[int]bool), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapIntBoolL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapIntBoolL(rv2i(rv).(map[int]bool), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8399,28 +5237,22 @@ func (fastpathT) DecMapIntBoolL(v map[int]bool, containerLen int, d *Decoder) { } func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]interface{})) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]interface{}) + if *vp == nil { + *vp = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]interface{}) - if *vp == nil { - *vp = make(map[int64]interface{}, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64IntfL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64IntfL(rv2i(rv).(map[int64]interface{}), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64IntfL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64IntfL(rv2i(rv).(map[int64]interface{}), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8454,28 +5286,22 @@ func (fastpathT) DecMapInt64IntfL(v map[int64]interface{}, containerLen int, d * } func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]string)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]string) + if *vp == nil { + *vp = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]string) - if *vp == nil { - *vp = make(map[int64]string, decInferLen(containerLen, d.h.MaxInitLen, 24)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64StringL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64StringL(rv2i(rv).(map[int64]string), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64StringL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64StringL(rv2i(rv).(map[int64]string), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8503,28 +5329,22 @@ func (fastpathT) DecMapInt64StringL(v map[int64]string, containerLen int, d *Dec } func (d *Decoder) fastpathDecMapInt64BytesR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64][]byte)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64][]byte) + if *vp == nil { + *vp = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64][]byte) - if *vp == nil { - *vp = make(map[int64][]byte, decInferLen(containerLen, d.h.MaxInitLen, 32)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64BytesL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64BytesL(rv2i(rv).(map[int64][]byte), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64BytesL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64BytesL(rv2i(rv).(map[int64][]byte), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64BytesX(vp *map[int64][]byte, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8556,79 +5376,24 @@ func (fastpathT) DecMapInt64BytesL(v map[int64][]byte, containerLen int, d *Deco } } } -func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]uint)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]uint) - if *vp == nil { - *vp = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64UintL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64UintL(rv2i(rv).(map[int64]uint), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[int64]uint, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - f.DecMapInt64UintL(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapInt64UintL(v map[int64]uint, containerLen int, d *Decoder) { - var mk int64 - var mv uint - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = d.d.DecodeInt64() - d.mapElemValue() - mv = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]uint8)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]uint8) + if *vp == nil { + *vp = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]uint8) - if *vp == nil { - *vp = make(map[int64]uint8, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64Uint8L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64Uint8L(rv2i(rv).(map[int64]uint8), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64Uint8L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64Uint8L(rv2i(rv).(map[int64]uint8), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8656,28 +5421,22 @@ func (fastpathT) DecMapInt64Uint8L(v map[int64]uint8, containerLen int, d *Decod } func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]uint64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]uint64) + if *vp == nil { + *vp = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]uint64) - if *vp == nil { - *vp = make(map[int64]uint64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64Uint64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64Uint64L(rv2i(rv).(map[int64]uint64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64Uint64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64Uint64L(rv2i(rv).(map[int64]uint64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8705,28 +5464,22 @@ func (fastpathT) DecMapInt64Uint64L(v map[int64]uint64, containerLen int, d *Dec } func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]int)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]int) + if *vp == nil { + *vp = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]int) - if *vp == nil { - *vp = make(map[int64]int, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64IntL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64IntL(rv2i(rv).(map[int64]int), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64IntL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64IntL(rv2i(rv).(map[int64]int), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8754,28 +5507,22 @@ func (fastpathT) DecMapInt64IntL(v map[int64]int, containerLen int, d *Decoder) } func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]int64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]int64) + if *vp == nil { + *vp = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]int64) - if *vp == nil { - *vp = make(map[int64]int64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64Int64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64Int64L(rv2i(rv).(map[int64]int64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64Int64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64Int64L(rv2i(rv).(map[int64]int64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8801,79 +5548,24 @@ func (fastpathT) DecMapInt64Int64L(v map[int64]int64, containerLen int, d *Decod } } } -func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]float32)) = nil - } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]float32) - if *vp == nil { - *vp = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64Float32L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64Float32L(rv2i(rv).(map[int64]float32), containerLen, d) - } - d.mapEnd() - } -} -func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) { - containerLen := d.mapStart() - if containerLen == decContainerLenNil { - *vp = nil - } else { - if *vp == nil { - *vp = make(map[int64]float32, decInferLen(containerLen, d.h.MaxInitLen, 12)) - } - if containerLen != 0 { - f.DecMapInt64Float32L(*vp, containerLen, d) - } - d.mapEnd() - } -} -func (fastpathT) DecMapInt64Float32L(v map[int64]float32, containerLen int, d *Decoder) { - var mk int64 - var mv float32 - hasLen := containerLen > 0 - for j := 0; (hasLen && j < containerLen) || !(hasLen || d.checkBreak()); j++ { - d.mapElemKey() - mk = d.d.DecodeInt64() - d.mapElemValue() - mv = float32(d.decodeFloat32()) - if v != nil { - v[mk] = mv - } - } -} func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]float64)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]float64) + if *vp == nil { + *vp = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]float64) - if *vp == nil { - *vp = make(map[int64]float64, decInferLen(containerLen, d.h.MaxInitLen, 16)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64Float64L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64Float64L(rv2i(rv).(map[int64]float64), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64Float64L(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64Float64L(rv2i(rv).(map[int64]float64), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -8901,28 +5593,22 @@ func (fastpathT) DecMapInt64Float64L(v map[int64]float64, containerLen int, d *D } func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { - if rv.Kind() == reflect.Ptr { - *(rv2i(rv).(*map[int64]bool)) = nil + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[int64]bool) + if *vp == nil { + *vp = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[int64]bool) - if *vp == nil { - *vp = make(map[int64]bool, decInferLen(containerLen, d.h.MaxInitLen, 9)) - } - if containerLen != 0 { - fastpathTV.DecMapInt64BoolL(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.DecMapInt64BoolL(rv2i(rv).(map[int64]bool), containerLen, d) + if containerLen != 0 { + fastpathTV.DecMapInt64BoolL(*vp, containerLen, d) } - d.mapEnd() + } else if containerLen != 0 { + fastpathTV.DecMapInt64BoolL(rv2i(rv).(map[int64]bool), containerLen, d) } + d.mapEnd() } func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { diff --git a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl index 537f069..48db80c 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl @@ -1,6 +1,6 @@ // +build !notfastpath -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from fast-path.go.tmpl - DO NOT EDIT. @@ -56,7 +56,9 @@ import ( const fastpathEnabled = true +{{/* const fastpathMapBySliceErrMsg = "mapBySlice requires even slice length, but got %v" +*/ -}} type fastpathT struct {} @@ -112,7 +114,7 @@ func init() { fastpathAV[i] = fastpathE{xptr, xrt, fe, fd} i++ } - {{/* do not register []uint8 in fast-path */}} + {{/* do not register []byte in fast-path */}} {{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8" -}} fn([]{{ .Elem }}(nil), (*Encoder).{{ .MethodNamePfx "fastpathEnc" false }}R, (*Decoder).{{ .MethodNamePfx "fastpathDec" false }}R) {{end}}{{end}}{{end}}{{end}} @@ -178,20 +180,22 @@ func (fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, e *Encoder) } func (fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *Encoder) { {{/* if v == nil { e.e.EncodeNil() } else */ -}} + e.haltOnMbsOddLen(len(v)) + {{/* if len(v)%2 == 1 { e.errorf(fastpathMapBySliceErrMsg, len(v)) - } else { - e.mapStart(len(v) / 2) - for j := range v { - if j%2 == 0 { - e.mapElemKey() - } else { - e.mapElemValue() - } - {{ encmd .Elem "v[j]"}} - } - e.mapEnd() } + */ -}} + e.mapStart(len(v) / 2) + for j := range v { + if j%2 == 0 { + e.mapElemKey() + } else { + e.mapElemValue() + } + {{ encmd .Elem "v[j]"}} + } + e.mapEnd() } {{end}}{{end}}{{end -}} @@ -269,7 +273,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { */ -}} case map[{{ .MapKey }}]{{ .Elem }}: containerLen = d.mapStart() - if containerLen != decContainerLenNil { + if containerLen != containerLenNil { if containerLen != 0 { fastpathTV.{{ .MethodNamePfx "Dec" false }}L(v, containerLen, d) } @@ -280,7 +284,7 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { containerLen = d.mapStart() if containerLen == 0 { d.mapEnd() - } else if containerLen == decContainerLenNil { + } else if containerLen == containerLenNil { *v = nil } else { if *v == nil { @@ -364,14 +368,10 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}Y(v []{{ .Elem }}, d *Decoder) } var j int for j = 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { - if j == 0 && len(v) == 0 { - if hasLen { - xlen = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) - } else { - xlen = 8 - } + if j == 0 && len(v) == 0 { // means hasLen == false + xlen = decDefSliceCap v = make([]{{ .Elem }}, uint(xlen)) - changed = true + changed = true } {{/* // if indefinite, etc, then expand the slice if necessary */ -}} if j >= len(v) { @@ -404,7 +404,7 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}N(v []{{ .Elem }}, d *Decoder) for j := 0; (hasLen && j < containerLenS) || !(hasLen || d.checkBreak()); j++ { {{/* // if indefinite, etc, then expand the slice if necessary */ -}} if j >= len(v) { - fastpathDecArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) + decArrayCannotExpand(slh, hasLen, len(v), j, containerLenS) return } slh.ElemContainerState(j) @@ -418,48 +418,41 @@ func (fastpathT) {{ .MethodNamePfx "Dec" false }}N(v []{{ .Elem }}, d *Decoder) } {{end}}{{end}}{{end -}} -func fastpathDecArrayCannotExpand(slh decSliceHelper, hasLen bool, lenv, j, containerLenS int) { - slh.d.arrayCannotExpand(lenv, j+1) - slh.ElemContainerState(j) - slh.d.swallow() - j++ - for ; (hasLen && j < containerLenS) || !(hasLen || slh.d.checkBreak()); j++ { - slh.ElemContainerState(j) - slh.d.swallow() - } - slh.End() -} - {{range .Values}}{{if not .Primitive}}{{if .MapKey -}} {{/* Maps can change if they are - addressable (from a ptr) - settable (e.g. contained in an interface{}) + +Also, these methods are called by decodeValue directly, after handling a TryNil. +Consequently, there's no need to check for containerLenNil here. */ -}} func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + {{/* + if containerLen == containerLenNil { if rv.Kind() == reflect.Ptr { *(rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }})) = nil } - } else { - if rv.Kind() == reflect.Ptr { - vp, _ := rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }}) - if *vp == nil { - *vp = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})) - } - if containerLen != 0 { - fastpathTV.{{ .MethodNamePfx "Dec" false }}L(*vp, containerLen, d) - } - } else if containerLen != 0 { - fastpathTV.{{ .MethodNamePfx "Dec" false }}L(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), containerLen, d) - } - d.mapEnd() + return } + */ -}} + if rv.Kind() == reflect.Ptr { + vp, _ := rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }}) + if *vp == nil { + *vp = make(map[{{ .MapKey }}]{{ .Elem }}, decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }})) + } + if containerLen != 0 { + fastpathTV.{{ .MethodNamePfx "Dec" false }}L(*vp, containerLen, d) + } + } else if containerLen != 0 { + fastpathTV.{{ .MethodNamePfx "Dec" false }}L(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), containerLen, d) + } + d.mapEnd() } func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, d *Decoder) { containerLen := d.mapStart() - if containerLen == decContainerLenNil { + if containerLen == containerLenNil { *vp = nil } else { if *vp == nil { @@ -472,7 +465,7 @@ func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .E } } func (fastpathT) {{ .MethodNamePfx "Dec" false }}L(v map[{{ .MapKey }}]{{ .Elem }}, containerLen int, d *Decoder) { - {{/* No need to check if containerLen == decContainerLenNil, as that is checked by R and L above */ -}} + {{/* No need to check if containerLen == containerLenNil, as that is checked by R and L above */ -}} {{if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset {{else if eq .Elem "bytes" "[]byte" }}mapGet := v != nil && !d.h.MapValueReset {{end -}} diff --git a/vendor/github.com/ugorji/go/codec/fast-path.not.go b/vendor/github.com/ugorji/go/codec/fast-path.not.go index 6b6ac1f..7699c3e 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.not.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.not.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build notfastpath @@ -17,11 +17,13 @@ const fastpathEnabled = false // This tag disables fastpath during build, allowing for faster build, test execution, // short-program runs, etc. -func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } -func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } -func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } -func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } -func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false } +func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } +func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } + +// func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } +// func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } + +func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false } type fastpathT struct{} type fastpathE struct { diff --git a/vendor/github.com/ugorji/go/codec/float.go b/vendor/github.com/ugorji/go/codec/float.go deleted file mode 100644 index cfe3a9e..0000000 --- a/vendor/github.com/ugorji/go/codec/float.go +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -package codec - -import "strconv" - -// func parseFloat(b []byte, bitsize int) (f float64, err error) { -// if bitsize == 32 { -// return parseFloat32(b) -// } else { -// return parseFloat64(b) -// } -// } - -func parseFloat32(b []byte) (f float32, err error) { - return parseFloat32_custom(b) - // return parseFloat32_strconv(b) -} - -func parseFloat64(b []byte) (f float64, err error) { - return parseFloat64_custom(b) - // return parseFloat64_strconv(b) -} - -func parseFloat32_strconv(b []byte) (f float32, err error) { - f64, err := strconv.ParseFloat(stringView(b), 32) - f = float32(f64) - return -} - -func parseFloat64_strconv(b []byte) (f float64, err error) { - return strconv.ParseFloat(stringView(b), 64) -} - -// ------ parseFloat custom below -------- - -// We assume that a lot of floating point numbers in json files will be -// those that are handwritten, and with defined precision (in terms of number -// of digits after decimal point), etc. -// -// We further assume that this ones can be written in exact format. -// -// strconv.ParseFloat has some unnecessary overhead which we can do without -// for the common case: -// -// - expensive char-by-char check to see if underscores are in right place -// - testing for and skipping underscores -// - check if the string matches ignorecase +/- inf, +/- infinity, nan -// - support for base 16 (0xFFFF...) -// -// The functions below will try a fast-path for floats which can be decoded -// without any loss of precision, meaning they: -// -// - fits within the significand bits of the 32-bits or 64-bits -// - exponent fits within the exponent value -// - there is no truncation (any extra numbers are all trailing zeros) -// -// To figure out what the values are for maxMantDigits, use this idea below: -// -// 2^23 = 838 8608 (between 10^ 6 and 10^ 7) (significand bits of uint32) -// 2^32 = 42 9496 7296 (between 10^ 9 and 10^10) (full uint32) -// 2^52 = 4503 5996 2737 0496 (between 10^15 and 10^16) (significand bits of uint64) -// 2^64 = 1844 6744 0737 0955 1616 (between 10^19 and 10^20) (full uint64) -// -// Since we only allow for up to what can comfortably fit into the significand -// ignoring the exponent, and we only try to parse iff significand fits into the - -// Exact powers of 10. -var float64pow10 = [...]float64{ - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22, -} -var float32pow10 = [...]float32{1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10} - -type floatinfo struct { - mantbits uint8 - expbits uint8 - bias int16 - - exactPow10 int8 // Exact powers of ten are <= 10^N (32: 10, 64: 22) - exactInts int8 // Exact integers are <= 10^N - - maxMantDigits int8 // 10^19 fits in uint64, while 10^9 fits in uint32 -} - -var fi32 = floatinfo{23, 8, -127, 10, 7, 9} // maxMantDigits = 9 -var fi64 = floatinfo{52, 11, -1023, 22, 15, 19} // maxMantDigits = 19 - -const fMax64 = 1e15 -const fMax32 = 1e7 - -const fBase = 10 - -func parseFloatErr(b []byte) error { - return &strconv.NumError{ - Func: "ParseFloat", - Err: strconv.ErrSyntax, - Num: string(b), - } -} - -func parseFloat32_custom(b []byte) (f float32, err error) { - mantissa, exp, neg, trunc, bad, ok := readFloat(b, fi32) - _ = trunc - if bad { - return 0, parseFloatErr(b) - } - if ok { - // parseFloatDebug(b, 32, false, exp, trunc, ok) - f = float32(mantissa) - if neg { - f = -f - } - if exp != 0 { - indx := fExpIndx(exp) - if exp < 0 { // int / 10^k - f /= float32pow10[indx] - } else { // exp > 0 - if exp > fi32.exactPow10 { - f *= float32pow10[exp-fi32.exactPow10] - if f < -fMax32 || f > fMax32 { // exponent too large - outside range - goto FALLBACK - } - indx = uint8(fi32.exactPow10) - } - f *= float32pow10[indx] - } - } - return - } -FALLBACK: - // parseFloatDebug(b, 32, true, exp, trunc, ok) - return parseFloat32_strconv(b) -} - -func parseFloat64_custom(b []byte) (f float64, err error) { - mantissa, exp, neg, trunc, bad, ok := readFloat(b, fi64) - _ = trunc - if bad { - return 0, parseFloatErr(b) - } - if ok { - f = float64(mantissa) - if neg { - f = -f - } - if exp != 0 { - indx := fExpIndx(exp) - if exp < 0 { // int / 10^k - f /= float64pow10[indx] - } else { // exp > 0 - if exp > fi64.exactPow10 { - f *= float64pow10[exp-fi64.exactPow10] - if f < -fMax64 || f > fMax64 { // exponent too large - outside range - goto FALLBACK - } - indx = uint8(fi64.exactPow10) - } - f *= float64pow10[indx] - } - } - return - } -FALLBACK: - return parseFloat64_strconv(b) -} - -func fExpIndx(v int8) uint8 { - if v < 0 { - return uint8(-v) - } - return uint8(v) -} - -func readFloat(s []byte, y floatinfo) (mantissa uint64, exp int8, neg, trunc, bad, ok bool) { - var i uint // make it uint, so that we eliminate bounds checking - var slen = uint(len(s)) - if slen == 0 { - bad = true - return - } - switch s[0] { - case '+': - i++ - case '-': - neg = true - i++ - } - - // we considered punting early if string has length > maxMantDigits, but this doesn't account - // for trailing 0's e.g. 700000000000000000000 can be encoded exactly as it is 7e20 - - // var sawdot, sawdigits, sawexp bool - var sawdot, sawexp bool - var nd, ndMant, dp int8 -L: - for ; i < slen; i++ { - switch s[i] { - case '.': - if sawdot { - bad = true - return - } - sawdot = true - dp = nd - case '0': - if nd == 0 { // ignore leading zeros - dp-- - continue - } - nd++ - if ndMant < y.maxMantDigits { - // mantissa = (mantissa << 1) + (mantissa << 3) - mantissa *= fBase - ndMant++ - } - case '1', '2', '3', '4', '5', '6', '7', '8', '9': - // sawdigits = true - nd++ - if ndMant < y.maxMantDigits { - // mantissa = (mantissa << 1) + (mantissa << 3) + uint64(s[i]-'0') - mantissa = mantissa*fBase + uint64(s[i]-'0') - // mantissa *= fBase - // mantissa += uint64(s[i] - '0') - ndMant++ - } else { - trunc = true - return // break L - } - case 'e', 'E': - sawexp = true - break L - default: - bad = true - return - } - } - // if !sawdigits { - // bad = true - // return - // } - if !sawdot { - dp = nd - } - - if sawexp { - i++ - if i < slen { - var eneg bool - if s[i] == '+' { - i++ - } else if s[i] == '-' { - i++ - eneg = true - } - if i < slen { - // for exact match, exponent is 1 or 2 digits (float64: -22 to 37, float32: -1 to 17). - // exit quick if exponent is more than 2 digits. - if i+2 < slen { - return - } - - var e int8 - - if s[i] < '0' || s[i] > '9' { - bad = true - return - } - e = e*fBase + int8(s[i]-'0') // (e << 1) + (e << 3) + int8(s[i]-'0') - i++ - - if i < slen { - if s[i] < '0' || s[i] > '9' { - bad = true - return - } - e = e*fBase + int8(s[i]-'0') // (e << 1) + (e << 3) + int8(s[i]-'0') - i++ - } - - if eneg { - dp -= e - } else { - dp += e - } - } - } - } - - if mantissa != 0 { - if mantissa>>y.mantbits != 0 { - return - } - exp = dp - ndMant - if exp < -y.exactPow10 || exp > y.exactInts+y.exactPow10 { // cannot handle it - return - } - } - ok = true // && !trunc // if trunc=true, we return early (so here trunc=false) - return -} - -// fMul10ShiftU64 - -// func parseFloatDebug(b []byte, bitsize int, strconv bool, exp int8, trunc, ok bool) { -// if strconv { -// xdebugf("parseFloat%d: delegating: %s, exp: %d, trunc: %v, ok: %v", bitsize, b, exp, trunc, ok) -// } else { -// xdebug2f("parseFloat%d: attempting: %s, exp: %d, trunc: %v, ok: %v", bitsize, b, exp, trunc, ok) -// } -// } diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl index 35bda4a..2e6b33d 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl @@ -48,6 +48,6 @@ if {{var "l"}} != 0 { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } -} // else len==0: TODO: Should we clear map entries? +} // else len==0: leave as-is (do not clear map entries) z.DecReadMapEnd() } diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go index d86d3af..05ddbde 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go @@ -1,6 +1,6 @@ // comment this out // + build ignore -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from gen-helper.go.tmpl - DO NOT EDIT. @@ -10,7 +10,7 @@ package codec import "encoding" // GenVersion is the current version of codecgen. -const GenVersion = 16 +const GenVersion = 17 // This file is used to generate helper code for codecgen. // The values here i.e. genHelper(En|De)coder are not to be used directly by @@ -44,7 +44,7 @@ type genHelperDecDriver struct { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { - M must + M mustHdl F fastpathT e *Encoder } @@ -118,9 +118,6 @@ func (f genHelperEncoder) WriteStr(s string) { f.e.w().writestr(s) } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) } - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) } @@ -157,10 +154,10 @@ func (f genHelperDecoder) DecBinary() bool { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecSwallow() { f.d.swallow() } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecScratchBuffer() []byte { - return f.d.b[:] -} +// // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// func (f genHelperDecoder) DecScratchBuffer() []byte { +// return f.d.b[:] +// } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte { @@ -170,8 +167,8 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { rv := rv4i(iv) - if chkPtr { - f.d.ensureDecodeable(rv) + if chkPtr && !isDecodeable(rv) { + f.d.haltAsNotDecodeable(rv) } f.d.decodeValue(rv, nil) } @@ -193,25 +190,23 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { - if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil { - panic(fnerr) - } + halt.onerror(tm.UnmarshalText(f.d.d.DecodeStringAsBytes())) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // bs := f.dd.DecodeStringAsBytes() // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. - if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil { - panic(fnerr) - } + bs := f.d.blist.get(256)[:0] + bs = f.d.d.nextValueBytes(bs) + fnerr := tm.UnmarshalJSON(bs) + f.d.blist.put(bs) + halt.onerror(fnerr) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { - if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil { - panic(fnerr) - } + halt.onerror(bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true))) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl index 4465233..530249e 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -1,6 +1,6 @@ // comment this out // + build ignore -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from gen-helper.go.tmpl - DO NOT EDIT. @@ -52,7 +52,7 @@ type genHelperDecDriver struct { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { - M must + M mustHdl F fastpathT e *Encoder } @@ -115,9 +115,10 @@ func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { func (f genHelperEncoder) WriteStr(s string) { f.e.w().writestr(s) } +{{/* // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) BytesView(v string) []byte { return bytesView(v) } - +*/ -}} // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncWriteMapStart(length int) { f.e.mapStart(length) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -145,10 +146,12 @@ func (f genHelperDecoder) DecBinary() bool { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecSwallow() { f.d.swallow() } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecScratchBuffer() []byte { - return f.d.b[:] -} + +// // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// func (f genHelperDecoder) DecScratchBuffer() []byte { +// return f.d.b[:] +// } + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte { return &f.d.b @@ -156,8 +159,8 @@ func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { rv := rv4i(iv) - if chkPtr { - f.d.ensureDecodeable(rv) + if chkPtr && !isDecodeable(rv) { + f.d.haltAsNotDecodeable(rv) } f.d.decodeValue(rv, nil) } @@ -175,23 +178,21 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { - if fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()); fnerr != nil { - panic(fnerr) - } + halt.onerror(tm.UnmarshalText(f.d.d.DecodeStringAsBytes())) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // bs := f.dd.DecodeStringAsBytes() // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. - if fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()); fnerr != nil { - panic(fnerr) - } + bs := f.d.blist.get(256)[:0] + bs = f.d.d.nextValueBytes(bs) + fnerr := tm.UnmarshalJSON(bs) + f.d.blist.put(bs) + halt.onerror(fnerr) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { - if fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)); fnerr != nil { - panic(fnerr) - } + halt.onerror(bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true))) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() } diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go index 5aca5a4..44b2095 100644 --- a/vendor/github.com/ugorji/go/codec/gen.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen.generated.go @@ -1,6 +1,6 @@ // +build codecgen.exec -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -58,7 +58,7 @@ if {{var "l"}} != 0 { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } -} // else len==0: TODO: Should we clear map entries? +} // else len==0: leave as-is (do not clear map entries) z.DecReadMapEnd() } ` diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go index 3573bc3..00de87c 100644 --- a/vendor/github.com/ugorji/go/codec/gen.go +++ b/vendor/github.com/ugorji/go/codec/gen.go @@ -1,6 +1,6 @@ // +build codecgen.exec -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -14,6 +14,7 @@ import ( "io" "io/ioutil" "math/rand" + "os" "reflect" "regexp" "sort" @@ -90,19 +91,19 @@ import ( // GenVersion is the current version of codecgen. // -// NOTE: Increment this value each time codecgen changes fundamentally. +// MARKER: Increment this value each time codecgen changes fundamentally. // Fundamental changes are: // - helper methods change (signature change, new ones added, some removed, etc) // - codecgen command line changes // // v1: Initial Version -// v2: +// v2: - // v3: Changes for Kubernetes: // changes in signature of some unpublished helper methods and codecgen cmdline arguments. // v4: Removed separator support from (en|de)cDriver, and refactored codec(gen) // v5: changes to support faster json decoding. Let encoder/decoder maintain state of collections. // v6: removed unsafe from gen, and now uses codecgen.exec tag -// v7: +// v7: - // v8: current - we now maintain compatibility with old generated code. // v9: skipped // v10: modified encDriver and decDriver interfaces. @@ -112,10 +113,11 @@ import ( // v14: 20190611 refactored nil handling: TryDecodeAsNil -> selective TryNil, etc // v15: 20190626 encDriver.EncodeString handles StringToRaw flag inside handle // v16: 20190629 refactoring for v1.1.6 -const genVersion = 16 +// v17: 20200911 reduce number of types for which we generate fast path functions (v1.1.8) +const genVersion = 17 const ( - genCodecPkg = "codec1978" + genCodecPkg = "codec1978" // MARKER: keep in sync with codecgen/gen.go genTempVarPfx = "yy" genTopLevelVarName = "x" @@ -133,7 +135,7 @@ const ( // genFastpathCanonical configures whether we support Canonical in fast path. // The savings is not much. // - // NOTE: This MUST ALWAYS BE TRUE. fast-path.go.tmp doesn't handle it being false. + // MARKER: This MUST ALWAYS BE TRUE. fast-path.go.tmp doesn't handle it being false. genFastpathCanonical = true // MUST be true // genFastpathTrimTypes configures whether we trim uncommon fastpath types. @@ -155,8 +157,9 @@ const ( ) var ( - errGenAllTypesSamePkg = errors.New("All types must be in the same package") - errGenExpectArrayOrMap = errors.New("unexpected type. Expecting array/map/slice") + errGenAllTypesSamePkg = errors.New("All types must be in the same package") + errGenExpectArrayOrMap = errors.New("unexpected type - expecting array/map/slice") + errGenUnexpectedTypeFastpath = errors.New("fast-path: unexpected type - requires map or slice") genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__") genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`) @@ -275,7 +278,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, for _, t := range typ { // fmt.Printf("###########: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name()) if genImportPath(t) != x.bp { - panic(errGenAllTypesSamePkg) + halt.onerror(errGenAllTypesSamePkg) } x.genRefPkgs(t) } @@ -331,10 +334,10 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, } x.linef("codecSelferBitsize%s = uint8(32 << (^uint(0) >> 63))", x.xs) - x.linef("codecSelferDecContainerLenNil%s = %d", x.xs, int64(decContainerLenNil)) + x.linef("codecSelferDecContainerLenNil%s = %d", x.xs, int64(containerLenNil)) x.line(")") x.line("var (") - x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = " + "\nerrors.New(`only encoded map or array can be decoded into a struct`)") + x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = " + "errors.New(`only encoded map or array can be decoded into a struct`)") x.line(")") x.line("") @@ -348,7 +351,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, x.linef("if %sGenVersion != %v {", x.cpfx, genVersion) x.line("_, file, _, _ := runtime.Caller(0)") x.linef("ver := strconv.FormatInt(int64(%sGenVersion), 10)", x.cpfx) - x.outf(`panic("codecgen version mismatch: current: %v, need " + ver + ". Re-generate file: " + file)`, genVersion) + x.outf(`panic(errors.New("codecgen version mismatch: current: %v, need " + ver + ". Re-generate file: " + file))`, genVersion) x.linef("}") if len(imKeys) > 0 { x.line("if false { // reference the types, but skip this branch at build/run time") @@ -380,7 +383,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, case reflect.Map: x.encMapFallback("v", t) default: - panic(errGenExpectArrayOrMap) + halt.onerror(errGenExpectArrayOrMap) } x.line("}") x.line("") @@ -395,7 +398,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, case reflect.Map: x.decMapFallback("v", rtid, t) default: - panic(errGenExpectArrayOrMap) + halt.onerror(errGenExpectArrayOrMap) } x.line("}") x.line("") @@ -479,16 +482,12 @@ func (x *genRunner) varsfxreset() { func (x *genRunner) out(s string) { _, err := io.WriteString(x.w, s) - if err != nil { - panic(err) - } + genCheckErr(err) } func (x *genRunner) outf(s string, params ...interface{}) { _, err := fmt.Fprintf(x.w, s, params...) - if err != nil { - panic(err) - } + genCheckErr(err) } func (x *genRunner) line(s string) { @@ -512,8 +511,6 @@ func (x *genRunner) linef(s string, params ...interface{}) { } func (x *genRunner) genTypeName(t reflect.Type) (n string) { - // defer func() { xdebugf(">>>> ####: genTypeName: t: %v, name: '%s'\n", t, n) }() - // if the type has a PkgPath, which doesn't match the current package, // then include it. // We cannot depend on t.String() because it includes current package, @@ -710,22 +707,22 @@ func (x *genRunner) encVarChkNil(varname string, t reflect.Type, checkNil bool) telem := t.Elem() tek := telem.Kind() if tek == reflect.Array || (tek == reflect.Struct && telem != timeTyp) { - x.enc(varname, genNonPtr(t)) + x.enc(varname, genNonPtr(t), true) break } i := x.varsfx() x.line(genTempVarPfx + i + " := *" + varname) - x.enc(genTempVarPfx+i, genNonPtr(t)) + x.enc(genTempVarPfx+i, genNonPtr(t), false) case reflect.Struct, reflect.Array: if t == timeTyp { - x.enc(varname, t) + x.enc(varname, t, false) break } i := x.varsfx() x.line(genTempVarPfx + i + " := &" + varname) - x.enc(genTempVarPfx+i, t) + x.enc(genTempVarPfx+i, t, true) default: - x.enc(varname, t) + x.enc(varname, t, false) } if checkNil { @@ -737,7 +734,7 @@ func (x *genRunner) encVarChkNil(varname string, t reflect.Type, checkNil bool) // if t is !time.Time and t is of kind reflect.Struct or reflect.Array, varname is of type *T // (to prevent copying), // else t is of type T -func (x *genRunner) enc(varname string, t reflect.Type) { +func (x *genRunner) enc(varname string, t reflect.Type, isptr bool) { rtid := rt2id(t) ti2 := x.ti.get(rtid, t) // We call CodecEncodeSelf if one of the following are honored: @@ -747,28 +744,55 @@ func (x *genRunner) enc(varname string, t reflect.Type) { mi := x.varsfx() // tptr := reflect.PtrTo(t) - tk := t.Kind() + // tk := t.Kind() + + // check if + // - type is time.Time, RawExt, Raw + // - the type implements (Text|JSON|Binary)(Unm|M)arshal + + var hasIf genIfClause + defer hasIf.end(x) // end if block (if necessary) + + var ptrPfx, addrPfx string + if isptr { + ptrPfx = "*" + } else { + addrPfx = "&" + } + + if t == timeTyp { + x.linef("%s !z.EncBasicHandle().TimeNotBuiltin { r.EncodeTime(%s%s)", hasIf.c(false), ptrPfx, varname) + // return + } + if t == rawTyp { + x.linef("%s z.EncRaw(%s%s)", hasIf.c(true), ptrPfx, varname) + return + } + if t == rawExtTyp { + x.linef("%s r.EncodeRawExt(%s%s)", hasIf.c(true), addrPfx, varname) + return + } + // only check for extensions if extensions are configured, + // and the type is named, and has a packagePath, + // and this is not the CodecEncodeSelf or CodecDecodeSelf method (i.e. it is not a Selfer) + if !x.nx && varname != genTopLevelVarName && genImportPath(t) != "" && t.Name() != "" { + yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) + x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ", + hasIf.c(false), yy, varname, yy, varname, yy) + } + if x.checkForSelfer(t, varname) { - if tk == reflect.Array || - (tk == reflect.Struct && rtid != timeTypId) { // varname is of type *T - // if tptr.Implements(selferTyp) || t.Implements(selferTyp) { - if ti2.isFlag(tiflagSelfer) || ti2.isFlag(tiflagSelferPtr) { - x.line(varname + ".CodecEncodeSelf(e)") - return - } - } else { // varname is of type T - if ti2.isFlag(tiflagSelfer) { - x.line(varname + ".CodecEncodeSelf(e)") - return - } else if ti2.isFlag(tiflagSelferPtr) { - x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname) - x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi) - return - } + if ti2.isFlag(tiflagSelfer) { + x.linef("%s %s.CodecEncodeSelf(e)", hasIf.c(true), varname) + return + } else if ti2.isFlag(tiflagSelferPtr) { + x.linef("%s %ssf%s := &%s", hasIf.c(true), genTempVarPfx, mi, varname) + x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi) + return } if _, ok := x.te[rtid]; ok { - x.line(varname + ".CodecEncodeSelf(e)") + x.linef("%s %s.CodecEncodeSelf(e)", hasIf.c(true), varname) return } } @@ -791,59 +815,21 @@ func (x *genRunner) enc(varname string, t reflect.Type) { rtidAdded = true } - // check if - // - type is time.Time, RawExt, Raw - // - the type implements (Text|JSON|Binary)(Unm|M)arshal + if ti2.isFlag(tiflagBinaryMarshaler) { + x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%s%v) ", hasIf.c(false), ptrPfx, varname) + } else if ti2.isFlag(tiflagBinaryMarshalerPtr) { + x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%s%v) ", hasIf.c(false), addrPfx, varname) + } + if ti2.isFlag(tiflagJsonMarshaler) { + x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%s%v) ", hasIf.c(false), ptrPfx, varname) + } else if ti2.isFlag(tiflagJsonMarshalerPtr) { + x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%s%v) ", hasIf.c(false), addrPfx, varname) + } else if ti2.isFlag(tiflagTextMarshaler) { + x.linef("%s !z.EncBinary() { z.EncTextMarshal(%s%v) ", hasIf.c(false), ptrPfx, varname) + } else if ti2.isFlag(tiflagTextMarshalerPtr) { + x.linef("%s !z.EncBinary() { z.EncTextMarshal(%s%v) ", hasIf.c(false), addrPfx, varname) + } - var hasIf genIfClause - defer hasIf.end(x) // end if block (if necessary) - - if t == timeTyp { - x.linef("%s !z.EncBasicHandle().TimeNotBuiltin { r.EncodeTime(%s)", hasIf.c(false), varname) - // return - } - if t == rawTyp { - x.linef("%s z.EncRaw(%s)", hasIf.c(true), varname) - return - } - if t == rawExtTyp { - x.linef("%s r.EncodeRawExt(%s)", hasIf.c(true), varname) - return - } - // only check for extensions if extensions are configured, - // and the type is named, and has a packagePath, - // and this is not the CodecEncodeSelf or CodecDecodeSelf method (i.e. it is not a Selfer) - var arrayOrStruct = tk == reflect.Array || tk == reflect.Struct // meaning varname if of type *T - if !x.nx && varname != genTopLevelVarName && genImportPath(t) != "" && t.Name() != "" { - yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) - x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ", - hasIf.c(false), yy, varname, yy, varname, yy) - } - if arrayOrStruct { // varname is of type *T - if ti2.isFlag(tiflagBinaryMarshaler) || ti2.isFlag(tiflagBinaryMarshalerPtr) { - x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname) - } - if ti2.isFlag(tiflagJsonMarshaler) || ti2.isFlag(tiflagJsonMarshalerPtr) { - x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.isFlag(tiflagTextUnmarshaler) || ti2.isFlag(tiflagTextUnmarshalerPtr) { - x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname) - } - } else { // varname is of type T - if ti2.isFlag(tiflagBinaryMarshaler) { - x.linef("%s z.EncBinary() { z.EncBinaryMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.isFlag(tiflagBinaryMarshalerPtr) { - x.linef("%s z.EncBinary() { z.EncBinaryMarshal(&%v) ", hasIf.c(false), varname) - } - if ti2.isFlag(tiflagJsonMarshaler) { - x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.isFlag(tiflagJsonMarshalerPtr) { - x.linef("%s !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", hasIf.c(false), varname) - } else if ti2.isFlag(tiflagTextMarshaler) { - x.linef("%s !z.EncBinary() { z.EncTextMarshal(%v) ", hasIf.c(false), varname) - } else if ti2.isFlag(tiflagTextMarshalerPtr) { - x.linef("%s !z.EncBinary() { z.EncTextMarshal(&%v) ", hasIf.c(false), varname) - } - } x.lineIf(hasIf.c(true)) switch t.Kind() { @@ -866,7 +852,7 @@ func (x *genRunner) enc(varname string, t reflect.Type) { x.xtraSM(varname, t, true, true) case reflect.Slice: // if nil, call dedicated function - // if a []uint8, call dedicated function + // if a []byte, call dedicated function // if a known fastpath slice, call dedicated function // else write encode function in-line. // - if elements are primitives or Selfers, call dedicated function on each member. @@ -967,7 +953,7 @@ func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf } //buf.s(")") case reflect.Bool: - buf.s(varname2) + buf.s("bool(").s(varname2).s(")") case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan: buf.s("len(").s(varname2).s(") != 0") default: @@ -1178,15 +1164,11 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) { Label, Chan, Slice, Sfx string } tm, err := template.New("").Parse(genEncChanTmpl) - if err != nil { - panic(err) - } + genCheckErr(err) x.linef("if %s == nil { r.EncodeNil() } else { ", varname) x.linef("var sch%s []%s", i, x.genTypeName(t.Elem())) err = tm.Execute(x.w, &ts{"Lsch" + i, varname, "sch" + i, i}) - if err != nil { - panic(err) - } + genCheckErr(err) if elemBytes { x.linef("r.EncodeStringBytesRaw([]byte(%s))", "sch"+i) x.line("}") @@ -1209,7 +1191,7 @@ func (x *genRunner) encListFallback(varname string, t reflect.Type) { func (x *genRunner) encMapFallback(varname string, t reflect.Type) { x.linef("if %s == nil { r.EncodeNil(); return }", varname) - // NOTE: Canonical Option is not honored + // MARKER: Canonical Option is not honored i := x.varsfx() x.line("z.EncWriteMapStart(len(" + varname + "))") x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) @@ -1344,41 +1326,12 @@ func (x *genRunner) decVar(varname, nilvar string, t reflect.Type, canBeNil, che } // dec will decode a variable (varname) of type t or ptrTo(t) if isptr==true. -// t is always a basetype (i.e. not of kind reflect.Ptr). func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { // assumptions: // - the varname is to a pointer already. No need to take address of it // - t is always a baseType T (not a *T, etc). rtid := rt2id(t) ti2 := x.ti.get(rtid, t) - if x.checkForSelfer(t, varname) { - if ti2.isFlag(tiflagSelfer) || ti2.isFlag(tiflagSelferPtr) { - x.line(varname + ".CodecDecodeSelf(d)") - return - } - if _, ok := x.td[rtid]; ok { - x.line(varname + ".CodecDecodeSelf(d)") - return - } - } - - inlist := false - for _, t0 := range x.t { - if t == t0 { - inlist = true - if x.checkForSelfer(t, varname) { - x.line(varname + ".CodecDecodeSelf(d)") - return - } - break - } - } - - var rtidAdded bool - if t == x.tc { - x.td[rtid] = true - rtidAdded = true - } // check if // - type is time.Time, Raw, RawExt @@ -1412,18 +1365,58 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { // only check for extensions if extensions are configured, // and the type is named, and has a packagePath, // and this is not the CodecEncodeSelf or CodecDecodeSelf method (i.e. it is not a Selfer) + // xdebugf("genRunner.dec: varname: %v, t: %v, genImportPath: %v, t.Name: %v", varname, t, genImportPath(t), t.Name()) if !x.nx && varname != genTopLevelVarName && genImportPath(t) != "" && t.Name() != "" { // first check if extensions are configued, before doing the interface conversion yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) - x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", hasIf.c(false), yy, varname, yy, varname, yy) + x.linef("%s %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s%s, %s) ", hasIf.c(false), yy, varname, yy, addrPfx, varname, yy) } - if ti2.isFlag(tiflagBinaryUnmarshaler) || ti2.isFlag(tiflagBinaryUnmarshalerPtr) { + if x.checkForSelfer(t, varname) { + if ti2.isFlag(tiflagSelfer) { + x.linef("%s %s.CodecDecodeSelf(d)", hasIf.c(true), varname) + return + } + if ti2.isFlag(tiflagSelferPtr) { + x.linef("%s %s.CodecDecodeSelf(d)", hasIf.c(true), varname) + return + } + if _, ok := x.td[rtid]; ok { + x.linef("%s %s.CodecDecodeSelf(d)", hasIf.c(true), varname) + return + } + } + + inlist := false + for _, t0 := range x.t { + if t == t0 { + inlist = true + if x.checkForSelfer(t, varname) { + x.linef("%s %s.CodecDecodeSelf(d)", hasIf.c(true), varname) + return + } + break + } + } + + var rtidAdded bool + if t == x.tc { + x.td[rtid] = true + rtidAdded = true + } + + if ti2.isFlag(tiflagBinaryUnmarshaler) { + x.linef("%s z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", hasIf.c(false), ptrPfx, varname) + } else if ti2.isFlag(tiflagBinaryUnmarshalerPtr) { x.linef("%s z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", hasIf.c(false), addrPfx, varname) } - if ti2.isFlag(tiflagJsonUnmarshaler) || ti2.isFlag(tiflagJsonUnmarshalerPtr) { + if ti2.isFlag(tiflagJsonUnmarshaler) { + x.linef("%s !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", hasIf.c(false), ptrPfx, varname) + } else if ti2.isFlag(tiflagJsonUnmarshalerPtr) { x.linef("%s !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname) - } else if ti2.isFlag(tiflagTextUnmarshaler) || ti2.isFlag(tiflagTextUnmarshalerPtr) { + } else if ti2.isFlag(tiflagTextUnmarshaler) { + x.linef("%s !z.DecBinary() { z.DecTextUnmarshal(%s%v)", hasIf.c(false), ptrPfx, varname) + } else if ti2.isFlag(tiflagTextUnmarshalerPtr) { x.linef("%s !z.DecBinary() { z.DecTextUnmarshal(%s%v)", hasIf.c(false), addrPfx, varname) } @@ -1437,7 +1430,7 @@ func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { case reflect.Array, reflect.Chan: x.xtraSM(varname, t, false, isptr) case reflect.Slice: - // if a []uint8, call dedicated function + // if a []byte, call dedicated function // if a known fastpath slice, call dedicated function // else write encode function in-line. // - if elements are primitives or Selfers, call dedicated function on each member. @@ -1581,12 +1574,8 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type return t.Kind() == reflect.Chan } tm, err := template.New("").Funcs(funcs).Parse(genDecListTmpl) - if err != nil { - panic(err) - } - if err = tm.Execute(x.w, &ts); err != nil { - panic(err) - } + genCheckErr(err) + genCheckErr(tm.Execute(x.w, &ts)) } func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) { @@ -1635,12 +1624,8 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) } tm, err := template.New("").Funcs(funcs).Parse(genDecMapTmpl) - if err != nil { - panic(err) - } - if err = tm.Execute(x.w, &ts); err != nil { - panic(err) - } + genCheckErr(err) + genCheckErr(tm.Execute(x.w, &ts)) } func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintptr, t reflect.Type) { @@ -1811,7 +1796,7 @@ func (x *genRunner) newFastpathGenV(t reflect.Type) (v fastpathGenV) { v.MapKey = x.genTypeName(tk) v.Size = int(te.Size() + tk.Size()) default: - panic("unexpected type for newFastpathGenV. Requires map or slice type") + halt.onerror(errGenUnexpectedTypeFastpath) } return } @@ -2090,35 +2075,44 @@ func genInternalDecCommandAsString(s string) string { case "bool": return "d.d.DecodeBool()" default: - panic(errors.New("gen internal: unknown type for decode: " + s)) + halt.onerror(errors.New("gen internal: unknown type for decode: " + s)) } + return "" } +// func genInternalSortType(s string, elem bool) string { +// for _, v := range [...]string{ +// "int", +// "uint", +// "float", +// "bool", +// "string", +// "bytes", "[]uint8", "[]byte", +// } { +// if v == "[]byte" || v == "[]uint8" { +// v = "bytes" +// } +// if strings.HasPrefix(s, v) { +// if v == "int" || v == "uint" || v == "float" { +// v += "64" +// } +// if elem { +// return v +// } +// return v + "Slice" +// } +// } +// halt.onerror(errors.New("sorttype: unexpected type: " + s)) +// } + func genInternalSortType(s string, elem bool) string { - for _, v := range [...]string{ - "int", - "uint", - "float", - "bool", - "string", - "bytes", "[]uint8", "[]byte", - } { - if v == "[]byte" || v == "[]uint8" { - v = "bytes" - } - if strings.HasPrefix(s, v) { - if v == "int" || v == "uint" || v == "float" { - v += "64" - } - if elem { - return v - } - return v + "Slice" - } + if elem { + return s } - panic("sorttype: unexpected type: " + s) + return s + "Slice" } +// MARKER: keep in sync with codecgen/gen.go func genStripVendor(s string) string { // HACK: Misbehaviour occurs in go 1.5. May have to re-visit this later. // if s contains /vendor/ OR startsWith vendor/, then return everything after it. @@ -2191,65 +2185,12 @@ func genInternalInit() { mapvaltypes = types[:] if genFastpathTrimTypes { - slicetypes = []string{ - "interface{}", - "string", - "[]byte", - "float32", - "float64", - "uint", - // "uint8", // no need for fastpath of []uint8, as it is handled specially - "uint16", - "uint32", - "uint64", - // "uintptr", - "int", - "int8", - "int16", - "int32", - "int64", - "bool", - } + // Note: we only create fast-paths for commonly used types. + // Consequently, things like int8, uint16, uint, etc are commented out. - mapkeytypes = []string{ - //"interface{}", - "string", - //"[]byte", - //"float32", - //"float64", - "uint", - "uint8", - //"uint16", - //"uint32", - "uint64", - //"uintptr", - "int", - //"int8", - //"int16", - //"int32", - "int64", - // "bool", - } - - mapvaltypes = []string{ - "interface{}", - "string", - "[]byte", - "uint", - "uint8", - //"uint16", - //"uint32", - "uint64", - // "uintptr", - "int", - //"int8", - //"int16", - //"int32", - "int64", - "float32", - "float64", - "bool", - } + slicetypes = genInternalFastpathSliceTypes() + mapkeytypes = genInternalFastpathMapKeyTypes() + mapvaltypes = genInternalFastpathMapValueTypes() } // var mapkeytypes [len(&types) - 1]string // skip bool @@ -2303,9 +2244,6 @@ func genInternalInit() { } // genInternalGoFile is used to generate source files from templates. -// It is run by the program author alone. -// Unfortunately, it has to be exported so that it can be called from a command line tool. -// *** DO NOT USE *** func genInternalGoFile(r io.Reader, w io.Writer) (err error) { genInternalOnce.Do(genInternalInit) @@ -2337,3 +2275,182 @@ func genInternalGoFile(r io.Reader, w io.Writer) (err error) { w.Write(bout) return } + +func genInternalFastpathSliceTypes() []string { + return []string{ + "interface{}", + "string", + "[]byte", + // "float32", + "float64", + // "uint", + // "uint8", // no need for fastpath of []uint8, as it is handled specially + // "uint16", + // "uint32", + "uint64", + // "uintptr", + "int", + // "int8", + // "int16", + "int32", // rune + "int64", + "bool", + } +} + +func genInternalFastpathMapKeyTypes() []string { + return []string{ + // "interface{}", + "string", + // "[]byte", + // "float32", + // "float64", + // "uint", + "uint8", + // "uint16", + // "uint32", + "uint64", + // "uintptr", + "int", + // "int8", + // "int16", + // "int32", + "int64", + // "bool", + } +} + +func genInternalFastpathMapValueTypes() []string { + return []string{ + "interface{}", + "string", + "[]byte", + // "uint", + "uint8", + // "uint16", + // "uint32", + "uint64", + // "uintptr", + "int", + //"int8", + // "int16", + // "int32", // rune (mostly used for unicode) + "int64", + // "float32", + "float64", + "bool", + } +} + +// sort-slice ... +// generates sort implementations for +// various slice types and combination slice+reflect.Value types. +// +// The combination slice+reflect.Value types are used +// during canonical encode, and the others are used during fast-path +// encoding of map keys. + +// genInternalSortableTypes returns the types +// that are used for fast-path canonical's encoding of maps. +// +// For now, we only support the highest sizes for +// int64, uint64, float64, bool, string, bytes. +func genInternalSortableTypes() []string { + return genInternalFastpathMapKeyTypes() +} + +// genInternalSortablePlusTypes returns the types +// that are used for reflection-based canonical's encoding of maps. +// +// For now, we only support the highest sizes for +// int64, uint64, float64, bool, string, bytes. +func genInternalSortablePlusTypes() []string { + return []string{ + "string", + "float64", + "uint64", + // "uintptr", + "int64", + "bool", + "time", + "bytes", + } +} + +func genTypeForShortName(s string) string { + switch s { + case "time": + return "time.Time" + case "bytes": + return "[]byte" + } + return s +} + +func genArgs(args ...interface{}) map[string]interface{} { + m := make(map[string]interface{}, len(args)/2) + for i := 0; i < len(args); { + m[args[i].(string)] = args[i+1] + i += 2 + } + return m +} + +func genEndsWith(s0 string, sn ...string) bool { + for _, s := range sn { + if strings.HasSuffix(s0, s) { + return true + } + } + return false +} + +func genCheckErr(err error) { + halt.onerror(err) +} + +func genRunSortTmpl2Go(fnameIn, fnameOut string) { + var err error + + funcs := make(template.FuncMap) + funcs["sortables"] = genInternalSortableTypes + funcs["sortablesplus"] = genInternalSortablePlusTypes + funcs["tshort"] = genTypeForShortName + funcs["endswith"] = genEndsWith + funcs["args"] = genArgs + + t := template.New("").Funcs(funcs) + fin, err := os.Open(fnameIn) + genCheckErr(err) + defer fin.Close() + fout, err := os.Create(fnameOut) + genCheckErr(err) + defer fout.Close() + tmplstr, err := ioutil.ReadAll(fin) + genCheckErr(err) + t, err = t.Parse(string(tmplstr)) + genCheckErr(err) + var out bytes.Buffer + err = t.Execute(&out, 0) + genCheckErr(err) + bout, err := format.Source(out.Bytes()) + if err != nil { + fout.Write(out.Bytes()) // write out if error, so we can still see. + } + genCheckErr(err) + // write out if error, as much as possible, so we can still see. + _, err = fout.Write(bout) + genCheckErr(err) +} + +func genRunTmpl2Go(fnameIn, fnameOut string) { + // println("____ " + fnameIn + " --> " + fnameOut + " ______") + fin, err := os.Open(fnameIn) + genCheckErr(err) + defer fin.Close() + fout, err := os.Create(fnameOut) + genCheckErr(err) + defer fout.Close() + err = genInternalGoFile(fin, fout) + genCheckErr(err) +} diff --git a/vendor/github.com/ugorji/go/codec/go.mod b/vendor/github.com/ugorji/go/codec/go.mod index b4760da..9028fcb 100644 --- a/vendor/github.com/ugorji/go/codec/go.mod +++ b/vendor/github.com/ugorji/go/codec/go.mod @@ -1,5 +1,5 @@ module github.com/ugorji/go/codec -require ( -github.com/ugorji/go v1.1.7 -) +go 1.11 + +require github.com/ugorji/go v1.1.10 diff --git a/vendor/github.com/ugorji/go/codec/go.sum b/vendor/github.com/ugorji/go/codec/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go b/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go index 9ddbe20..651ade1 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.5 diff --git a/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go index c5fcd66..ca71bcf 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go @@ -1,14 +1,19 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.5 package codec -import "reflect" +import ( + "errors" + "reflect" +) const reflectArrayOfSupported = false +var errReflectArrayOfUnsupported = errors.New("codec: reflect.ArrayOf unsupported in this go version") + func reflectArrayOf(count int, elem reflect.Type) reflect.Type { - panic("codec: reflect.ArrayOf unsupported in this go version") + panic(errReflectArrayOfUnsupported) } diff --git a/vendor/github.com/ugorji/go/codec/goversion_fmt_time_gte_go15.go b/vendor/github.com/ugorji/go/codec/goversion_fmt_time_gte_go15.go index a353598..d4a31d2 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_fmt_time_gte_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_fmt_time_gte_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.5 diff --git a/vendor/github.com/ugorji/go/codec/goversion_fmt_time_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_fmt_time_lt_go15.go index 41700c3..9fba3b5 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_fmt_time_lt_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_fmt_time_lt_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.5 diff --git a/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go b/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go index bc39d6b..9f3e60f 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go +++ b/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.9 @@ -8,8 +8,8 @@ package codec import "reflect" func makeMapReflect(t reflect.Type, size int) reflect.Value { - if size < 0 { - return reflect.MakeMapWithSize(t, 4) - } + // if size < 0 { + // return reflect.MakeMapWithSize(t, 4) + // } return reflect.MakeMapWithSize(t, size) } diff --git a/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go b/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go index cde4cd3..15f073e 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go +++ b/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.9 diff --git a/vendor/github.com/ugorji/go/codec/goversion_maprange_gte_go112.go b/vendor/github.com/ugorji/go/codec/goversion_maprange_gte_go112.go index 9931cb6..5978dc0 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_maprange_gte_go112.go +++ b/vendor/github.com/ugorji/go/codec/goversion_maprange_gte_go112.go @@ -1,8 +1,8 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.12 -// +build safe +// +build safe appengine package codec diff --git a/vendor/github.com/ugorji/go/codec/goversion_maprange_lt_go112.go b/vendor/github.com/ugorji/go/codec/goversion_maprange_lt_go112.go index 1f020bd..bd95ae1 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_maprange_lt_go112.go +++ b/vendor/github.com/ugorji/go/codec/goversion_maprange_lt_go112.go @@ -1,8 +1,9 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. +// +build go1.7 // +build !go1.12 -// +build !go1.7 safe +// +build safe appengine package codec diff --git a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go index 794133a..7eba377 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go +++ b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.10 diff --git a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go index fd92ede..1662213 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go +++ b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.10 diff --git a/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go b/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go index 8debfa6..dfd0273 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go +++ b/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go @@ -1,10 +1,12 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.4 package codec +import "errors" + // This codec package will only work for go1.4 and above. // This is for the following reasons: // - go 1.4 was released in 2014 @@ -12,6 +14,8 @@ package codec // - interface only holds pointers // - reflect.Value is stabilized as 3 words +var errCodecSupportedOnlyFromGo14 = errors.New("codec: go 1.3 and below are not supported") + func init() { - panic("codec: go 1.3 and below are not supported") + panic(errCodecSupportedOnlyFromGo14) } diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go index 0f1bb01..f29a056 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.5,!go1.6 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go index 2fb4b05..9b503f2 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.6,!go1.7 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go index c5b8155..72a2fc3 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.7 diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go index 837cf24..31450c9 100644 --- a/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build !go1.5 diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go index 8f7626b..90b4713 100644 --- a/vendor/github.com/ugorji/go/codec/helper.go +++ b/vendor/github.com/ugorji/go/codec/helper.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -128,6 +128,15 @@ package codec // For example, in json, we have dedicated functions for ReadMapElemKey, etc // which do not delegate to readDelim, as readDelim takes a parameter. // The difference in runtime was as much as 5%. +// +// ------------------------------------------ +// Handling Nil +// - In dynamic (reflection) mode, decodeValue and encodeValue handle nil at the top +// - Consequently, methods used with them as a parent in the chain e.g. kXXX +// methods do not handle nil. +// - Fastpath methods also do not handle nil. +// The switch called in (en|de)code(...) handles it so the dependent calls don't have to. +// - codecgen will handle nil before calling into the library for further work also. import ( "bytes" @@ -138,15 +147,26 @@ import ( "io" "math" "reflect" + "runtime" "sort" "strconv" "strings" "sync" "sync/atomic" "time" + "unicode/utf8" ) const ( + // containerLenUnknown is length returned from Read(Map|Array)Len + // when a format doesn't know apiori. + // For example, json doesn't pre-determine the length of a container (sequence/map). + containerLenUnknown = -1 + + // containerLenNil is length returned from Read(Map|Array)Len + // when a 'nil' was encountered in the stream. + containerLenNil = math.MinInt32 + // rvNLen is the length of the array for readn or writen calls rwNLen = 7 @@ -157,9 +177,8 @@ const ( // This constant flag will enable or disable it. supportMarshalInterfaces = true - // for debugging, set this to false, to catch panic traces. - // Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic. - recoverPanicToErr = true + // for debugging, set this to true + bytesFreeListNoCache = false // arrayCacheLen is the length of the cache used in encoder or decoder for // allowing zero-alloc initialization. @@ -172,11 +191,10 @@ const ( wordSizeBits = 32 << (^uint(0) >> 63) // strconv.IntSize wordSize = wordSizeBits / 8 + maxArrayLen = 1<<((32<<(^uint(0)>>63))-1) - 1 + // so structFieldInfo fits into 8 bytes maxLevelsEmbedding = 14 - - // xdebug controls whether xdebugf prints any output - xdebug = true ) var ( @@ -185,16 +203,32 @@ var ( codecgen bool - panicv panicHdl + must mustHdl + halt panicHdl refBitset bitset32 isnilBitset bitset32 scalarBitset bitset32 + + digitCharBitset bitset256 + numCharBitset bitset256 + whitespaceCharBitset bitset256 + + numCharWithExpBitset64 bitset64 + numCharNoExpBitset64 bitset64 + whitespaceCharBitset64 bitset64 ) var ( errMapTypeNotMapKind = errors.New("MapType MUST be of Map Kind") errSliceTypeNotSliceKind = errors.New("SliceType MUST be of Slice Kind") + + errExtFnWriteExtUnsupported = errors.New("BytesExt.WriteExt is not supported") + errExtFnReadExtUnsupported = errors.New("BytesExt.ReadExt is not supported") + errExtFnConvertExtUnsupported = errors.New("InterfaceExt.ConvertExt is not supported") + errExtFnUpdateExtUnsupported = errors.New("InterfaceExt.UpdateExt is not supported") + + errPanicHdlUndefinedErr = errors.New("panic: undefined error") ) var pool4tiload = sync.Pool{New: func() interface{} { return new(typeInfoLoadArray) }} @@ -235,6 +269,26 @@ func init() { set(byte(reflect.Complex128)). set(byte(reflect.String)) + var i byte + for i = 0; i <= utf8.RuneSelf; i++ { + switch i { + case ' ', '\t', '\r', '\n': + whitespaceCharBitset.set(i) + whitespaceCharBitset64 = whitespaceCharBitset64.set(i) + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': + digitCharBitset.set(i) + numCharBitset.set(i) + numCharWithExpBitset64 = numCharWithExpBitset64.set(i - 42) + numCharNoExpBitset64 = numCharNoExpBitset64.set(i) + case '.', '+', '-': + numCharBitset.set(i) + numCharWithExpBitset64 = numCharWithExpBitset64.set(i - 42) + numCharNoExpBitset64 = numCharNoExpBitset64.set(i) + case 'e', 'E': + numCharBitset.set(i) + numCharWithExpBitset64 = numCharWithExpBitset64.set(i - 42) + } + } } type handleFlag uint8 @@ -353,6 +407,33 @@ const ( typeInfoLoadArrayBLen = 8 * 4 ) +// fauxUnion is used to keep track of the primitives decoded. +// +// Without it, we would have to decode each primitive and wrap it +// in an interface{}, causing an allocation. +// In this model, the primitives are decoded in a "pseudo-atomic" fashion, +// so we can rest assured that no other decoding happens while these +// primitives are being decoded. +// +// maps and arrays are not handled by this mechanism. +type fauxUnion struct { + // r RawExt // used for RawExt, uint, []byte. + + // primitives below + u uint64 + i int64 + f float64 + l []byte + s string + + // ---- cpu cache line boundary? + t time.Time + b bool + + // state + v valueType +} + // typeInfoLoad is a transient object used while loading up a typeInfo. type typeInfoLoad struct { etypes []uintptr @@ -384,22 +465,11 @@ type isZeroer interface { type codecError struct { name string - err interface{} + err error } func (e codecError) Cause() error { - switch xerr := e.err.(type) { - case nil: - return nil - case error: - return xerr - case string: - return errors.New(xerr) - case fmt.Stringer: - return errors.New(xerr.String()) - default: - return fmt.Errorf("%v", e.err) - } + return e.err } func (e codecError) Error() string { @@ -543,7 +613,9 @@ type MissingFielder interface { // It returns true if the missing field was set on the struct. CodecMissingField(field []byte, value interface{}) bool - // CodecMissingFields returns the set of fields which are not struct fields + // CodecMissingFields returns the set of fields which are not struct fields. + // + // Note that the returned map may be mutated by the caller. CodecMissingFields() map[string]interface{} } @@ -690,10 +762,10 @@ func (x *BasicHandle) init(hh Handle) { atomic.StoreUint32(&x.inited, uint32(f)) // ensure MapType and SliceType are of correct type if x.MapType != nil && x.MapType.Kind() != reflect.Map { - panic(errMapTypeNotMapKind) + halt.onerror(errMapTypeNotMapKind) } if x.SliceType != nil && x.SliceType.Kind() != reflect.Slice { - panic(errSliceTypeNotSliceKind) + halt.onerror(errSliceTypeNotSliceKind) } } x.mu.Unlock() @@ -927,9 +999,6 @@ func (x *BasicHandle) fnLoad(rt reflect.Type, rtid uintptr, checkExt bool) (fn * case reflect.Float64: fn.fe = (*Encoder).kFloat64 fn.fd = (*Decoder).kFloat64 - case reflect.Invalid: - fn.fe = (*Encoder).kInvalid - fn.fd = (*Decoder).kErr case reflect.Chan: fi.seq = seqTypeChan fn.fe = (*Encoder).kChan @@ -997,6 +1066,8 @@ type Handle interface { newEncDriver() encDriver newDecDriver() decDriver isBinary() bool + // desc describes the current byte descriptor, or returns "unknown[XXX]" if not understood. + desc(bd byte) string } // Raw represents raw formatted bytes. @@ -1068,16 +1139,12 @@ type addExtWrapper struct { func (x addExtWrapper) WriteExt(v interface{}) []byte { bs, err := x.encFn(rv4i(v)) - if err != nil { - panic(err) - } + halt.onerror(err) return bs } func (x addExtWrapper) ReadExt(v interface{}, bs []byte) { - if err := x.decFn(rv4i(v), bs); err != nil { - panic(err) - } + halt.onerror(x.decFn(rv4i(v), bs)) } func (x addExtWrapper) ConvertExt(v interface{}) interface{} { @@ -1091,21 +1158,21 @@ func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) { type bytesExtFailer struct{} func (bytesExtFailer) WriteExt(v interface{}) []byte { - panicv.errorstr("BytesExt.WriteExt is not supported") + halt.onerror(errExtFnWriteExtUnsupported) return nil } func (bytesExtFailer) ReadExt(v interface{}, bs []byte) { - panicv.errorstr("BytesExt.ReadExt is not supported") + halt.onerror(errExtFnReadExtUnsupported) } type interfaceExtFailer struct{} func (interfaceExtFailer) ConvertExt(v interface{}) interface{} { - panicv.errorstr("InterfaceExt.ConvertExt is not supported") + halt.onerror(errExtFnConvertExtUnsupported) return nil } func (interfaceExtFailer) UpdateExt(dest interface{}, v interface{}) { - panicv.errorstr("InterfaceExt.UpdateExt is not supported") + halt.onerror(errExtFnUpdateExtUnsupported) } type bytesExtWrapper struct { @@ -1698,7 +1765,7 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { rk := rt.Kind() if rk == reflect.Ptr { // || (rk == reflect.Interface && rtid != intfTypId) { - panicv.errorf("invalid kind passed to TypeInfos.get: %v - %v", rk, rt) + halt.errorf("invalid kind passed to TypeInfos.get: %v - %v", rk, rt) } // do not hold lock while computing this. @@ -1807,7 +1874,7 @@ func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool, // and iteration using equals is faster than maps there flen := rt.NumField() if flen > (1< %v fields are not supported - has %v fields", + halt.errorf("codec: types with > %v fields are not supported - has %v fields", (1< maxLevelsEmbedding-1 { - panicv.errorf("codec: only supports up to %v depth of embedding - type has %v depth", + halt.errorf("codec: only supports up to %v depth of embedding - type has %v depth", maxLevelsEmbedding-1, len(indexstack)) } si.nis = uint8(len(indexstack)) + 1 @@ -2022,7 +2089,7 @@ func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray) n++ } if n != len(y) { - panicv.errorf("failure reading struct %v - expecting %d of %d valid fields, got %d", + halt.errorf("failure reading struct %v - expecting %d of %d valid fields, got %d", rt, len(y), len(x), n) } @@ -2104,24 +2171,26 @@ func isEmptyStruct(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) func panicToErr(h errDecorator, err *error) { // Note: This method MUST be called directly from defer i.e. defer panicToErr ... // else it seems the recover is not fully handled - if recoverPanicToErr { - if x := recover(); x != nil { - // fmt.Printf("panic'ing with: %v\n", x) - // debug.PrintStack() - panicValToErr(h, x, err) - } + if x := recover(); x != nil { + panicValToErr(h, x, err) } } func isSliceBoundsError(s string) bool { - return strings.Contains(s, "index out of range") || - strings.Contains(s, "slice bounds out of range") + return strings.Contains(s, " out of range") && + (strings.Contains(s, "index") || strings.Contains(s, "slice bounds")) } func panicValToErr(h errDecorator, v interface{}, err *error) { - d, dok := h.(*Decoder) switch xerr := v.(type) { case nil: + case runtime.Error: + d, dok := h.(*Decoder) + if dok && d.bytes && isSliceBoundsError(xerr.Error()) { + *err = io.EOF + } else { + h.wrapErr(xerr, err) + } case error: switch xerr { case nil: @@ -2129,26 +2198,11 @@ func panicValToErr(h errDecorator, v interface{}, err *error) { // treat as special (bubble up) *err = xerr default: - if dok && d.bytes && isSliceBoundsError(xerr.Error()) { - *err = io.EOF - } else { - h.wrapErr(xerr, err) - } - } - case string: - if xerr != "" { - if dok && d.bytes && isSliceBoundsError(xerr) { - *err = io.EOF - } else { - h.wrapErr(xerr, err) - } - } - case fmt.Stringer: - if xerr != nil { h.wrapErr(xerr, err) } default: - h.wrapErr(v, err) + // we don't expect this to happen (as this library always panics with an error) + h.wrapErr(fmt.Errorf("%v", v), err) } } @@ -2159,13 +2213,13 @@ func isImmutableKind(k reflect.Kind) (v bool) { } func usableByteSlice(bs []byte, slen int) []byte { - if cap(bs) >= slen { - if bs == nil { - return []byte{} - } - return bs[:slen] + if cap(bs) < slen { + return make([]byte, slen) } - return make([]byte, slen) + if bs == nil { + return []byte{} + } + return bs[:slen] } // ---- @@ -2229,7 +2283,7 @@ func baseRV(v interface{}) (rv reflect.Value) { type checkOverflow struct{} // func (checkOverflow) Float16(f float64) (overflow bool) { -// panicv.errorf("unimplemented") +// halt.errorf("unimplemented") // if f < 0 { // f = -f // } @@ -2243,23 +2297,34 @@ func (checkOverflow) Float32(v float64) (overflow bool) { return math.MaxFloat32 < v && v <= math.MaxFloat64 } func (checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { - if bitsize == 0 || bitsize >= 64 || v == 0 { - return - } - if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc { + // if bitsize == 0 || bitsize >= 64 || v == 0 { + // if v == 0 { + // return + // } + // if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc { + if v != 0 && v != (v<<(64-bitsize))>>(64-bitsize) { overflow = true } return } func (checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { - if bitsize == 0 || bitsize >= 64 || v == 0 { - return - } - if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc { + // if bitsize == 0 || bitsize >= 64 || v == 0 { + // if v == 0 { + // return + // } + // if trunc := (v << (64 - bitsize)) >> (64 - bitsize); v != trunc { + // overflow = true + // } + if v != 0 && v != (v<<(64-bitsize))>>(64-bitsize) { overflow = true } return } + +func (checkOverflow) Uint2Int(v uint64, neg bool) (overflow bool) { + return (neg && v > 1<<63) || (!neg && v >= 1<<63) +} + func (checkOverflow) SignedInt(v uint64) (overflow bool) { //e.g. -127 to 128 for int8 pos := (v >> 63) == 0 @@ -2278,25 +2343,25 @@ func (checkOverflow) SignedInt(v uint64) (overflow bool) { func (x checkOverflow) Float32V(v float64) float64 { if x.Float32(v) { - panicv.errorf("float32 overflow: %v", v) + halt.errorf("float32 overflow: %v", v) } return v } func (x checkOverflow) UintV(v uint64, bitsize uint8) uint64 { if x.Uint(v, bitsize) { - panicv.errorf("uint64 overflow: %v", v) + halt.errorf("uint64 overflow: %v", v) } return v } func (x checkOverflow) IntV(v int64, bitsize uint8) int64 { if x.Int(v, bitsize) { - panicv.errorf("int64 overflow: %v", v) + halt.errorf("int64 overflow: %v", v) } return v } func (x checkOverflow) SignedIntV(v uint64) int64 { if x.SignedInt(v) { - panicv.errorf("uint64 to int64 overflow: %v", v) + halt.errorf("uint64 to int64 overflow: %v", v) } return int64(v) } @@ -2304,7 +2369,6 @@ func (x checkOverflow) SignedIntV(v uint64) int64 { // ------------------ FLOATING POINT ----------------- func isNaN64(f float64) bool { return f != f } -func isNaN32(f float32) bool { return f != f } func abs32(f float32) float32 { return math.Float32frombits(math.Float32bits(f) &^ (1 << 31)) } @@ -2343,6 +2407,31 @@ func noFrac32(f float32) (v bool) { return } +func isWhitespaceChar(v byte) bool { + // these are in order of speed below ... + + return v < 33 + // return v < 33 && whitespaceCharBitset64.isset(v) + // return v < 33 && (v == ' ' || v == '\n' || v == '\t' || v == '\r') + // return v == ' ' || v == '\n' || v == '\t' || v == '\r' + // return whitespaceCharBitset.isset(v) +} + +func isNumberChar(v byte) bool { + // these are in order of speed below ... + + return numCharBitset.isset(v) + // return v < 64 && numCharNoExpBitset64.isset(v) || v == 'e' || v == 'E' + // return v > 42 && v < 102 && numCharWithExpBitset64.isset(v-42) +} + +func isDigitChar(v byte) bool { + // these are in order of speed below ... + + return digitCharBitset.isset(v) + // return v >= '0' && v <= '9' +} + // func noFrac(f float64) bool { // _, frac := math.Modf(float64(f)) // return frac == 0 @@ -2451,23 +2540,17 @@ func (s *set) remove(v interface{}) (exists bool) { // given x > 0 and n > 0 and x is exactly 2^n, then pos/x === pos>>n AND pos%x === pos&(x-1). // consequently, pos/32 === pos>>5, pos/16 === pos>>4, pos/8 === pos>>3, pos%8 == pos&7 -type bitset256 [32]byte +// MARKER: we noticed a little performance degradation when using bitset256 as [32]byte. +// Consequently, we are using a [256]bool only for bitset256. +// We decided not to do the same for bitset32 and bitset64 (hence the discrepancy). -func (x *bitset256) check(pos byte) uint8 { - return x[pos>>3] & (1 << (pos & 7)) -} - -func (x *bitset256) isset(pos byte) bool { - return x.check(pos) != 0 - // return x[pos>>3]&(1<<(pos&7)) != 0 -} - -// func (x *bitset256) issetv(pos byte) byte { -// return x[pos>>3] & (1 << (pos & 7)) -// } +type bitset256 [256]bool func (x *bitset256) set(pos byte) { - x[pos>>3] |= (1 << (pos & 7)) + x[pos] = true +} +func (x *bitset256) isset(pos byte) bool { + return x[pos] } type bitset32 uint32 @@ -2475,104 +2558,77 @@ type bitset32 uint32 func (x bitset32) set(pos byte) bitset32 { return x | (1 << pos) } - -func (x bitset32) check(pos byte) uint32 { - return uint32(x) & (1 << pos) -} func (x bitset32) isset(pos byte) bool { - return x.check(pos) != 0 - // return x&(1<>3] &^= (1 << (pos & 7)) -// } +type bitset64 uint64 -// type bit2set256 [64]byte - -// func (x *bit2set256) set(pos byte, v1, v2 bool) { -// var pos2 uint8 = (pos & 3) << 1 // returning 0, 2, 4 or 6 -// if v1 { -// x[pos>>2] |= 1 << (pos2 + 1) -// } -// if v2 { -// x[pos>>2] |= 1 << pos2 -// } -// } -// func (x *bit2set256) get(pos byte) uint8 { -// var pos2 uint8 = (pos & 3) << 1 // returning 0, 2, 4 or 6 -// return x[pos>>2] << (6 - pos2) >> 6 // 11000000 -> 00000011 -// } +func (x bitset64) set(pos byte) bitset64 { + return x | (1 << pos) +} +func (x bitset64) isset(pos byte) bool { + return uint64(x)&(1<= length && (j == -1 || cap((*x)[j]) > cap((*x)[i])) { + for i := range y { + if cap(y[i]) >= length && (j == -1 || cap(y[i]) < cap(y[j])) { j = i } } if j == -1 { return make([]byte, length, freelistCapacity(length)) } - out = (*x)[j][:length] - (*x)[j] = nil - for i := 0; i < len(out); i++ { + out = y[j][:length] + y[j] = nil + for i := range out { // memclr/memset out[i] = 0 } return } func (x *bytesFreelist) put(v []byte) { - if len(v) == 0 { + if bytesFreeListNoCache { return } - for i := 0; i < len(*x); i++ { - if cap((*x)[i]) == 0 { - (*x)[i] = v + if cap(v) == 0 { + return + } + y := *x + for i := range y { + if cap(y[i]) == 0 { + y[i] = v return } } - *x = append(*x, v) + *x = append(y, v) } func (x *bytesFreelist) check(v []byte, length int) (out []byte) { @@ -2649,34 +2713,3 @@ func (x *sfiRvFreelist) put(v []sfiRv) { } *x = append(*x, v) } - -// ----------- - -// xdebugf printf. the message in red on the terminal. -// Use it in place of fmt.Printf (which it calls internally) -func xdebugf(pattern string, args ...interface{}) { - xdebugAnyf("31", pattern, args...) -} - -// xdebug2f printf. the message in blue on the terminal. -// Use it in place of fmt.Printf (which it calls internally) -func xdebug2f(pattern string, args ...interface{}) { - xdebugAnyf("34", pattern, args...) -} - -func xdebugAnyf(colorcode, pattern string, args ...interface{}) { - if !xdebug { - return - } - var delim string - if len(pattern) > 0 && pattern[len(pattern)-1] != '\n' { - delim = "\n" - } - fmt.Printf("\033[1;"+colorcode+"m"+pattern+delim+"\033[0m", args...) - // os.Stderr.Flush() -} - -// register these here, so that staticcheck stops barfing -var _ = xdebug2f -var _ = xdebugf -var _ = isNaN32 diff --git a/vendor/github.com/ugorji/go/codec/helper_internal.go b/vendor/github.com/ugorji/go/codec/helper_internal.go index 82d6e31..5a491f9 100644 --- a/vendor/github.com/ugorji/go/codec/helper_internal.go +++ b/vendor/github.com/ugorji/go/codec/helper_internal.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -18,27 +18,26 @@ func pruneSignExt(v []byte, pos bool) (n int) { return } -// validate that this function is correct ... -// culled from OGRE (Object-Oriented Graphics Rendering Engine) -// function: halfToFloatI (http://stderr.org/doc/ogre-doc/api/OgreBitwise_8h-source.html) -func halfFloatToFloatBits(yy uint16) (d uint32) { - y := uint32(yy) - s := (y >> 15) & 0x01 - e := (y >> 10) & 0x1f - m := y & 0x03ff +func halfFloatToFloatBits(h uint16) (f uint32) { + // retrofitted from: + // - OGRE (Object-Oriented Graphics Rendering Engine) + // function: halfToFloatI https://www.ogre3d.org/docs/api/1.9/_ogre_bitwise_8h_source.html + + s := uint32(h >> 15) + m := uint32(h & 0x03ff) + e := int32((h >> 10) & 0x1f) if e == 0 { - if m == 0 { // plu or minus 0 + if m == 0 { // plus or minus 0 return s << 31 } // Denormalized number -- renormalize it - for (m & 0x00000400) == 0 { + for (m & 0x0400) == 0 { m <<= 1 e -= 1 } e += 1 - const zz uint32 = 0x0400 - m &= ^zz + m &= ^uint32(0x0400) } else if e == 31 { if m == 0 { // Inf return (s << 31) | 0x7f800000 @@ -47,7 +46,47 @@ func halfFloatToFloatBits(yy uint16) (d uint32) { } e = e + (127 - 15) m = m << 13 - return (s << 31) | (e << 23) | m + return (s << 31) | (uint32(e) << 23) | m +} + +func floatToHalfFloatBits(i uint32) (h uint16) { + // retrofitted from: + // - OGRE (Object-Oriented Graphics Rendering Engine) + // function: halfToFloatI https://www.ogre3d.org/docs/api/1.9/_ogre_bitwise_8h_source.html + // - http://www.java2s.com/example/java-utility-method/float-to/floattohalf-float-f-fae00.html + s := (i >> 16) & 0x8000 + e := int32(((i >> 23) & 0xff) - (127 - 15)) + m := i & 0x7fffff + + var h32 uint32 + + if e <= 0 { + if e < -10 { // zero + h32 = s // track -0 vs +0 + } else { + m = (m | 0x800000) >> uint32(1-e) + h32 = s | (m >> 13) + } + } else if e == 0xff-(127-15) { + if m == 0 { // Inf + h32 = s | 0x7c00 + } else { // NAN + m >>= 13 + var me uint32 + if m == 0 { + me = 1 + } + h32 = s | 0x7c00 | m | me + } + } else { + if e > 30 { // Overflow + h32 = s | 0x7c00 + } else { + h32 = s | (uint32(e) << 10) | (m >> 13) + } + } + h = uint16(h32) + return } // GrowCap will return a new capacity for a slice, given the following: @@ -60,65 +99,49 @@ func growCap(oldCap, unit, num int) (newCap int) { // bytes.Buffer model (2*cap + n): much better for bytes. // smarter way is to take the byte-size of the appended element(type) into account - // maintain 3 thresholds: + // maintain 1 thresholds: // t1: if cap <= t1, newcap = 2x - // t2: if cap <= t2, newcap = 1.75x - // t3: if cap <= t3, newcap = 1.5x - // else newcap = 1.25x + // else newcap = 1.5x // - // t1, t2, t3 >= 1024 always. - // i.e. if unit size >= 16, then always do 2x or 1.25x (ie t1, t2, t3 are all same) + // t1 is always >= 1024. + // This means that, if unit size >= 16, then always do 2x or 1.5x (ie t1, t2, t3 are all same) // // With this, appending for bytes increase by: // 100% up to 4K - // 75% up to 8K - // 50% up to 16K - // 25% beyond that + // 50% beyond that // unit can be 0 e.g. for struct{}{}; handle that appropriately - var t1, t2, t3 int // thresholds - if unit <= 1 { - t1, t2, t3 = 4*1024, 8*1024, 16*1024 - } else if unit < 16 { - t3 = 16 / unit * 1024 - t1 = t3 * 1 / 4 - t2 = t3 * 2 / 4 - } else { - t1, t2, t3 = 1024, 1024, 1024 + if unit <= 0 { + return maxArrayLen } - var x int // temporary variable + // handle if num < 0, cap=0, etc. - // x is multiplier here: one of 5, 6, 7 or 8; incr of 25%, 50%, 75% or 100% respectively - if oldCap <= t1 { // [0,t1] - x = 8 - } else if oldCap > t3 { // (t3,infinity] - x = 5 - } else if oldCap <= t2 { // (t1,t2] - x = 7 - } else { // (t2,t3] - x = 6 - } - newCap = x * oldCap / 4 - - if num > 0 { - newCap += num - } - if newCap <= oldCap { - newCap = oldCap + 1 + var t1 int = 1024 // default thresholds for large values + if unit <= 4 { + t1 = 8 * 1024 + } else if unit <= 16 { + t1 = 2 * 1024 } - // ensure newCap is a multiple of 64 (if it is > 64) or 16. - if newCap > 64 { - if x = newCap % 64; x != 0 { - x = newCap / 64 - newCap = 64 * (x + 1) - } - } else { - if x = newCap % 16; x != 0 { - x = newCap / 16 - newCap = 16 * (x + 1) - } + if oldCap <= 0 { + newCap = 2 + } else if oldCap <= t1 { // [0,t1] + newCap = oldCap * 2 + } else { // (t1,infinity] + newCap = oldCap * 3 / 2 } + + if num > 0 && newCap < num+oldCap { + newCap = num + oldCap + } + + // ensure newCap takes multiples of a cache line (size is a multiple of 64) + t1 = newCap * unit + if t2 := t1 % 64; t2 != 0 { + t1 += 64 - t2 + newCap = t1 / unit + } + return } diff --git a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go index 4572c6f..b60bf62 100644 --- a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go @@ -1,6 +1,6 @@ // +build !go1.7 safe appengine -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -155,25 +155,25 @@ func (x *atomicRtidFnSlice) store(p []codecRtidFn) { } // -------------------------- -func (n *decNaked) ru() reflect.Value { +func (n *fauxUnion) ru() reflect.Value { return rv4i(&n.u).Elem() } -func (n *decNaked) ri() reflect.Value { +func (n *fauxUnion) ri() reflect.Value { return rv4i(&n.i).Elem() } -func (n *decNaked) rf() reflect.Value { +func (n *fauxUnion) rf() reflect.Value { return rv4i(&n.f).Elem() } -func (n *decNaked) rl() reflect.Value { +func (n *fauxUnion) rl() reflect.Value { return rv4i(&n.l).Elem() } -func (n *decNaked) rs() reflect.Value { +func (n *fauxUnion) rs() reflect.Value { return rv4i(&n.s).Elem() } -func (n *decNaked) rt() reflect.Value { +func (n *fauxUnion) rt() reflect.Value { return rv4i(&n.t).Elem() } -func (n *decNaked) rb() reflect.Value { +func (n *fauxUnion) rb() reflect.Value { return rv4i(&n.b).Elem() } diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go index 9a22ccf..3213b41 100644 --- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_unsafe.go @@ -2,7 +2,7 @@ // +build !appengine // +build go1.7 -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -15,7 +15,7 @@ import ( ) // This file has unsafe variants of some helper methods. -// NOTE: See helper_not_unsafe.go for the usage information. +// MARKER: See helper_not_unsafe.go for the usage information. // For reflect.Value code, we decided to do the following: // - if we know the kind, we can elide conditional checks for @@ -27,7 +27,7 @@ import ( const safeMode = false -// keep in sync with GO_ROOT/src/reflect/value.go +// MARKER: keep in sync with GO_ROOT/src/reflect/value.go const ( unsafeFlagIndir = 1 << 7 unsafeFlagAddr = 1 << 8 @@ -73,21 +73,6 @@ func bytesView(v string) []byte { return *(*[]byte)(unsafe.Pointer(&unsafeSlice{sx.Data, sx.Len, sx.Len})) } -// // isNilRef says whether the interface is a nil reference or not. -// // -// // A reference here is a pointer-sized reference i.e. map, ptr, chan, func, unsafepointer. -// // It is optional to extend this to also check if slices or interfaces are nil also. -// // -// // NOTE: There is no global way of checking if an interface is nil. -// // For true references (map, ptr, func, chan), you can just look -// // at the word of the interface. -// // However, for slices, you have to dereference -// // the word, and get a pointer to the 3-word interface value. -// func isNilRef(v interface{}) (rv reflect.Value, isnil bool) { -// isnil = ((*unsafeIntf)(unsafe.Pointer(&v))).word == nil -// return -// } - func isNil(v interface{}) (rv reflect.Value, isnil bool) { var ui = (*unsafeIntf)(unsafe.Pointer(&v)) if ui.word == nil { @@ -297,15 +282,15 @@ func (x *atomicClsErr) store(p clsErr) { // -------------------------- -// to create a reflect.Value for each member field of decNaked, -// we first create a global decNaked, and create reflect.Value +// to create a reflect.Value for each member field of fauxUnion, +// we first create a global fauxUnion, and create reflect.Value // for them all. // This way, we have the flags and type in the reflect.Value. // Then, when a reflect.Value is called, we just copy it, -// update the ptr to the decNaked's, and return it. +// update the ptr to the fauxUnion's, and return it. type unsafeDecNakedWrapper struct { - decNaked + fauxUnion ru, ri, rf, rl, rs, rb, rt reflect.Value // mapping to the primitives above } @@ -326,37 +311,37 @@ func init() { defUnsafeDecNakedWrapper.init() } -func (n *decNaked) ru() (v reflect.Value) { +func (n *fauxUnion) ru() (v reflect.Value) { v = defUnsafeDecNakedWrapper.ru ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.u) return } -func (n *decNaked) ri() (v reflect.Value) { +func (n *fauxUnion) ri() (v reflect.Value) { v = defUnsafeDecNakedWrapper.ri ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.i) return } -func (n *decNaked) rf() (v reflect.Value) { +func (n *fauxUnion) rf() (v reflect.Value) { v = defUnsafeDecNakedWrapper.rf ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.f) return } -func (n *decNaked) rl() (v reflect.Value) { +func (n *fauxUnion) rl() (v reflect.Value) { v = defUnsafeDecNakedWrapper.rl ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.l) return } -func (n *decNaked) rs() (v reflect.Value) { +func (n *fauxUnion) rs() (v reflect.Value) { v = defUnsafeDecNakedWrapper.rs ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.s) return } -func (n *decNaked) rt() (v reflect.Value) { +func (n *fauxUnion) rt() (v reflect.Value) { v = defUnsafeDecNakedWrapper.rt ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.t) return } -func (n *decNaked) rb() (v reflect.Value) { +func (n *fauxUnion) rb() (v reflect.Value) { v = defUnsafeDecNakedWrapper.rb ((*unsafeReflectValue)(unsafe.Pointer(&v))).ptr = unsafe.Pointer(&n.b) return @@ -843,7 +828,7 @@ func (e *Encoder) jsondriver() *jsonEncDriver { // ---------- DECODER optimized --------------- func (d *Decoder) checkBreak() bool { - // jsonDecDriver.CheckBreak() CANNOT be inlined. + // MARKER: jsonDecDriver.CheckBreak() CANNOT be inlined. // Consequently, there's no benefit in incurring the cost of this // wrapping function checkBreak. // diff --git a/vendor/github.com/ugorji/go/codec/json.go b/vendor/github.com/ugorji/go/codec/json.go index 7b64e02..afdc4ea 100644 --- a/vendor/github.com/ugorji/go/codec/json.go +++ b/vendor/github.com/ugorji/go/codec/json.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -87,10 +87,8 @@ var ( // jsonTabs and jsonSpaces are used as caches for indents jsonTabs, jsonSpaces [jsonSpacesOrTabsLen]byte - jsonCharHtmlSafeSet bitset256 - jsonCharSafeSet bitset256 - jsonCharWhitespaceSet bitset256 - jsonNumSet bitset256 + jsonCharHtmlSafeSet bitset256 + jsonCharSafeSet bitset256 ) func init() { @@ -113,14 +111,6 @@ func init() { jsonCharHtmlSafeSet.set(i) } } - for i = 0; i <= utf8.RuneSelf; i++ { - switch i { - case ' ', '\t', '\r', '\n': - jsonCharWhitespaceSet.set(i) - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e', 'E', '.', '+', '-': - jsonNumSet.set(i) - } - } } // ---------------- @@ -141,15 +131,13 @@ type jsonEncDriver struct { typical bool s *bitset256 // safe set for characters (taking h.HTMLAsIs into consideration) + // scratch: encode time, numbers, etc. Note: leave 1 byte for containerState b [cacheLineSize + 24]byte // buffer for encoding numbers and time e Encoder } -// Keep writeIndent, WriteArrayElem, WriteMapElemKey, WriteMapElemValue -// in jsonEncDriver, so that *Encoder can directly call them - func (e *jsonEncDriver) encoder() *Encoder { return &e.e } func (e *jsonEncDriver) writeIndent() { @@ -203,7 +191,7 @@ func (e *jsonEncDriver) EncodeNil() { // ie if initial token is n. // e.e.encWr.writeb(jsonLiteralNull) - e.e.encWr.writen([rwNLen]byte{'n', 'u', 'l', 'l'}, 4) + e.e.encWr.writen4('n', 'u', 'l', 'l') } func (e *jsonEncDriver) EncodeTime(t time.Time) { @@ -247,15 +235,19 @@ func (e *jsonEncDriver) EncodeBool(b bool) { if e.ks && e.e.c == containerMapKey { if b { - e.e.encWr.writen([rwNLen]byte{'"', 't', 'r', 'u', 'e', '"'}, 6) + e.e.encWr.writen4('"', 't', 'r', 'u') + e.e.encWr.writen2('e', '"') } else { - e.e.encWr.writen([rwNLen]byte{'"', 'f', 'a', 'l', 's', 'e', '"'}, 7) + e.e.encWr.writen4('"', 'f', 'a', 'l') + e.e.encWr.writen2('s', 'e') + e.e.encWr.writen1('"') } } else { if b { - e.e.encWr.writen([rwNLen]byte{'t', 'r', 'u', 'e'}, 4) + e.e.encWr.writen4('t', 'r', 'u', 'e') } else { - e.e.encWr.writen([rwNLen]byte{'f', 'a', 'l', 's', 'e'}, 5) + e.e.encWr.writen4('f', 'a', 'l', 's') + e.e.encWr.writen1('e') } } } @@ -274,11 +266,19 @@ func (e *jsonEncDriver) encodeFloat(f float64, bitsize, fmt byte, prec int8) { } func (e *jsonEncDriver) EncodeFloat64(f float64) { + if math.IsNaN(f) || math.IsInf(f, 0) { + e.EncodeNil() + return + } fmt, prec := jsonFloatStrconvFmtPrec64(f) e.encodeFloat(f, 64, fmt, prec) } func (e *jsonEncDriver) EncodeFloat32(f float32) { + if math.IsNaN(float64(f)) || math.IsInf(float64(f), 0) { + e.EncodeNil() + return + } fmt, prec := jsonFloatStrconvFmtPrec32(f) e.encodeFloat(float64(f), 32, fmt, prec) } @@ -393,18 +393,18 @@ func (e *jsonEncDriver) quoteStr(s string) { // if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { // if (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) { - b := s[i] - if e.s.isset(b) { + if e.s.isset(s[i]) { i++ continue } - if b < utf8.RuneSelf { + // b := s[i] + if s[i] < utf8.RuneSelf { if start < i { w.writestr(s[start:i]) } - switch b { + switch s[i] { case '\\', '"': - w.writen2('\\', b) + w.writen2('\\', s[i]) case '\n': w.writen2('\\', 'n') case '\r': @@ -417,7 +417,7 @@ func (e *jsonEncDriver) quoteStr(s string) { w.writen2('\\', 't') default: w.writestr(`\u00`) - w.writen2(hex[b>>4], hex[b&0xF]) + w.writen2(hex[s[i]>>4], hex[s[i]&0xF]) } i++ start = i @@ -425,15 +425,15 @@ func (e *jsonEncDriver) quoteStr(s string) { } c, size := utf8.DecodeRuneInString(s[i:]) if c == utf8.RuneError { - if size == 1 { + if size == 1 { // meaning invalid encoding (so output as-is) if start < i { w.writestr(s[start:i]) } - w.writestr(`\ufffd`) + w.writestr(`\uFFFD`) i++ start = i + continue } - continue } // U+2028 is LINE SEPARATOR. U+2029 is PARAGRAPH SEPARATOR. // Both technically valid JSON, but bomb on JSONP, so fix here unconditionally. @@ -472,7 +472,7 @@ type jsonDecDriver struct { h *JsonHandle tok uint8 // used to store the token read right after skipWhiteSpace - fnil bool // found null + _ bool // found null _ [2]byte // padding bstr [4]byte // scratch used for string \UXXX parsing @@ -486,50 +486,50 @@ type jsonDecDriver struct { d Decoder } -// func jsonIsWS(b byte) bool { -// // return b == ' ' || b == '\t' || b == '\r' || b == '\n' -// return jsonCharWhitespaceSet.isset(b) -// } - func (d *jsonDecDriver) decoder() *Decoder { return &d.d } -func (d *jsonDecDriver) uncacheRead() { - if d.tok != 0 { - d.d.decRd.unreadn1() - d.tok = 0 - } -} - func (d *jsonDecDriver) ReadMapStart() int { d.advance() if d.tok == 'n' { d.readLit4Null() - return decContainerLenNil + return containerLenNil } if d.tok != '{' { d.d.errorf("read map - expect char '%c' but got char '%c'", '{', d.tok) } d.tok = 0 - return decContainerLenUnknown + return containerLenUnknown } func (d *jsonDecDriver) ReadArrayStart() int { d.advance() if d.tok == 'n' { d.readLit4Null() - return decContainerLenNil + return containerLenNil } if d.tok != '[' { d.d.errorf("read array - expect char '%c' but got char '%c'", '[', d.tok) } d.tok = 0 - return decContainerLenUnknown + return containerLenUnknown +} + +// skipWhitespaceForCheckBreak so that CheckBreak will be inlined +// and only incur a function call if needed. +// +// MARKER: keep in sync with jsonDecDriver.advance() +// +//go:noinline +func (d *jsonDecDriver) skipWhitespaceForCheckBreak() { + d.tok = d.d.decRd.skipWhitespace() } func (d *jsonDecDriver) CheckBreak() bool { - d.advance() + if d.tok == 0 { + d.skipWhitespaceForCheckBreak() + } return d.tok == '}' || d.tok == ']' } @@ -616,16 +616,71 @@ func (d *jsonDecDriver) readLit4Null() { if jsonValidateSymbols && bs != [rwNLen]byte{'u', 'l', 'l'} { // !Equal jsonLiteral4Null d.d.errorf("expecting %s: got %s", jsonLiteral4Null, bs) } - d.fnil = true } func (d *jsonDecDriver) advance() { if d.tok == 0 { - d.fnil = false - d.tok = d.d.decRd.skip(&jsonCharWhitespaceSet) + d.tok = d.d.decRd.skipWhitespace() // skip(&whitespaceCharBitset) } } +func (d *jsonDecDriver) nextValueBytes(start []byte) (v []byte) { + v = start + consumeString := func() { + for { + c := d.d.decRd.readn1() + v = append(v, c) + if c == '"' { + break + } + if c == '\\' { + v = append(v, d.d.decRd.readn1()) + } + } + } + + d.advance() + + switch d.tok { + default: + v = append(v, d.d.decRd.jsonReadNum()...) + case 'n': + d.readLit4Null() + v = append(v, jsonLiteralNull...) + case 'f': + d.readLit4False() + v = append(v, jsonLiteralFalse...) + case 't': + d.readLit4True() + v = append(v, jsonLiteralTrue...) + case '"': + v = append(v, '"') + consumeString() + case '{', '[': + var elem struct{} + var stack []struct{} + + stack = append(stack, elem) + + v = append(v, d.tok) + + for len(stack) != 0 { + c := d.d.decRd.readn1() + v = append(v, c) + switch c { + case '"': + consumeString() + case '{', '[': + stack = append(stack, elem) + case '}', ']': + stack = stack[:len(stack)-1] + } + } + } + d.tok = 0 + return +} + func (d *jsonDecDriver) TryNil() bool { d.advance() // we shouldn't try to see if quoted "null" was here, right? @@ -637,10 +692,6 @@ func (d *jsonDecDriver) TryNil() bool { return false } -func (d *jsonDecDriver) Nil() bool { - return d.fnil -} - func (d *jsonDecDriver) DecodeBool() (v bool) { d.advance() if d.tok == 'n' { @@ -675,10 +726,10 @@ func (d *jsonDecDriver) DecodeTime() (t time.Time) { d.readLit4Null() return } - bs := d.readString() + bs := d.readUnescapedString() t, err := time.Parse(time.RFC3339, stringView(bs)) if err != nil { - d.d.errorv(err) + d.d.onerror(err) } return } @@ -712,8 +763,7 @@ func (d *jsonDecDriver) decNumBytes() (bs []byte) { } else if d.tok == 'n' { d.readLit4Null() } else { - d.d.decRd.unreadn1() - bs = d.d.decRd.readTo(&jsonNumSet) + bs = d.d.decRd.jsonReadNum() } d.tok = 0 return @@ -724,83 +774,89 @@ func (d *jsonDecDriver) DecodeUint64() (u uint64) { if len(bs) == 0 { return } - n, neg, badsyntax, overflow := jsonParseInteger(bs) - if overflow { - d.d.errorf("overflow parsing unsigned integer: %s", bs) - } else if neg { - d.d.errorf("minus found parsing unsigned integer: %s", bs) - } else if badsyntax { - // fallback: try to decode as float, and cast - n = d.decUint64ViaFloat(bs) + if bs[0] == '-' { + d.d.errorf("negative number cannot be decoded as uint64") } - return n -} - -func (d *jsonDecDriver) DecodeInt64() (i int64) { - const cutoff = uint64(1 << uint(64-1)) - bs := d.decNumBytes() - if len(bs) == 0 { + var r readFloatResult + u, r.ok = parseUint64_simple(bs) + if r.ok { return } - n, neg, badsyntax, overflow := jsonParseInteger(bs) - if overflow { - d.d.errorf("overflow parsing integer: %s", bs) - } else if badsyntax { - // d.d.errorf("invalid syntax for integer: %s", bs) - // fallback: try to decode as float, and cast - if neg { - n = d.decUint64ViaFloat(bs[1:]) - } else { - n = d.decUint64ViaFloat(bs) + + r = readFloat(bs, fi64u) + if r.ok { + u, r.bad = parseUint64_reader(r) + if r.bad { + d.d.onerror(strconvParseErr(bs, "ParseUint")) } + return } - if neg { - if n > cutoff { - d.d.errorf("overflow parsing integer: %s", bs) - } - i = -(int64(n)) - } else { - if n >= cutoff { - d.d.errorf("overflow parsing integer: %s", bs) - } - i = int64(n) - } + d.d.onerror(strconvParseErr(bs, "ParseUint")) return } -func (d *jsonDecDriver) decUint64ViaFloat(s []byte) (u uint64) { - if len(s) == 0 { +func (d *jsonDecDriver) DecodeInt64() (v int64) { + b := d.decNumBytes() + if len(b) == 0 { return } - f, err := parseFloat64(s) - if err != nil { - d.d.errorf("invalid syntax for integer: %s", s) + + var r readFloatResult + var neg bool + + if b[0] == '-' { + neg = true + b = b[1:] } - fi, ff := math.Modf(f) - if ff > 0 { - d.d.errorf("fractional part found parsing integer: %s", s) - } else if fi > float64(math.MaxUint64) { - d.d.errorf("overflow parsing integer: %s", s) + + r.mantissa, r.ok = parseUint64_simple(b) + if r.ok { + if chkOvf.Uint2Int(r.mantissa, neg) { + d.d.errorf("overflow decoding number from %s", b) + } + if neg { + v = -int64(r.mantissa) + } else { + v = int64(r.mantissa) + } + return } - return uint64(fi) + + r = readFloat(b, fi64i) + if r.ok { + r.neg = neg + v, r.bad = parseInt64_reader(r) + if r.bad { + d.d.onerror(strconvParseErr(b, "ParseInt")) + } + return + } + d.d.onerror(strconvParseErr(b, "ParseInt")) + return } func (d *jsonDecDriver) DecodeFloat64() (f float64) { var err error - if bs := d.decNumBytes(); len(bs) > 0 { - if f, err = parseFloat64(bs); err != nil { - d.d.errorv(err) - } + bs := d.decNumBytes() + if len(bs) == 0 { + return + } + f, err = parseFloat64(bs) + if err != nil { + d.d.onerror(err) } return } func (d *jsonDecDriver) DecodeFloat32() (f float32) { var err error - if bs := d.decNumBytes(); len(bs) > 0 { - if f, err = parseFloat32(bs); err != nil { - d.d.errorv(err) - } + bs := d.decNumBytes() + if len(bs) == 0 { + return + } + f, err = parseFloat32(bs) + if err != nil { + d.d.onerror(err) } return } @@ -831,14 +887,14 @@ func (d *jsonDecDriver) decBytesFromArray(bs []byte) []byte { } d.tok = 0 bs = append(bs, uint8(d.DecodeUint64())) - d.tok = d.d.decRd.skip(&jsonCharWhitespaceSet) + d.tok = d.d.decRd.skipWhitespace() // skip(&whitespaceCharBitset) for d.tok != ']' { if d.tok != ',' { d.d.errorf("read array element - expect char '%c' but got char '%c'", ',', d.tok) } d.tok = 0 bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8))) - d.tok = d.d.decRd.skip(&jsonCharWhitespaceSet) + d.tok = d.d.decRd.skipWhitespace() // skip(&whitespaceCharBitset) } d.tok = 0 return bs @@ -864,14 +920,13 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { // base64 encodes []byte{} as "", and we encode nil []byte as null. // Consequently, base64 should decode null as a nil []byte, and "" as an empty []byte{}. // appendStringAsBytes returns a zero-len slice for both, so as not to reset d.buf. - // However, it sets a fnil field to true, so we can check if a null was found. if d.tok == 'n' { d.readLit4Null() return nil } - bs1 := d.readString() + bs1 := d.readUnescapedString() slen := base64.StdEncoding.DecodedLen(len(bs1)) if slen == 0 { bsOut = []byte{} @@ -886,7 +941,6 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { slen2, err := base64.StdEncoding.Decode(bsOut, bs1) if err != nil { d.d.errorf("error decoding base64 binary '%s': %v", bs1, err) - return nil } if slen != slen2 { bsOut = bsOut[:slen2] @@ -896,34 +950,35 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { func (d *jsonDecDriver) DecodeStringAsBytes() (s []byte) { d.advance() - if d.tok != '"' { - // d.d.errorf("expect char '%c' but got char '%c'", '"', d.tok) - // handle non-string scalar: null, true, false or a number - switch d.tok { - case 'n': - d.readLit4Null() - return []byte{} - case 'f': - d.readLit4False() - return jsonLiteralFalse - case 't': - d.readLit4True() - return jsonLiteralTrue - } - // try to parse a valid number - return d.decNumBytes() + + // common case + if d.tok == '"' { + d.appendStringAsBytes() + return d.buf } - s = d.appendStringAsBytes() - if d.fnil { - return nil + // d.d.errorf("expect char '%c' but got char '%c'", '"', d.tok) + + // handle non-string scalar: null, true, false or a number + switch d.tok { + case 'n': + d.readLit4Null() + return nil // []byte{} + case 'f': + d.readLit4False() + return jsonLiteralFalse + case 't': + d.readLit4True() + return jsonLiteralTrue } - return + + // try to parse a valid number + d.tok = 0 + return d.d.decRd.jsonReadNum() } -func (d *jsonDecDriver) readString() (bs []byte) { +func (d *jsonDecDriver) readUnescapedString() (bs []byte) { if d.tok != '"' { d.d.errorf("expecting string starting with '\"'; got '%c'", d.tok) - return } bs = d.d.decRd.readUntil('"', false) @@ -931,45 +986,26 @@ func (d *jsonDecDriver) readString() (bs []byte) { return } -func (d *jsonDecDriver) appendStringAsBytes() (bs []byte) { +func (d *jsonDecDriver) appendStringAsBytes() { if d.buf != nil { d.buf = d.buf[:0] } d.tok = 0 - // append on each byte seen can be expensive, so we just - // keep track of where we last read a contiguous set of - // non-special bytes (using cursor variable), - // and when we see a special byte - // e.g. end-of-slice, " or \, - // we will append the full range into the v slice before proceeding - - var cs = d.d.decRd.readUntil('"', true) var c uint8 - var i, cursor uint for { - if i >= uint(len(cs)) { - d.buf = append(d.buf, cs[cursor:]...) - cs = d.d.decRd.readUntil('"', true) - i, cursor = 0, 0 - continue // this continue helps elide the cs[i] below - } - c = cs[i] + c = d.d.decRd.readn1() + if c == '"' { break } if c != '\\' { - i++ + d.buf = append(d.buf, c) continue } - d.buf = append(d.buf, cs[cursor:i]...) - i++ - if i >= uint(len(cs)) { - d.d.errorf("need at least 1 more bytes for \\ escape sequence") - return // bounds-check elimination - } - c = cs[i] + c = d.d.decRd.readn1() + switch c { case '"', '\\', '/', '\'': d.buf = append(d.buf, c) @@ -984,40 +1020,21 @@ func (d *jsonDecDriver) appendStringAsBytes() (bs []byte) { case 't': d.buf = append(d.buf, '\t') case 'u': - i = d.appendStringAsBytesSlashU(cs, i) + d.appendStringAsBytesSlashU() default: d.d.errorf("unsupported escaped value: %c", c) } - i++ - cursor = i } - if len(cs) > 0 { - if len(d.buf) > 0 && cursor < uint(len(cs)) { - d.buf = append(d.buf, cs[cursor:i]...) - } else { - // if bytes, just return the cs got from readUntil. - // do not do it for io, especially bufio, as the buffer is needed for other things - cs = cs[:i] - if d.d.bytes { - return cs - } - d.buf = d.d.blist.check(d.buf, len(cs)) - copy(d.buf, cs) - } - } - return d.buf } -func (d *jsonDecDriver) appendStringAsBytesSlashU(cs []byte, i uint) uint { +func (d *jsonDecDriver) appendStringAsBytesSlashU() { var r rune var rr uint32 var j uint var c byte - if uint(len(cs)) < i+4 { - d.d.errorf("need at least 4 more bytes for unicode sequence") - return 0 // bounds-check elimination - } - for _, c = range cs[i+1 : i+5] { // bounds-check-elimination + var cs [7]byte + cs = d.d.decRd.readn(4) + for _, c = range cs[:4] { // bounds-check-elimination // best to use explicit if-else // - not a table, etc which involve memory loads, array lookup with bounds checks, etc if c >= '0' && c <= '9' { @@ -1028,52 +1045,39 @@ func (d *jsonDecDriver) appendStringAsBytesSlashU(cs []byte, i uint) uint { rr = rr*16 + uint32(c-jsonU4Chk0) } else { r = unicode.ReplacementChar - i += 4 goto encode_rune } } r = rune(rr) - i += 4 if utf16.IsSurrogate(r) { - if len(cs) >= int(i+6) { - var cx = cs[i+1:][:6:6] // [:6] affords bounds-check-elimination - //var cx [6]byte - //copy(cx[:], cs[i+1:]) - if cx[0] == '\\' && cx[1] == 'u' { - i += 2 - var rr1 uint32 - for j = 2; j < 6; j++ { - c = cx[j] - if c >= '0' && c <= '9' { - rr = rr*16 + uint32(c-jsonU4Chk2) - } else if c >= 'a' && c <= 'f' { - rr = rr*16 + uint32(c-jsonU4Chk1) - } else if c >= 'A' && c <= 'F' { - rr = rr*16 + uint32(c-jsonU4Chk0) - } else { - r = unicode.ReplacementChar - i += 4 - goto encode_rune - } + cs = d.d.decRd.readn(6) + if cs[0] == '\\' && cs[1] == 'u' { + rr = 0 + for j = 2; j < 6; j++ { + c = cs[j] + if c >= '0' && c <= '9' { + rr = rr*16 + uint32(c-jsonU4Chk2) + } else if c >= 'a' && c <= 'f' { + rr = rr*16 + uint32(c-jsonU4Chk1) + } else if c >= 'A' && c <= 'F' { + rr = rr*16 + uint32(c-jsonU4Chk0) + } else { + r = unicode.ReplacementChar + goto encode_rune } - r = utf16.DecodeRune(r, rune(rr1)) - i += 4 - goto encode_rune } + r = utf16.DecodeRune(r, rune(rr)) + goto encode_rune } r = unicode.ReplacementChar } encode_rune: w2 := utf8.EncodeRune(d.bstr[:], r) d.buf = append(d.buf, d.bstr[:w2]...) - return i } -func (d *jsonDecDriver) nakedNum(z *decNaked, bs []byte) (err error) { - const cutoff = uint64(1 << uint(64-1)) - - var n uint64 - var neg, badsyntax, overflow bool +func (d *jsonDecDriver) nakedNum(z *fauxUnion, bs []byte) (err error) { + // const cutoff = uint64(1 << uint(64-1)) if len(bs) == 0 { if d.h.PreferFloat { @@ -1089,33 +1093,12 @@ func (d *jsonDecDriver) nakedNum(z *decNaked, bs []byte) (err error) { return } if d.h.PreferFloat { - goto F - } - n, neg, badsyntax, overflow = jsonParseInteger(bs) - if badsyntax || overflow { - goto F - } - if neg { - if n > cutoff { - goto F - } - z.v = valueTypeInt - z.i = -(int64(n)) - } else if d.h.SignedInteger { - if n >= cutoff { - goto F - } - z.v = valueTypeInt - z.i = int64(n) + z.v = valueTypeFloat + z.f, err = parseFloat64(bs) } else { - z.v = valueTypeUint - z.u = n + err = parseNumber(bs, z, d.h.SignedInteger) } return -F: - z.v = valueTypeFloat - z.f, err = parseFloat64(bs) - return } func (d *jsonDecDriver) sliceToString(bs []byte) string { @@ -1148,7 +1131,8 @@ func (d *jsonDecDriver) DecodeNaked() { z.v = valueTypeArray // don't consume. kInterfaceNaked will call ReadArrayStart case '"': // if a string, and MapKeyAsString, then try to decode it as a nil, bool or number first - bs = d.appendStringAsBytes() + d.appendStringAsBytes() + bs = d.buf if len(bs) > 0 && d.d.c == containerMapKey && d.h.MapKeyAsString { if bytes.Equal(bs, jsonLiteralNull) { z.v = valueTypeNil @@ -1170,14 +1154,13 @@ func (d *jsonDecDriver) DecodeNaked() { z.s = d.sliceToString(bs) } default: // number - bs = d.decNumBytes() + bs = d.d.decRd.jsonReadNum() + d.tok = 0 if len(bs) == 0 { d.d.errorf("decode number from empty string") - return } if err := d.nakedNum(z, bs); err != nil { d.d.errorf("decode number from %s: %v", bs, err) - return } } } @@ -1205,6 +1188,10 @@ func (d *jsonDecDriver) DecodeNaked() { // // Note that, when decoding quoted strings, invalid UTF-8 or invalid UTF-16 surrogate pairs are // not treated as an error. Instead, they are replaced by the Unicode replacement character U+FFFD. +// +// Note also that the float values for NaN, +Inf or -Inf are encoded as null, +// as suggested by NOTE 4 of the ECMA-262 ECMAScript Language Specification 5.1 edition. +// see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf . type JsonHandle struct { textEncodingType BasicHandle @@ -1266,6 +1253,8 @@ type JsonHandle struct { // Name returns the name of the handle: json func (h *JsonHandle) Name() string { return "json" } +func (h *JsonHandle) desc(bd byte) string { return string(bd) } + // func (h *JsonHandle) hasElemSeparators() bool { return true } func (h *JsonHandle) typical() bool { return h.Indent == 0 && !h.MapKeyAsString && h.IntegerAsString != 'A' && h.IntegerAsString != 'L' @@ -1312,32 +1301,10 @@ func (d *jsonDecDriver) reset() { d.se.InterfaceExt = d.h.RawBytesExt d.buf = d.d.blist.check(d.buf, 256)[:0] d.tok = 0 - d.fnil = false } func (d *jsonDecDriver) atEndOfDecode() {} -// jsonFloatStrconvFmtPrec ... -// -// ensure that every float has an 'e' or '.' in it,/ for easy differentiation from integers. -// this is better/faster than checking if encoded value has [e.] and appending if needed. - -// func jsonFloatStrconvFmtPrec(f float64, bits32 bool) (fmt byte, prec int) { -// fmt = 'f' -// prec = -1 -// var abs = math.Abs(f) -// if abs == 0 || abs == 1 { -// prec = 1 -// } else if !bits32 && (abs < 1e-6 || abs >= 1e21) || -// bits32 && (float32(abs) < 1e-6 || float32(abs) >= 1e21) { -// fmt = 'e' -// } else if _, frac := math.Modf(abs); frac == 0 { -// // ensure that floats have a .0 at the end, for easy identification as floats -// prec = 1 -// } -// return -// } - func jsonFloatStrconvFmtPrec64(f float64) (fmt byte, prec int8) { fmt = 'f' prec = -1 @@ -1366,128 +1333,8 @@ func jsonFloatStrconvFmtPrec32(f float32) (fmt byte, prec int8) { return } -// custom-fitted version of strconv.Parse(Ui|I)nt. -// Also ensures we don't have to search for .eE to determine if a float or not. -// Note: s CANNOT be a zero-length slice. -func jsonParseInteger(s []byte) (n uint64, neg, badSyntax, overflow bool) { - const maxUint64 = (1<<64 - 1) - const cutoff = maxUint64/10 + 1 - - if len(s) == 0 { // bounds-check-elimination - // treat empty string as zero value - // badSyntax = true - return - } - switch s[0] { - case '+': - s = s[1:] - case '-': - s = s[1:] - neg = true - } - for _, c := range s { - if c < '0' || c > '9' { - badSyntax = true - return - } - // unsigned integers don't overflow well on multiplication, so check cutoff here - // e.g. (maxUint64-5)*10 doesn't overflow well ... - if n >= cutoff { - overflow = true - return - } - n *= 10 - n1 := n + uint64(c-'0') - if n1 < n || n1 > maxUint64 { - overflow = true - return - } - n = n1 - } - return -} - var _ decDriverContainerTracker = (*jsonDecDriver)(nil) var _ encDriverContainerTracker = (*jsonEncDriver)(nil) var _ decDriver = (*jsonDecDriver)(nil) var _ encDriver = (*jsonEncDriver)(nil) - -// ---------------- - -/* -type jsonEncDriverTypical jsonEncDriver - -func (e *jsonEncDriverTypical) WriteArrayStart(length int) { - e.e.encWr.writen1('[') -} - -func (e *jsonEncDriverTypical) WriteArrayElem() { - if e.e.c != containerArrayStart { - e.e.encWr.writen1(',') - } -} - -func (e *jsonEncDriverTypical) WriteArrayEnd() { - e.e.encWr.writen1(']') -} - -func (e *jsonEncDriverTypical) WriteMapStart(length int) { - e.e.encWr.writen1('{') -} - -func (e *jsonEncDriverTypical) WriteMapElemKey() { - if e.e.c != containerMapStart { - e.e.encWr.writen1(',') - } -} - -func (e *jsonEncDriverTypical) WriteMapElemValue() { - e.e.encWr.writen1(':') -} - -func (e *jsonEncDriverTypical) WriteMapEnd() { - e.e.encWr.writen1('}') -} - -func (e *jsonEncDriverTypical) EncodeBool(b bool) { - if b { - // e.e.encWr.writeb(jsonLiteralTrue) - e.e.encWr.writen([rwNLen]byte{'t', 'r', 'u', 'e'}, 4) - } else { - // e.e.encWr.writeb(jsonLiteralFalse) - e.e.encWr.writen([rwNLen]byte{'f', 'a', 'l', 's', 'e'}, 5) - } -} - -func (e *jsonEncDriverTypical) EncodeInt(v int64) { - e.e.encWr.writeb(strconv.AppendInt(e.b[:0], v, 10)) -} - -func (e *jsonEncDriverTypical) EncodeUint(v uint64) { - e.e.encWr.writeb(strconv.AppendUint(e.b[:0], v, 10)) -} - -func (e *jsonEncDriverTypical) EncodeFloat64(f float64) { - fmt, prec := jsonFloatStrconvFmtPrec64(f) - e.e.encWr.writeb(strconv.AppendFloat(e.b[:0], f, fmt, int(prec), 64)) - // e.e.encWr.writeb(strconv.AppendFloat(e.b[:0], f, jsonFloatStrconvFmtPrec64(f), 64)) -} - -func (e *jsonEncDriverTypical) EncodeFloat32(f float32) { - fmt, prec := jsonFloatStrconvFmtPrec32(f) - e.e.encWr.writeb(strconv.AppendFloat(e.b[:0], float64(f), fmt, int(prec), 32)) -} - -// func (e *jsonEncDriverTypical) encodeFloat(f float64, bitsize uint8) { -// fmt, prec := jsonFloatStrconvFmtPrec(f, bitsize == 32) -// e.e.encWr.writeb(strconv.AppendFloat(e.b[:0], f, fmt, prec, int(bitsize))) -// } - -// func (e *jsonEncDriverTypical) atEndOfEncode() { -// if e.tw { -// e.e.encWr.writen1(' ') -// } -// } - -*/ diff --git a/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl b/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl index ba55b39..3482297 100644 --- a/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from mammoth-test.go.tmpl - DO NOT EDIT. @@ -72,7 +72,8 @@ func doTestMammothSlices(t *testing.T, h Handle) { if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } testUnmarshalErr(rv4i(v{{$i}}v2), bs{{$i}}, h, t, "dec-slice-v{{$i}}-noaddr") // non-addressable value testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-noaddr") - } + } + testReleaseBytes(bs{{$i}}) // ... bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-slice-v{{$i}}-p") v{{$i}}v2 = nil @@ -98,6 +99,7 @@ func doTestMammothSlices(t *testing.T, h Handle) { testUnmarshalErr((&v{{$i}}va)[:], bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-cap-noaddr") testDeepEqualErr(v{{$i}}v1, v{{$i}}va[:len(v{{$i}}v1)], t, "equal-slice-v{{$i}}-p-cap-noaddr") } + testReleaseBytes(bs{{$i}}) // ... var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMbs" false }} v{{$i}}v2 = nil @@ -108,12 +110,14 @@ func doTestMammothSlices(t *testing.T, h Handle) { bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom") testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom") testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom") + testReleaseBytes(bs{{$i}}) } bs{{$i}} = testMarshalErr(&v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom-p") v{{$i}}v2 = nil v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) testUnmarshalErr(&v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom-p") testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom-p") + testReleaseBytes(bs{{$i}}) } {{end}}{{end}}{{end}} } @@ -137,10 +141,12 @@ func doTestMammothMaps(t *testing.T, h Handle) { if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-len") + testReleaseBytes(bs{{$i}}) bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-map-v{{$i}}-p") v{{$i}}v2 = nil testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-nil") testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-nil") + testReleaseBytes(bs{{$i}}) // ... if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMap" false }} @@ -150,6 +156,7 @@ func doTestMammothMaps(t *testing.T, h Handle) { bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-map-v{{$i}}-custom") testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-map-v{{$i}}-p-len") + testReleaseBytes(bs{{$i}}) } } {{end}}{{end}}{{end}} diff --git a/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl b/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl index 71eaf61..d08e7d9 100644 --- a/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl @@ -1,6 +1,6 @@ // +build !notfastpath -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from mammoth2-test.go.tmpl - DO NOT EDIT. diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go index 4543337..1353c5b 100644 --- a/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/vendor/github.com/ugorji/go/codec/msgpack.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. /* @@ -79,84 +79,57 @@ const ( var mpTimeExtTag int8 = -1 var mpTimeExtTagU = uint8(mpTimeExtTag) -// var mpdesc = map[byte]string{ -// mpPosFixNumMin: "PosFixNumMin", -// mpPosFixNumMax: "PosFixNumMax", -// mpFixMapMin: "FixMapMin", -// mpFixMapMax: "FixMapMax", -// mpFixArrayMin: "FixArrayMin", -// mpFixArrayMax: "FixArrayMax", -// mpFixStrMin: "FixStrMin", -// mpFixStrMax: "FixStrMax", -// mpNil: "Nil", -// mpFalse: "False", -// mpTrue: "True", -// mpFloat: "Float", -// mpDouble: "Double", -// mpUint8: "Uint8", -// mpUint16: "Uint16", -// mpUint32: "Uint32", -// mpUint64: "Uint64", -// mpInt8: "Int8", -// mpInt16: "Int16", -// mpInt32: "Int32", -// mpInt64: "Int64", -// mpBin8: "Bin8", -// mpBin16: "Bin16", -// mpBin32: "Bin32", -// mpExt8: "Ext8", -// mpExt16: "Ext16", -// mpExt32: "Ext32", -// mpFixExt1: "FixExt1", -// mpFixExt2: "FixExt2", -// mpFixExt4: "FixExt4", -// mpFixExt8: "FixExt8", -// mpFixExt16: "FixExt16", -// mpStr8: "Str8", -// mpStr16: "Str16", -// mpStr32: "Str32", -// mpArray16: "Array16", -// mpArray32: "Array32", -// mpMap16: "Map16", -// mpMap32: "Map32", -// mpNegFixNumMin: "NegFixNumMin", -// mpNegFixNumMax: "NegFixNumMax", -// } +var mpdescNames = map[byte]string{ + mpNil: "nil", + mpFalse: "false", + mpTrue: "true", + mpFloat: "float", + mpDouble: "float", + mpUint8: "uuint", + mpUint16: "uint", + mpUint32: "uint", + mpUint64: "uint", + mpInt8: "int", + mpInt16: "int", + mpInt32: "int", + mpInt64: "int", -func mpdesc(bd byte) string { - switch bd { - case mpNil: - return "nil" - case mpFalse: - return "false" - case mpTrue: - return "true" - case mpFloat, mpDouble: - return "float" - case mpUint8, mpUint16, mpUint32, mpUint64: - return "uint" - case mpInt8, mpInt16, mpInt32, mpInt64: - return "int" - default: + mpStr8: "string|bytes", + mpStr16: "string|bytes", + mpStr32: "string|bytes", + + mpBin8: "bytes", + mpBin16: "bytes", + mpBin32: "bytes", + + mpArray16: "array", + mpArray32: "array", + + mpMap16: "map", + mpMap32: "map", +} + +func mpdesc(bd byte) (s string) { + s = mpdescNames[bd] + if s == "" { switch { - case bd >= mpPosFixNumMin && bd <= mpPosFixNumMax: - return "int" - case bd >= mpNegFixNumMin && bd <= mpNegFixNumMax: - return "int" - case bd == mpStr8, bd == mpStr16, bd == mpStr32, bd >= mpFixStrMin && bd <= mpFixStrMax: - return "string|bytes" - case bd == mpBin8, bd == mpBin16, bd == mpBin32: - return "bytes" - case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax: - return "array" - case bd == mpMap16, bd == mpMap32, bd >= mpFixMapMin && bd <= mpFixMapMax: - return "map" - case bd >= mpFixExt1 && bd <= mpFixExt16, bd >= mpExt8 && bd <= mpExt32: - return "ext" + case bd >= mpPosFixNumMin && bd <= mpPosFixNumMax, + bd >= mpNegFixNumMin && bd <= mpNegFixNumMax: + s = "int" + case bd >= mpFixStrMin && bd <= mpFixStrMax: + s = "string|bytes" + case bd >= mpFixArrayMin && bd <= mpFixArrayMax: + s = "array" + case bd >= mpFixMapMin && bd <= mpFixMapMax: + s = "map" + case bd >= mpFixExt1 && bd <= mpFixExt16, + bd >= mpExt8 && bd <= mpExt32: + s = "ext" default: - return "unknown" + s = "unknown" } } + return } // MsgpackSpecRpcMultiArgs is a special type which signifies to the MsgpackSpecRpcCodec @@ -169,8 +142,7 @@ type MsgpackSpecRpcMultiArgs []interface{} // A MsgpackContainer type specifies the different types of msgpackContainers. type msgpackContainerType struct { - fixCutoff uint8 - bFixMin, b8, b16, b32 byte + fixCutoff, bFixMin, b8, b16, b32 byte // hasFixMin, has8, has8Always bool } @@ -432,7 +404,7 @@ type msgpackDecDriver struct { // b [scratchByteArrayLen]byte bd byte bdRead bool - fnil bool + _ bool noBuiltInTypes _ [6]uint64 // padding d Decoder @@ -451,7 +423,6 @@ func (d *msgpackDecDriver) DecodeNaked() { if !d.bdRead { d.readNextBd() } - d.fnil = false bd := d.bd n := d.d.naked() var decodeFurther bool @@ -460,7 +431,6 @@ func (d *msgpackDecDriver) DecodeNaked() { case mpNil: n.v = valueTypeNil d.bdRead = false - d.fnil = true case mpFalse: n.v = valueTypeBool n.b = false @@ -520,7 +490,7 @@ func (d *msgpackDecDriver) DecodeNaked() { n.l = d.DecodeBytes(nil, false) } case bd == mpBin8, bd == mpBin16, bd == mpBin32: - decNakedReadRawBytes(d, &d.d, n, d.h.RawToString) + fauxUnionReadRawBytes(d, &d.d, n, d.h.RawToString) case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax: n.v = valueTypeArray decodeFurther = true @@ -535,7 +505,7 @@ func (d *msgpackDecDriver) DecodeNaked() { n.v = valueTypeTime n.t = d.decodeTime(clen) } else if d.d.bytes { - n.l = d.d.decRd.readx(uint(clen)) + n.l = d.d.decRd.rb.readx(uint(clen)) } else { n.l = decByteSlice(d.d.r(), clen, d.d.h.MaxInitLen, d.d.b[:]) } @@ -552,6 +522,140 @@ func (d *msgpackDecDriver) DecodeNaked() { } } +func (d *msgpackDecDriver) nextValueBytes(start []byte) (v []byte) { + if !d.bdRead { + d.readNextBd() + } + v = append(start, d.bd) + v = d.nextValueBytesBdReadR(v) + d.bdRead = false + return +} + +func (d *msgpackDecDriver) nextValueBytesR(v0 []byte) (v []byte) { + d.readNextBd() + v = append(v0, d.bd) + return d.nextValueBytesBdReadR(v) +} + +func (d *msgpackDecDriver) nextValueBytesBdReadR(v0 []byte) (v []byte) { + v = v0 + bd := d.bd + + var clen uint + var x []byte + + switch bd { + case mpNil, mpFalse, mpTrue: // pass + case mpUint8, mpInt8: + v = append(v, d.d.decRd.readn1()) + case mpUint16, mpInt16: + v = append(v, d.d.decRd.readx(2)...) + case mpFloat, mpUint32, mpInt32: + v = append(v, d.d.decRd.readx(4)...) + case mpDouble, mpUint64, mpInt64: + v = append(v, d.d.decRd.readx(8)...) + case mpStr8, mpBin8: + clen = uint(d.d.decRd.readn1()) + v = append(v, byte(clen)) + v = append(v, d.d.decRd.readx(clen)...) + case mpStr16, mpBin16: + x = d.d.decRd.readx(2) + v = append(v, x...) + clen = uint(bigen.Uint16(x)) + v = append(v, d.d.decRd.readx(clen)...) + case mpStr32, mpBin32: + x = d.d.decRd.readx(4) + v = append(v, x...) + clen = uint(bigen.Uint32(x)) + v = append(v, d.d.decRd.readx(clen)...) + case mpFixExt1: + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readn1()) + case mpFixExt2: + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(2)...) + case mpFixExt4: + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(4)...) + case mpFixExt8: + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(8)...) + case mpFixExt16: + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(16)...) + case mpExt8: + clen = uint(d.d.decRd.readn1()) + v = append(v, uint8(clen)) + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(clen)...) + case mpExt16: + x = d.d.decRd.readx(2) + clen = uint(bigen.Uint16(x)) + v = append(v, x...) + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(clen)...) + case mpExt32: + x = d.d.decRd.readx(4) + clen = uint(bigen.Uint32(x)) + v = append(v, x...) + v = append(v, d.d.decRd.readn1()) // tag + v = append(v, d.d.decRd.readx(clen)...) + case mpArray16: + x = d.d.decRd.readx(2) + clen = uint(bigen.Uint16(x)) + v = append(v, x...) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + } + case mpArray32: + x = d.d.decRd.readx(4) + clen = uint(bigen.Uint32(x)) + v = append(v, x...) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + } + case mpMap16: + x = d.d.decRd.readx(2) + clen = uint(bigen.Uint16(x)) + v = append(v, x...) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + v = d.nextValueBytesR(v) + } + case mpMap32: + x = d.d.decRd.readx(4) + clen = uint(bigen.Uint32(x)) + v = append(v, x...) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + v = d.nextValueBytesR(v) + } + default: + switch { + case bd >= mpPosFixNumMin && bd <= mpPosFixNumMax: // pass + case bd >= mpNegFixNumMin && bd <= mpNegFixNumMax: // pass + case bd >= mpFixStrMin && bd <= mpFixStrMax: + clen = uint(mpFixStrMin ^ bd) + v = append(v, d.d.decRd.readx(clen)...) + case bd >= mpFixArrayMin && bd <= mpFixArrayMax: + clen = uint(mpFixArrayMin ^ bd) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + } + case bd >= mpFixMapMin && bd <= mpFixMapMax: + clen = uint(mpFixMapMin ^ bd) + for i := uint(0); i < clen; i++ { + v = d.nextValueBytesR(v) + v = d.nextValueBytesR(v) + } + default: + d.d.errorf("nextValueBytes: cannot infer value: %s: Ox%x/%d/%s", msgBadDesc, bd, bd, mpdesc(bd)) + } + } + return +} + // int can be decoded from msgpack type: intXXX or uintXXX func (d *msgpackDecDriver) DecodeInt64() (i int64) { if d.advanceNil() { @@ -582,7 +686,6 @@ func (d *msgpackDecDriver) DecodeInt64() (i int64) { i = int64(int8(d.bd)) default: d.d.errorf("cannot decode signed integer: %s: %x/%s", msgBadDesc, d.bd, mpdesc(d.bd)) - return } } d.bdRead = false @@ -608,28 +711,24 @@ func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { ui = uint64(i) } else { d.d.errorf("assigning negative signed value: %v, to unsigned type", i) - return } case mpInt16: if i := int64(int16(bigen.Uint16(d.d.decRd.readx(2)))); i >= 0 { ui = uint64(i) } else { d.d.errorf("assigning negative signed value: %v, to unsigned type", i) - return } case mpInt32: if i := int64(int32(bigen.Uint32(d.d.decRd.readx(4)))); i >= 0 { ui = uint64(i) } else { d.d.errorf("assigning negative signed value: %v, to unsigned type", i) - return } case mpInt64: if i := int64(bigen.Uint64(d.d.decRd.readx(8))); i >= 0 { ui = uint64(i) } else { d.d.errorf("assigning negative signed value: %v, to unsigned type", i) - return } default: switch { @@ -637,10 +736,8 @@ func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { ui = uint64(d.bd) case d.bd >= mpNegFixNumMin && d.bd <= mpNegFixNumMax: d.d.errorf("assigning negative signed value: %v, to unsigned type", int(d.bd)) - return default: d.d.errorf("cannot decode unsigned integer: %s: %x/%s", msgBadDesc, d.bd, mpdesc(d.bd)) - return } } d.bdRead = false @@ -674,7 +771,6 @@ func (d *msgpackDecDriver) DecodeBool() (b bool) { b = true } else { d.d.errorf("cannot decode bool: %s: %x/%s", msgBadDesc, d.bd, mpdesc(d.bd)) - return } d.bdRead = false return @@ -707,16 +803,14 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) return bs } else { d.d.errorf("invalid byte descriptor for decoding bytes, got: 0x%x", d.bd) - return } d.bdRead = false - if zerocopy { - if d.d.bytes { - return d.d.decRd.readx(uint(clen)) - } else if len(bs) == 0 { - bs = d.d.b[:] - } + if d.d.bytes && (zerocopy || d.h.ZeroCopy) { + return d.d.decRd.rb.readx(uint(clen)) + } + if zerocopy && len(bs) == 0 { + bs = d.d.b[:] } return decByteSlice(d.d.r(), clen, d.h.MaxInitLen, bs) } @@ -730,39 +824,24 @@ func (d *msgpackDecDriver) readNextBd() { d.bdRead = true } -func (d *msgpackDecDriver) uncacheRead() { - if d.bdRead { - d.d.decRd.unreadn1() - d.bdRead = false - } -} - func (d *msgpackDecDriver) advanceNil() (null bool) { - d.fnil = false if !d.bdRead { d.readNextBd() } if d.bd == mpNil { d.bdRead = false - d.fnil = true null = true } return } -func (d *msgpackDecDriver) Nil() bool { - return d.fnil -} - func (d *msgpackDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } bd := d.bd - d.fnil = false if bd == mpNil { d.bdRead = false - d.fnil = true return valueTypeNil } else if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { return valueTypeBytes @@ -796,7 +875,6 @@ func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) clen = int(ct.bFixMin ^ bd) } else { d.d.errorf("cannot read container length: %s: hex: %x, decimal: %d", msgBadDesc, bd, bd) - return } d.bdRead = false return @@ -804,14 +882,14 @@ func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) func (d *msgpackDecDriver) ReadMapStart() int { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } return d.readContainerLen(msgpackContainerMap) } func (d *msgpackDecDriver) ReadArrayStart() int { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } return d.readContainerLen(msgpackContainerList) } @@ -836,7 +914,6 @@ func (d *msgpackDecDriver) readExtLen() (clen int) { clen = int(bigen.Uint32(d.d.decRd.readx(4))) default: d.d.errorf("decoding ext bytes: found unexpected byte: %x", d.bd) - return } return } @@ -865,7 +942,6 @@ func (d *msgpackDecDriver) DecodeTime() (t time.Time) { clen = 12 } else { d.d.errorf("invalid stream for decoding time as extension: got 0x%x, 0x%x", d.bd, b2) - return } } return d.decodeTime(clen) @@ -886,7 +962,6 @@ func (d *msgpackDecDriver) decodeTime(clen int) (t time.Time) { t = time.Unix(int64(sec), int64(nsec)).UTC() default: d.d.errorf("invalid length of bytes for decoding time - expecting 4 or 8 or 12, got %d", clen) - return } return } @@ -894,7 +969,6 @@ func (d *msgpackDecDriver) decodeTime(clen int) (t time.Time) { func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { if xtag > 0xff { d.d.errorf("ext: tag must be <= 0xff; got: %v", xtag) - return } if d.advanceNil() { return @@ -924,10 +998,9 @@ func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs xtag = d.d.decRd.readn1() if verifyTag && xtag != tag { d.d.errorf("wrong extension tag - got %b, expecting %v", xtag, tag) - return } if d.d.bytes { - xbs = d.d.decRd.readx(uint(clen)) + xbs = d.d.decRd.rb.readx(uint(clen)) } else { xbs = decByteSlice(d.d.r(), clen, d.d.h.MaxInitLen, d.d.b[:]) } @@ -969,6 +1042,8 @@ type MsgpackHandle struct { // Name returns the name of the handle: msgpack func (h *MsgpackHandle) Name() string { return "msgpack" } +func (h *MsgpackHandle) desc(bd byte) string { return mpdesc(bd) } + func (h *MsgpackHandle) newEncDriver() encDriver { var e = &msgpackEncDriver{h: h} e.e.e = e @@ -990,7 +1065,6 @@ func (e *msgpackEncDriver) reset() { func (d *msgpackDecDriver) reset() { d.bd, d.bdRead = 0, false - d.fnil = false } //-------------------------------------------------- @@ -1071,8 +1145,7 @@ func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint err = c.read(&b) if err == nil { if b != expectTypeByte { - err = fmt.Errorf("%s - expecting %v but got %x/%s", - msgBadDesc, expectTypeByte, b, mpdesc(b)) + err = fmt.Errorf("%s - expecting %v but got %x/%s", msgBadDesc, expectTypeByte, b, mpdesc(b)) } else { err = c.read(msgid) if err == nil { diff --git a/vendor/github.com/ugorji/go/codec/prebuild.go b/vendor/github.com/ugorji/go/codec/prebuild.go deleted file mode 100644 index 7771057..0000000 --- a/vendor/github.com/ugorji/go/codec/prebuild.go +++ /dev/null @@ -1,136 +0,0 @@ -// +build prebuild - -package main - -// prebuild.go generates sort implementations for -// various slice types and combination slice+reflect.Value types. -// -// The combination slice+reflect.Value types are used -// during canonical encode, and the others are used during fast-path -// encoding of map keys. - -import ( - "bytes" - "go/format" - "io/ioutil" - "os" - "strings" - "text/template" -) - -// genInternalSortableTypes returns the types -// that are used for fast-path canonical's encoding of maps. -// -// For now, we only support the highest sizes for -// int64, uint64, float64, bool, string, bytes. -func genInternalSortableTypes() []string { - return []string{ - "string", - // "float32", - "float64", - // "uint", - // "uint8", - // "uint16", - // "uint32", - "uint64", - "uintptr", - // "int", - // "int8", - // "int16", - // "int32", - "int64", - "bool", - "time", - "bytes", - } -} - -// genInternalSortablePlusTypes returns the types -// that are used for reflection-based canonical's encoding of maps. -// -// For now, we only support the highest sizes for -// int64, uint64, float64, bool, string, bytes. -func genInternalSortablePlusTypes() []string { - return []string{ - "string", - "float64", - "uint64", - "uintptr", - "int64", - "bool", - "time", - "bytes", - } -} - -func genTypeForShortName(s string) string { - switch s { - case "time": - return "time.Time" - case "bytes": - return "[]byte" - } - return s -} - -func genArgs(args ...interface{}) map[string]interface{} { - m := make(map[string]interface{}, len(args)/2) - for i := 0; i < len(args); { - m[args[i].(string)] = args[i+1] - i += 2 - } - return m -} - -func genEndsWith(s0 string, sn ...string) bool { - for _, s := range sn { - if strings.HasSuffix(s0, s) { - return true - } - } - return false -} - -func chkerr(err error) { - if err != nil { - panic(err) - } -} - -func run(fnameIn, fnameOut string) { - var err error - - funcs := make(template.FuncMap) - funcs["sortables"] = genInternalSortableTypes - funcs["sortablesplus"] = genInternalSortablePlusTypes - funcs["tshort"] = genTypeForShortName - funcs["endswith"] = genEndsWith - funcs["args"] = genArgs - - t := template.New("").Funcs(funcs) - fin, err := os.Open(fnameIn) - chkerr(err) - defer fin.Close() - fout, err := os.Create(fnameOut) - chkerr(err) - defer fout.Close() - tmplstr, err := ioutil.ReadAll(fin) - chkerr(err) - t, err = t.Parse(string(tmplstr)) - chkerr(err) - var out bytes.Buffer - err = t.Execute(&out, 0) - chkerr(err) - bout, err := format.Source(out.Bytes()) - if err != nil { - fout.Write(out.Bytes()) // write out if error, so we can still see. - } - chkerr(err) - // write out if error, as much as possible, so we can still see. - _, err = fout.Write(bout) - chkerr(err) -} - -func main() { - run("sort-slice.go.tmpl", "sort-slice.generated.go") -} diff --git a/vendor/github.com/ugorji/go/codec/reader.go b/vendor/github.com/ugorji/go/codec/reader.go index 1c3fe88..4ed3cb6 100644 --- a/vendor/github.com/ugorji/go/codec/reader.go +++ b/vendor/github.com/ugorji/go/codec/reader.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -8,23 +8,34 @@ import "io" // decReader abstracts the reading source, allowing implementations that can // read from an io.Reader or directly off a byte slice with zero-copying. type decReader interface { - unreadn1() // readx will use the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR // just return a view of the []byte being decoded from. // Ensure you call detachZeroCopyBytes later if this needs to be sent outside codec control. readx(n uint) []byte readb([]byte) readn1() uint8 + // readn1eof() (v uint8, eof bool) + // read up to 7 bytes at a time readn(num uint8) (v [rwNLen]byte) numread() uint // number of bytes read - track() - stopTrack() []byte + + // readNumber(includeLastByteRead bool) []byte + + // skip any whitespace characters, and return the first non-matching byte + skipWhitespace() (token byte) + + // jsonReadNum will include last read byte in first element of slice, + // and continue numeric characters until it sees a non-numeric char + // or EOF. If it sees a non-numeric character, it will unread that. + jsonReadNum() []byte // skip will skip any byte that matches, and return the first non-matching byte - skip(accept *bitset256) (token byte) + // skip(accept *bitset256) (token byte) + // readTo will read any byte that matches, stopping once no-longer matching. - readTo(accept *bitset256) (out []byte) + // readTo(accept *bitset256) (out []byte) + // readUntil will read, only stopping once it matches the 'stop' byte. readUntil(stop byte, includeLast bool) (out []byte) } @@ -48,44 +59,31 @@ type ioDecReaderCommon struct { n uint // num read - l byte // last byte - ls unreadByteStatus // last byte status - trb bool // tracking bytes turned on - _ bool - b [4]byte // tiny buffer for reading single bytes + l byte // last byte + ls unreadByteStatus // last byte status + _ [2]byte + b [4]byte // tiny buffer for reading single bytes blist *bytesFreelist - tr []byte // buffer for tracking bytes bufr []byte // buffer for readTo/readUntil } -func (z *ioDecReaderCommon) last() byte { - return z.l -} +// func (z *ioDecReaderCommon) last() byte { +// return z.l +// } func (z *ioDecReaderCommon) reset(r io.Reader, blist *bytesFreelist) { z.blist = blist z.r = r z.ls = unreadByteUndefined z.l, z.n = 0, 0 - z.trb = false } func (z *ioDecReaderCommon) numread() uint { return z.n } -func (z *ioDecReaderCommon) track() { - z.tr = z.blist.check(z.tr, 256)[:0] - z.trb = true -} - -func (z *ioDecReaderCommon) stopTrack() (bs []byte) { - z.trb = false - return z.tr -} - // ------------------------------------------ // ioDecReader is a decReader that reads off an io.Reader. @@ -193,13 +191,9 @@ func (z *ioDecReader) readx(n uint) (bs []byte) { } else { bs = make([]byte, n) } - if _, err := decReadFull(z.r, bs); err != nil { - panic(err) - } + _, err := readFull(z.r, bs) + halt.onerror(err) z.n += uint(len(bs)) - if z.trb { - z.tr = append(z.tr, bs...) - } return } @@ -207,77 +201,59 @@ func (z *ioDecReader) readb(bs []byte) { if len(bs) == 0 { return } - if _, err := decReadFull(z.r, bs); err != nil { - panic(err) - } + _, err := readFull(z.r, bs) + halt.onerror(err) z.n += uint(len(bs)) - if z.trb { - z.tr = append(z.tr, bs...) - } +} + +func (z *ioDecReader) readn1() (b uint8) { + b, err := z.ReadByte() + halt.onerror(err) + z.n++ + return } func (z *ioDecReader) readn1eof() (b uint8, eof bool) { b, err := z.ReadByte() if err == nil { z.n++ - if z.trb { - z.tr = append(z.tr, b) - } } else if err == io.EOF { eof = true } else { - panic(err) + halt.onerror(err) } return } -func (z *ioDecReader) readn1() (b uint8) { - b, err := z.ReadByte() - if err == nil { - z.n++ - if z.trb { - z.tr = append(z.tr, b) - } - return - } - panic(err) -} - -func (z *ioDecReader) skip(accept *bitset256) (token byte) { - var eof bool -LOOP: - token, eof = z.readn1eof() - if eof { - return - } - if accept.isset(token) { - goto LOOP - } - return -} - -func (z *ioDecReader) readTo(accept *bitset256) []byte { +func (z *ioDecReader) jsonReadNum() (bs []byte) { + z.unreadn1() z.bufr = z.blist.check(z.bufr, 256)[:0] LOOP: - token, eof := z.readn1eof() + i, eof := z.readn1eof() if eof { return z.bufr } - if accept.isset(token) { - z.bufr = append(z.bufr, token) + if isNumberChar(i) { + z.bufr = append(z.bufr, i) goto LOOP } z.unreadn1() return z.bufr } +func (z *ioDecReader) skipWhitespace() (token byte) { +LOOP: + token = z.readn1() + if isWhitespaceChar(token) { + goto LOOP + } + return +} + func (z *ioDecReader) readUntil(stop byte, includeLast bool) []byte { z.bufr = z.blist.check(z.bufr, 256)[:0] LOOP: - token, eof := z.readn1eof() - if eof { - panic(io.EOF) - } + token := z.readn1() z.bufr = append(z.bufr, token) if token == stop { if includeLast { @@ -288,18 +264,10 @@ LOOP: goto LOOP } -//go:noinline func (z *ioDecReader) unreadn1() { err := z.UnreadByte() - if err != nil { - panic(err) - } + halt.onerror(err) z.n-- - if z.trb { - if l := len(z.tr) - 1; l >= 0 { - z.tr = z.tr[:l] - } - } } // ------------------------------------ @@ -324,24 +292,28 @@ func (z *bufioDecReader) readb(p []byte) { var n = uint(copy(p, z.buf[z.c:])) z.n += n z.c += n - if len(p) == int(n) { - if z.trb { - z.tr = append(z.tr, p...) - } - } else { - z.readbFill(p, n) + if len(p) != int(n) { + z.readbFill(p, n, true, false) } } -func (z *bufioDecReader) readbFill(p0 []byte, n uint) { +func (z *bufioDecReader) readbFill(p0 []byte, n uint, must bool, eof bool) (isEOF bool, err error) { // at this point, there's nothing in z.buf to read (z.buf is fully consumed) - p := p0[n:] + var p []byte + if p0 != nil { + p = p0[n:] + } var n2 uint - var err error if len(p) > cap(z.buf) { - n2, err = decReadFull(z.r, p) + n2, err = readFull(z.r, p) if err != nil { - panic(err) + if err == io.EOF { + isEOF = true + } + if must && !(eof && isEOF) { + halt.onerror(err) + } + return } n += n2 z.n += n2 @@ -349,57 +321,69 @@ func (z *bufioDecReader) readbFill(p0 []byte, n uint) { z.buf = z.buf[:1] z.buf[0] = p[len(p)-1] z.c = 1 - if z.trb { - z.tr = append(z.tr, p0[:n]...) - } return } // z.c is now 0, and len(p) <= cap(z.buf) + var n1 int LOOP: // for len(p) > 0 && z.err == nil { - if len(p) > 0 { - z.buf = z.buf[0:cap(z.buf)] - var n1 int - n1, err = z.r.Read(z.buf) - n2 = uint(n1) - if n2 == 0 && err != nil { - panic(err) + z.buf = z.buf[0:cap(z.buf)] + n1, err = z.r.Read(z.buf) + n2 = uint(n1) + if n2 == 0 && err != nil { + if err == io.EOF { + isEOF = true } - z.buf = z.buf[:n2] + if must && !(eof && isEOF) { + halt.onerror(err) + } + return + } + err = nil + z.buf = z.buf[:n2] + z.c = 0 + if len(p) > 0 { n2 = uint(copy(p, z.buf)) z.c = n2 n += n2 z.n += n2 p = p[n2:] - goto LOOP - } - if z.c == 0 { - z.buf = z.buf[:1] - z.buf[0] = p[len(p)-1] - z.c = 1 - } - if z.trb { - z.tr = append(z.tr, p0[:n]...) + if len(p) > 0 { + goto LOOP + } + if z.c == 0 { + z.buf = z.buf[:1] + z.buf[0] = p[len(p)-1] + z.c = 1 + } } + return } -func (z *bufioDecReader) last() byte { - return z.buf[z.c-1] -} +// func (z *bufioDecReader) last() byte { +// return z.buf[z.c-1] +// } func (z *bufioDecReader) readn1() (b byte) { - // fast-path, so we elide calling into Read() most of the time - if z.c < uint(len(z.buf)) { - b = z.buf[z.c] - z.c++ - z.n++ - if z.trb { - z.tr = append(z.tr, b) - } - } else { // meaning z.c == len(z.buf) or greater ... so need to fill - z.readbFill(z.b[:1], 0) - b = z.b[0] + if z.c >= uint(len(z.buf)) { + z.readbFill(nil, 0, true, false) } + b = z.buf[z.c] + z.c++ + z.n++ + return +} + +func (z *bufioDecReader) readn1eof() (b byte, eof bool) { + if z.c >= uint(len(z.buf)) { + eof, _ = z.readbFill(nil, 0, true, true) + if eof { + return + } + } + b = z.buf[z.c] + z.c++ + z.n++ return } @@ -409,9 +393,6 @@ func (z *bufioDecReader) unreadn1() { } z.c-- z.n-- - if z.trb { - z.tr = z.tr[:len(z.tr)-1] - } } func (z *bufioDecReader) readn(num uint8) (bs [rwNLen]byte) { @@ -427,135 +408,77 @@ func (z *bufioDecReader) readx(n uint) (bs []byte) { bs = z.buf[z.c : z.c+n] z.n += n z.c += n - if z.trb { - z.tr = append(z.tr, bs...) - } } else { bs = make([]byte, n) // n no longer used - can reuse n = uint(copy(bs, z.buf[z.c:])) z.n += n z.c += n - z.readbFill(bs, n) + z.readbFill(bs, n, true, false) } return } -func (z *bufioDecReader) skip(accept *bitset256) (token byte) { +func (z *bufioDecReader) jsonReadNum() (bs []byte) { + z.unreadn1() + z.bufr = z.blist.check(z.bufr, 256)[:0] +LOOP: + i, eof := z.readn1eof() + if eof { + return z.bufr + } + if isNumberChar(i) { + z.bufr = append(z.bufr, i) + goto LOOP + } + z.unreadn1() + return z.bufr +} + +func (z *bufioDecReader) skipWhitespace() (token byte) { i := z.c LOOP: if i < uint(len(z.buf)) { // inline z.skipLoopFn(i) and refactor, so cost is within inline budget token = z.buf[i] i++ - if accept.isset(token) { + if isWhitespaceChar(token) { goto LOOP } z.n += i - 2 - z.c - if z.trb { - z.tr = append(z.tr, z.buf[z.c:i]...) // z.doTrack(i) - } z.c = i return } - return z.skipFill(accept) + return z.skipFillWhitespace() } -func (z *bufioDecReader) skipFill(accept *bitset256) (token byte) { +func (z *bufioDecReader) skipFillWhitespace() (token byte) { z.n += uint(len(z.buf)) - z.c - if z.trb { - z.tr = append(z.tr, z.buf[z.c:]...) - } var i, n2 int var err error for { z.c = 0 z.buf = z.buf[0:cap(z.buf)] n2, err = z.r.Read(z.buf) - if n2 == 0 && err != nil { - panic(err) + if n2 == 0 { + halt.onerror(err) } z.buf = z.buf[:n2] for i, token = range z.buf { - // if !accept.isset(token) { - if accept.check(token) == 0 { + if !isWhitespaceChar(token) { z.n += (uint(i) - z.c) - 1 z.loopFn(uint(i + 1)) return } } z.n += uint(n2) - if z.trb { - z.tr = append(z.tr, z.buf...) - } } } func (z *bufioDecReader) loopFn(i uint) { - if z.trb { - z.tr = append(z.tr, z.buf[z.c:i]...) // z.doTrack(i) - } z.c = i } -func (z *bufioDecReader) readTo(accept *bitset256) (out []byte) { - i := z.c -LOOP: - if i < uint(len(z.buf)) { - // if !accept.isset(z.buf[i]) { - if accept.check(z.buf[i]) == 0 { - // inline readToLoopFn here (for performance) - z.n += (i - z.c) - 1 - out = z.buf[z.c:i] - if z.trb { - z.tr = append(z.tr, z.buf[z.c:i]...) // z.doTrack(i) - } - z.c = i - return - } - i++ - goto LOOP - } - return z.readToFill(accept) -} - -func (z *bufioDecReader) readToFill(accept *bitset256) []byte { - z.bufr = z.blist.check(z.bufr, 256)[:0] - z.n += uint(len(z.buf)) - z.c - z.bufr = append(z.bufr, z.buf[z.c:]...) - if z.trb { - z.tr = append(z.tr, z.buf[z.c:]...) - } - var n2 int - var err error - for { - z.c = 0 - z.buf = z.buf[:cap(z.buf)] - n2, err = z.r.Read(z.buf) - if n2 == 0 && err != nil { - if err == io.EOF { - return z.bufr // readTo should read until it matches or end is reached - } - panic(err) - } - z.buf = z.buf[:n2] - for i, token := range z.buf { - // if !accept.isset(token) { - if accept.check(token) == 0 { - z.n += (uint(i) - z.c) - 1 - z.bufr = append(z.bufr, z.buf[z.c:i]...) - z.loopFn(uint(i)) - return z.bufr - } - } - z.bufr = append(z.bufr, z.buf...) - z.n += uint(n2) - if z.trb { - z.tr = append(z.tr, z.buf...) - } - } -} - func (z *bufioDecReader) readUntil(stop byte, includeLast bool) (out []byte) { i := z.c LOOP: @@ -564,9 +487,6 @@ LOOP: z.n += (i - z.c) - 1 i++ out = z.buf[z.c:i] - if z.trb { - z.tr = append(z.tr, z.buf[z.c:i]...) // z.doTrack(i) - } z.c = i goto FINISH } @@ -585,15 +505,12 @@ func (z *bufioDecReader) readUntilFill(stop byte) []byte { z.bufr = z.blist.check(z.bufr, 256)[:0] z.n += uint(len(z.buf)) - z.c z.bufr = append(z.bufr, z.buf[z.c:]...) - if z.trb { - z.tr = append(z.tr, z.buf[z.c:]...) - } for { z.c = 0 z.buf = z.buf[0:cap(z.buf)] n1, err := z.r.Read(z.buf) - if n1 == 0 && err != nil { - panic(err) + if n1 == 0 { + halt.onerror(err) } n2 := uint(n1) z.buf = z.buf[:n2] @@ -607,42 +524,44 @@ func (z *bufioDecReader) readUntilFill(stop byte) []byte { } z.bufr = append(z.bufr, z.buf...) z.n += n2 - if z.trb { - z.tr = append(z.tr, z.buf...) - } } } // ------------------------------------ // bytesDecReader is a decReader that reads off a byte slice with zero copying +// +// Note: we do not try to convert index'ing out of bounds to an io.EOF. +// instead, we let it bubble up to the exported Encode/Decode method +// and recover it as an io.EOF. +// +// see panicValToErr(...) function in helper.go. type bytesDecReader struct { b []byte // data c uint // cursor - t uint // track start // a int // available } func (z *bytesDecReader) reset(in []byte) { - z.b = in + // z.b = in + z.b = in[:len(in):len(in)] // so reslicing will not go past capacity z.c = 0 - z.t = 0 } func (z *bytesDecReader) numread() uint { return z.c } -func (z *bytesDecReader) last() byte { - return z.b[z.c-1] -} +// func (z *bytesDecReader) last() byte { +// return z.b[z.c-1] +// } -func (z *bytesDecReader) unreadn1() { - if z.c == 0 || len(z.b) == 0 { - panic(errBytesDecReaderCannotUnread) - } - z.c-- -} +// func (z *bytesDecReader) unreadn1() { +// // if z.c == 0 || len(z.b) == 0 { +// // panic(errBytesDecReaderCannotUnread) +// // } +// z.c-- +// } func (z *bytesDecReader) readx(n uint) (bs []byte) { // slicing from a non-constant start position is more expensive, @@ -658,8 +577,8 @@ func (z *bytesDecReader) readb(bs []byte) { } func (z *bytesDecReader) readn1() (v uint8) { - v = z.b[z.c] - z.c++ + v = z.b[z.c] // cost 7 + z.c++ // cost 4 return } @@ -684,34 +603,30 @@ LOOP: return } -func (z *bytesDecReader) skip(accept *bitset256) (token byte) { +func (z *bytesDecReader) jsonReadNum() (out []byte) { + z.c-- i := z.c LOOP: - // if i < uint(len(z.b)) { - token = z.b[i] - i++ - if accept.isset(token) { + if i < uint(len(z.b)) && isNumberChar(z.b[i]) { + i++ goto LOOP } - z.c = i - return -} - -func (z *bytesDecReader) readTo(accept *bitset256) (out []byte) { - i := z.c -LOOP: - if i < uint(len(z.b)) { - if accept.isset(z.b[i]) { - i++ - goto LOOP - } - } out = z.b[z.c:i] z.c = i return // z.b[c:i] } +func (z *bytesDecReader) skipWhitespace() (token byte) { +LOOP: + token = z.b[z.c] + z.c++ + if isWhitespaceChar(token) { + goto LOOP + } + return +} + func (z *bytesDecReader) readUntil(stop byte, includeLast bool) (out []byte) { i := z.c LOOP: @@ -733,14 +648,6 @@ LOOP: // panic(io.EOF) } -func (z *bytesDecReader) track() { - z.t = z.c -} - -func (z *bytesDecReader) stopTrack() (bs []byte) { - return z.b[z.t:z.c] -} - // -------------- type decRd struct { @@ -760,8 +667,6 @@ type decRd struct { bi *bufioDecReader } -// numread, track and stopTrack are always inlined, as they just check int fields, etc. - // the if/else-if/else block is expensive to inline. // Each node of this construct costs a lot and dominates the budget. // Best to only do an if fast-path else block (so fast-path is inlined). @@ -789,35 +694,6 @@ func (z *decRd) numread() uint { return z.ri.numread() } } -func (z *decRd) stopTrack() []byte { - if z.bytes { - return z.rb.stopTrack() - } else if z.bufio { - return z.bi.stopTrack() - } else { - return z.ri.stopTrack() - } -} - -func (z *decRd) track() { - if z.bytes { - z.rb.track() - } else if z.bufio { - z.bi.track() - } else { - z.ri.track() - } -} - -func (z *decRd) unreadn1() { - if z.bytes { - z.rb.unreadn1() - } else if z.bufio { - z.bi.unreadn1() - } else { - z.ri.unreadn1() // not inlined - } -} func (z *decRd) readn(num uint8) [rwNLen]byte { if z.bytes { @@ -849,33 +725,32 @@ func (z *decRd) readb(s []byte) { } } -func (z *decRd) readn1() uint8 { +func (z *decRd) readn1() (v uint8) { if z.bytes { - return z.rb.readn1() - } else if z.bufio { + // MARKER: manually inline, else this function is not inlined. + // Keep in sync with bytesDecReader.readn1 + // return z.rb.readn1() + v = z.rb.b[z.rb.c] + z.rb.c++ + } else { + v = z.readn1IO() + } + return +} +func (z *decRd) readn1IO() uint8 { + if z.bufio { return z.bi.readn1() - } else { - return z.ri.readn1() } + return z.ri.readn1() } -func (z *decRd) skip(accept *bitset256) (token byte) { +func (z *decRd) skipWhitespace() (token byte) { if z.bytes { - return z.rb.skip(accept) + return z.rb.skipWhitespace() } else if z.bufio { - return z.bi.skip(accept) + return z.bi.skipWhitespace() } else { - return z.ri.skip(accept) - } -} - -func (z *decRd) readTo(accept *bitset256) (out []byte) { - if z.bytes { - return z.rb.readTo(accept) - } else if z.bufio { - return z.bi.readTo(accept) - } else { - return z.ri.readTo(accept) + return z.ri.skipWhitespace() } } @@ -889,129 +764,31 @@ func (z *decRd) readUntil(stop byte, includeLast bool) (out []byte) { } } -/* -func (z *decRd) track() { +func (z *decRd) jsonReadNum() (bs []byte) { if z.bytes { - z.rb.track() + return z.rb.jsonReadNum() + } else if z.bufio { + return z.bi.jsonReadNum() } else { - z.trackIO() - } -} -func (z *decRd) trackIO() { - if z.bufio { - z.bi.track() - } else { - z.ri.track() + return z.ri.jsonReadNum() } } -func (z *decRd) unreadn1() { - if z.bytes { - z.rb.unreadn1() - } else { - z.unreadn1IO() +func readFull(r io.Reader, bs []byte) (n uint, err error) { + var nn int + for n < uint(len(bs)) && err == nil { + nn, err = r.Read(bs[n:]) + if nn > 0 { + if err == io.EOF { + // leave EOF for next time + err = nil + } + n += uint(nn) + } } + // do not do this - it serves no purpose + // if n != len(bs) && err == io.EOF { err = io.ErrUnexpectedEOF } + return } -func (z *decRd) unreadn1IO() { - if z.bufio { - z.bi.unreadn1() - } else { - z.ri.unreadn1() - } -} - -func (z *decRd) readn(num uint8) [rwNLen]byte { - if z.bytes { - return z.rb.readn(num) - } - return z.readnIO(num) -} -func (z *decRd) readnIO(num uint8) [rwNLen]byte { - if z.bufio { - return z.bi.readn(num) - } - return z.ri.readn(num) -} - -func (z *decRd) readx(n uint) []byte { - if z.bytes { - return z.rb.readx(n) - } - return z.readxIO(n) -} -func (z *decRd) readxIO(n uint) []byte { - if z.bufio { - return z.bi.readx(n) - } - return z.ri.readx(n) -} - -func (z *decRd) readb(s []byte) { - if z.bytes { - z.rb.readb(s) - } else { - z.readbIO(s) - } -} -func (z *decRd) readbIO(s []byte) { - if z.bufio { - z.bi.readb(s) - } else { - z.ri.readb(s) - } -} - -func (z *decRd) readn1() uint8 { - if z.bytes { - return z.rb.readn1() - } - return z.readn1IO() -} -func (z *decRd) readn1IO() uint8 { - if z.bufio { - return z.bi.readn1() - } - return z.ri.readn1() -} - -func (z *decRd) skip(accept *bitset256) (token byte) { - if z.bytes { - return z.rb.skip(accept) - } - return z.skipIO(accept) -} -func (z *decRd) skipIO(accept *bitset256) (token byte) { - if z.bufio { - return z.bi.skip(accept) - } - return z.ri.skip(accept) -} - -func (z *decRd) readTo(accept *bitset256) (out []byte) { - if z.bytes { - return z.rb.readTo(accept) - } - return z.readToIO(accept) -} -func (z *decRd) readToIO(accept *bitset256) (out []byte) { - if z.bufio { - return z.bi.readTo(accept) - } - return z.ri.readTo(accept) -} - -func (z *decRd) readUntil(stop byte, includeLast bool) (out []byte) { - if z.bytes { - return z.rb.readUntil(stop, includeLast) - } - return z.readUntilIO(stop, includeLast) -} -func (z *decRd) readUntilIO(stop byte, includeLast bool) (out []byte) { - if z.bufio { - return z.bi.readUntil(stop, includeLast) - } - return z.ri.readUntil(stop, includeLast) -} -*/ var _ decReader = (*decRd)(nil) diff --git a/vendor/github.com/ugorji/go/codec/register_ext.go b/vendor/github.com/ugorji/go/codec/register_ext.go index 68b002c..65e4553 100644 --- a/vendor/github.com/ugorji/go/codec/register_ext.go +++ b/vendor/github.com/ugorji/go/codec/register_ext.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/vendor/github.com/ugorji/go/codec/rpc.go b/vendor/github.com/ugorji/go/codec/rpc.go index 8ee2358..390b96f 100644 --- a/vendor/github.com/ugorji/go/codec/rpc.go +++ b/vendor/github.com/ugorji/go/codec/rpc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -10,7 +10,11 @@ import ( "net/rpc" ) -var errRpcJsonNeedsTermWhitespace = errors.New("rpc requires JsonHandle with TermWhitespace=true") +var ( + errRpcJsonNeedsTermWhitespace = errors.New("rpc - requires JsonHandle with TermWhitespace=true") + errRpcIsClosed = errors.New("rpc - connection has been closed") + errRpcNoConn = errors.New("rpc - no connection") +) // Rpc provides a rpc Server or Client Codec for rpc communication. type Rpc interface { @@ -51,14 +55,14 @@ func newRPCCodec(conn io.ReadWriteCloser, h Handle) rpcCodec { func newRPCCodec2(r io.Reader, w io.Writer, c io.Closer, h Handle) rpcCodec { // defensive: ensure that jsonH has TermWhitespace turned on. - if jsonH, ok := h.(*JsonHandle); ok && !jsonH.TermWhitespace { - panic(errRpcJsonNeedsTermWhitespace) + jsonH, ok := h.(*JsonHandle) + if ok && !jsonH.TermWhitespace { + halt.onerror(errRpcJsonNeedsTermWhitespace) } - // always ensure that we use a flusher, and always flush what was written to the connection. - // we lose nothing by using a buffered writer internally. - f, ok := w.(ioFlusher) + var f ioFlusher bh := basicHandle(h) if !bh.RPCNoBuffer { + f, ok = w.(ioFlusher) if bh.WriterBufferSize <= 0 { if !ok { bw := bufio.NewWriter(w) @@ -66,11 +70,8 @@ func newRPCCodec2(r io.Reader, w io.Writer, c io.Closer, h Handle) rpcCodec { } } if bh.ReaderBufferSize <= 0 { - if _, ok = w.(ioPeeker); !ok { - if _, ok = w.(ioBuffered); !ok { - br := bufio.NewReader(r) - r = br - } + if _, ok = w.(ioBuffered); !ok { + r = bufio.NewReader(r) } } } @@ -86,62 +87,62 @@ func newRPCCodec2(r io.Reader, w io.Writer, c io.Closer, h Handle) rpcCodec { } func (c *rpcCodec) write(obj1, obj2 interface{}, writeObj2 bool) (err error) { - if c.c != nil { - cls := c.cls.load() - if cls.closed { - return cls.errClosed - } + if err = c.ready(); err != nil { + return } err = c.enc.Encode(obj1) - if err == nil { - if writeObj2 { - err = c.enc.Encode(obj2) - } + if err == nil && writeObj2 { + err = c.enc.Encode(obj2) } if c.f != nil { - if err == nil { - err = c.f.Flush() - } else { - _ = c.f.Flush() // swallow flush error, so we maintain prior error on write + if err2 := c.f.Flush(); err == nil { + // ignore flush error if prior error occurred during Encode + err = err2 } } return } -func (c *rpcCodec) swallow(err *error) { - defer panicToErr(c.dec, err) - c.dec.swallow() -} - func (c *rpcCodec) read(obj interface{}) (err error) { - if c.c != nil { - cls := c.cls.load() - if cls.closed { - return cls.errClosed - } + if err = c.ready(); err != nil { + return } //If nil is passed in, we should read and discard if obj == nil { // var obj2 interface{} // return c.dec.Decode(&obj2) - c.swallow(&err) + defer panicToErr(c.dec, &err) + c.dec.swallow() return } return c.dec.Decode(obj) } -func (c *rpcCodec) Close() error { +func (c *rpcCodec) Close() (err error) { + if c.c != nil { + cls := c.cls.load() + if !cls.closed { + cls.errClosed = c.c.Close() + cls.closed = true + c.cls.store(cls) + } + err = cls.errClosed + } + return +} + +func (c *rpcCodec) ready() (err error) { if c.c == nil { - return nil + err = errRpcNoConn + } else { + cls := c.cls.load() + if cls.closed { + if err = cls.errClosed; err == nil { + err = errRpcIsClosed + } + } } - cls := c.cls.load() - if cls.closed { - return cls.errClosed - } - cls.errClosed = c.c.Close() - cls.closed = true - c.cls.store(cls) - return cls.errClosed + return } func (c *rpcCodec) ReadResponseBody(body interface{}) error { diff --git a/vendor/github.com/ugorji/go/codec/simple.go b/vendor/github.com/ugorji/go/codec/simple.go index 42bfd04..616abd6 100644 --- a/vendor/github.com/ugorji/go/codec/simple.go +++ b/vendor/github.com/ugorji/go/codec/simple.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -30,6 +30,33 @@ const ( simpleVdExt = 248 ) +var simpledescNames = map[byte]string{ + simpleVdNil: "null", + simpleVdFalse: "false", + simpleVdTrue: "true", + simpleVdFloat32: "float32", + simpleVdFloat64: "float64", + + simpleVdPosInt: "+int", + simpleVdNegInt: "-int", + + simpleVdTime: "time", + + simpleVdString: "string", + simpleVdByteArray: "binary", + simpleVdArray: "array", + simpleVdMap: "map", + simpleVdExt: "ext", +} + +func simpledesc(bd byte) (s string) { + s = simpledescNames[bd] + if s == "" { + s = "unknown" + } + return +} + type simpleEncDriver struct { noBuiltInTypes encDriverNoopContainerWriter @@ -194,7 +221,7 @@ func (e *simpleEncDriver) EncodeTime(t time.Time) { } v, err := t.MarshalBinary() if err != nil { - e.e.errorv(err) + e.e.onerror(err) return } // time.Time marshalbinary takes about 14 bytes. @@ -208,7 +235,7 @@ type simpleDecDriver struct { h *SimpleHandle bdRead bool bd byte - fnil bool + _ bool noBuiltInTypes decDriverNoopContainerReader _ [6]uint64 // padding @@ -224,39 +251,24 @@ func (d *simpleDecDriver) readNextBd() { d.bdRead = true } -func (d *simpleDecDriver) uncacheRead() { - if d.bdRead { - d.d.decRd.unreadn1() - d.bdRead = false - } -} - func (d *simpleDecDriver) advanceNil() (null bool) { - d.fnil = false if !d.bdRead { d.readNextBd() } if d.bd == simpleVdNil { d.bdRead = false - d.fnil = true null = true } return } -func (d *simpleDecDriver) Nil() bool { - return d.fnil -} - func (d *simpleDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } - d.fnil = false switch d.bd { case simpleVdNil: d.bdRead = false - d.fnil = true return valueTypeNil case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: @@ -302,7 +314,6 @@ func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { neg = true default: d.d.errorf("integer only valid from pos/neg integer1..8. Invalid descriptor: %v", d.bd) - return } // DO NOT do this check below, because callers may only want the unsigned value: // @@ -333,7 +344,6 @@ func (d *simpleDecDriver) DecodeUint64() (ui uint64) { ui, neg := d.decCheckInteger() if neg { d.d.errorf("assigning negative signed value to unsigned type") - return } d.bdRead = false return @@ -352,7 +362,6 @@ func (d *simpleDecDriver) DecodeFloat64() (f float64) { f = float64(d.DecodeInt64()) } else { d.d.errorf("float only valid from float32/64: Invalid descriptor: %v", d.bd) - return } } d.bdRead = false @@ -369,7 +378,6 @@ func (d *simpleDecDriver) DecodeBool() (b bool) { b = true } else { d.d.errorf("cannot decode bool - %s: %x", msgBadDesc, d.bd) - return } d.bdRead = false return @@ -377,7 +385,7 @@ func (d *simpleDecDriver) DecodeBool() (b bool) { func (d *simpleDecDriver) ReadMapStart() (length int) { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } d.bdRead = false return d.decLen() @@ -385,12 +393,19 @@ func (d *simpleDecDriver) ReadMapStart() (length int) { func (d *simpleDecDriver) ReadArrayStart() (length int) { if d.advanceNil() { - return decContainerLenNil + return containerLenNil } d.bdRead = false return d.decLen() } +func (d *simpleDecDriver) uint2Len(ui uint64) int { + if chkOvf.Uint(ui, intBitsize) { + d.d.errorf("overflow integer: %v", ui) + } + return int(ui) +} + func (d *simpleDecDriver) decLen() int { switch d.bd % 8 { case 0: @@ -400,19 +415,9 @@ func (d *simpleDecDriver) decLen() int { case 2: return int(bigen.Uint16(d.d.decRd.readx(2))) case 3: - ui := uint64(bigen.Uint32(d.d.decRd.readx(4))) - if chkOvf.Uint(ui, intBitsize) { - d.d.errorf("overflow integer: %v", ui) - return 0 - } - return int(ui) + return d.uint2Len(uint64(bigen.Uint32(d.d.decRd.readx(4)))) case 4: - ui := bigen.Uint64(d.d.decRd.readx(8)) - if chkOvf.Uint(ui, intBitsize) { - d.d.errorf("overflow integer: %v", ui) - return 0 - } - return int(ui) + return d.uint2Len(bigen.Uint64(d.d.decRd.readx(8))) } d.d.errorf("cannot read length: bd%%8 must be in range 0..4. Got: %d", d.bd%8) return -1 @@ -442,12 +447,11 @@ func (d *simpleDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { clen := d.decLen() d.bdRead = false - if zerocopy { - if d.d.bytes { - return d.d.decRd.readx(uint(clen)) - } else if len(bs) == 0 { - bs = d.d.b[:] - } + if d.d.bytes && (zerocopy || d.h.ZeroCopy) { + return d.d.decRd.rb.readx(uint(clen)) + } + if zerocopy && len(bs) == 0 { + bs = d.d.b[:] } return decByteSlice(d.d.r(), clen, d.d.h.MaxInitLen, bs) } @@ -458,21 +462,17 @@ func (d *simpleDecDriver) DecodeTime() (t time.Time) { } if d.bd != simpleVdTime { d.d.errorf("invalid descriptor for time.Time - expect 0x%x, received 0x%x", simpleVdTime, d.bd) - return } d.bdRead = false - clen := int(d.d.decRd.readn1()) - b := d.d.decRd.readx(uint(clen)) - if err := (&t).UnmarshalBinary(b); err != nil { - d.d.errorv(err) - } + clen := uint(d.d.decRd.readn1()) + b := d.d.decRd.readx(clen) + d.d.onerror((&t).UnmarshalBinary(b)) return } func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) { if xtag > 0xff { d.d.errorf("ext: tag must be <= 0xff; got: %v", xtag) - return } if d.advanceNil() { return @@ -497,10 +497,9 @@ func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs [ xtag = d.d.decRd.readn1() if verifyTag && xtag != tag { d.d.errorf("wrong extension tag. Got %b. Expecting: %v", xtag, tag) - return } if d.d.bytes { - xbs = d.d.decRd.readx(uint(l)) + xbs = d.d.decRd.rb.readx(uint(l)) } else { xbs = decByteSlice(d.d.r(), l, d.d.h.MaxInitLen, d.d.b[:]) } @@ -509,7 +508,6 @@ func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs [ xbs = d.DecodeBytes(nil, true) default: d.d.errorf("ext - %s - expecting extensions/bytearray, got: 0x%x", msgBadDesc, d.bd) - return } d.bdRead = false return @@ -520,14 +518,12 @@ func (d *simpleDecDriver) DecodeNaked() { d.readNextBd() } - d.fnil = false n := d.d.naked() var decodeFurther bool switch d.bd { case simpleVdNil: n.v = valueTypeNil - d.fnil = true case simpleVdFalse: n.v = valueTypeBool n.b = false @@ -560,13 +556,13 @@ func (d *simpleDecDriver) DecodeNaked() { n.s = string(d.DecodeStringAsBytes()) case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: - decNakedReadRawBytes(d, &d.d, n, d.h.RawToString) + fauxUnionReadRawBytes(d, &d.d, n, d.h.RawToString) case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4: n.v = valueTypeExt l := d.decLen() n.u = uint64(d.d.decRd.readn1()) if d.d.bytes { - n.l = d.d.decRd.readx(uint(l)) + n.l = d.d.decRd.rb.readx(uint(l)) } else { n.l = decByteSlice(d.d.r(), l, d.d.h.MaxInitLen, d.d.b[:]) } @@ -586,6 +582,102 @@ func (d *simpleDecDriver) DecodeNaked() { } } +func (d *simpleDecDriver) nextValueBytes(start []byte) (v []byte) { + if !d.bdRead { + d.readNextBd() + } + v = append(start, d.bd) + v = d.nextValueBytesBdReadR(v) + d.bdRead = false + return +} + +func (d *simpleDecDriver) nextValueBytesR(v0 []byte) (v []byte) { + d.readNextBd() + v = append(v0, d.bd) + return d.nextValueBytesBdReadR(v) +} + +func (d *simpleDecDriver) nextValueBytesBdReadR(v0 []byte) (v []byte) { + v = v0 + c := d.bd + + var x []byte + var length uint + + switch c { + case simpleVdNil, simpleVdFalse, simpleVdTrue, simpleVdString, simpleVdByteArray: + // pass + case simpleVdPosInt, simpleVdNegInt: + v = append(v, d.d.decRd.readn1()) + case simpleVdPosInt + 1, simpleVdNegInt + 1: + v = append(v, d.d.decRd.readx(2)...) + case simpleVdPosInt + 2, simpleVdNegInt + 2, simpleVdFloat32: + v = append(v, d.d.decRd.readx(4)...) + case simpleVdPosInt + 3, simpleVdNegInt + 3, simpleVdFloat64: + v = append(v, d.d.decRd.readx(8)...) + case simpleVdTime: + c = d.d.decRd.readn1() + v = append(v, c) + v = append(v, d.d.decRd.readx(uint(c))...) + + default: + switch c % 8 { + case 0: + x = nil + length = 0 + case 1: + x = d.d.decRd.readx(1) + length = uint(x[0]) + case 2: + x = d.d.decRd.readx(2) + length = uint(bigen.Uint16(x)) + case 3: + x = d.d.decRd.readx(4) + length = uint(bigen.Uint32(x)) + case 4: + x = d.d.decRd.readx(8) + length = uint(bigen.Uint64(x)) + } + + if len(x) > 0 { + v = append(v, x...) + } + + bExt := c >= simpleVdExt && c <= simpleVdExt+7 + bStr := c >= simpleVdString && c <= simpleVdString+7 + bByteArray := c >= simpleVdByteArray && c <= simpleVdByteArray+7 + bArray := c >= simpleVdArray && c <= simpleVdArray+7 + bMap := c >= simpleVdMap && c <= simpleVdMap+7 + + if !(bExt || bStr || bByteArray || bArray || bMap) { + d.d.errorf("cannot infer value - %s 0x%x", msgBadDesc, c) + } + + if bExt { + v = append(v, d.d.decRd.readn1()) // tag + } + + if length == 0 { + break + } + + if bArray { + for i := uint(0); i < length; i++ { + v = d.nextValueBytesR(v) + } + } else if bMap { + for i := uint(0); i < length; i++ { + v = d.nextValueBytesR(v) + v = d.nextValueBytesR(v) + } + } else { + v = append(v, d.d.decRd.readx(length)...) + } + } + return +} + //------------------------------------ // SimpleHandle is a Handle for a very simple encoding format. @@ -619,6 +711,8 @@ type SimpleHandle struct { // Name returns the name of the handle: simple func (h *SimpleHandle) Name() string { return "simple" } +func (h *SimpleHandle) desc(bd byte) string { return simpledesc(bd) } + func (h *SimpleHandle) newEncDriver() encDriver { var e = &simpleEncDriver{h: h} e.e.e = e @@ -640,7 +734,6 @@ func (e *simpleEncDriver) reset() { func (d *simpleDecDriver) reset() { d.bd, d.bdRead = 0, false - d.fnil = false } var _ decDriver = (*simpleDecDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/sort-slice.generated.go b/vendor/github.com/ugorji/go/codec/sort-slice.generated.go index 352ddfb..fbee775 100644 --- a/vendor/github.com/ugorji/go/codec/sort-slice.generated.go +++ b/vendor/github.com/ugorji/go/codec/sort-slice.generated.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from sort-slice.go.tmpl - DO NOT EDIT. @@ -17,12 +17,12 @@ func (p stringSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -type float64Slice []float64 +type uint8Slice []uint8 -func (p float64Slice) Len() int { return len(p) } -func (p float64Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p float64Slice) Less(i, j int) bool { - return p[uint(i)] < p[uint(j)] || isNaN64(p[uint(i)]) && !isNaN64(p[uint(j)]) +func (p uint8Slice) Len() int { return len(p) } +func (p uint8Slice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } +func (p uint8Slice) Less(i, j int) bool { + return p[uint(i)] < p[uint(j)] } type uint64Slice []uint64 @@ -33,11 +33,11 @@ func (p uint64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -type uintptrSlice []uintptr +type intSlice []int -func (p uintptrSlice) Len() int { return len(p) } -func (p uintptrSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p uintptrSlice) Less(i, j int) bool { +func (p intSlice) Len() int { return len(p) } +func (p intSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } +func (p intSlice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } @@ -49,30 +49,6 @@ func (p int64Slice) Less(i, j int) bool { return p[uint(i)] < p[uint(j)] } -type boolSlice []bool - -func (p boolSlice) Len() int { return len(p) } -func (p boolSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p boolSlice) Less(i, j int) bool { - return !p[uint(i)] && p[uint(j)] -} - -type timeSlice []time.Time - -func (p timeSlice) Len() int { return len(p) } -func (p timeSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p timeSlice) Less(i, j int) bool { - return p[uint(i)].Before(p[uint(j)]) -} - -type bytesSlice [][]byte - -func (p bytesSlice) Len() int { return len(p) } -func (p bytesSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p bytesSlice) Less(i, j int) bool { - return bytes.Compare(p[uint(i)], p[uint(j)]) == -1 -} - type stringRv struct { v string r reflect.Value @@ -85,18 +61,6 @@ func (p stringRvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v } -type stringIntf struct { - v string - i interface{} -} -type stringIntfSlice []stringIntf - -func (p stringIntfSlice) Len() int { return len(p) } -func (p stringIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p stringIntfSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v -} - type float64Rv struct { v float64 r reflect.Value @@ -109,18 +73,6 @@ func (p float64RvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v || isNaN64(p[uint(i)].v) && !isNaN64(p[uint(j)].v) } -type float64Intf struct { - v float64 - i interface{} -} -type float64IntfSlice []float64Intf - -func (p float64IntfSlice) Len() int { return len(p) } -func (p float64IntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p float64IntfSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v || isNaN64(p[uint(i)].v) && !isNaN64(p[uint(j)].v) -} - type uint64Rv struct { v uint64 r reflect.Value @@ -133,42 +85,6 @@ func (p uint64RvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v } -type uint64Intf struct { - v uint64 - i interface{} -} -type uint64IntfSlice []uint64Intf - -func (p uint64IntfSlice) Len() int { return len(p) } -func (p uint64IntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p uint64IntfSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v -} - -type uintptrRv struct { - v uintptr - r reflect.Value -} -type uintptrRvSlice []uintptrRv - -func (p uintptrRvSlice) Len() int { return len(p) } -func (p uintptrRvSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p uintptrRvSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v -} - -type uintptrIntf struct { - v uintptr - i interface{} -} -type uintptrIntfSlice []uintptrIntf - -func (p uintptrIntfSlice) Len() int { return len(p) } -func (p uintptrIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p uintptrIntfSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v -} - type int64Rv struct { v int64 r reflect.Value @@ -181,18 +97,6 @@ func (p int64RvSlice) Less(i, j int) bool { return p[uint(i)].v < p[uint(j)].v } -type int64Intf struct { - v int64 - i interface{} -} -type int64IntfSlice []int64Intf - -func (p int64IntfSlice) Len() int { return len(p) } -func (p int64IntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p int64IntfSlice) Less(i, j int) bool { - return p[uint(i)].v < p[uint(j)].v -} - type boolRv struct { v bool r reflect.Value @@ -205,18 +109,6 @@ func (p boolRvSlice) Less(i, j int) bool { return !p[uint(i)].v && p[uint(j)].v } -type boolIntf struct { - v bool - i interface{} -} -type boolIntfSlice []boolIntf - -func (p boolIntfSlice) Len() int { return len(p) } -func (p boolIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p boolIntfSlice) Less(i, j int) bool { - return !p[uint(i)].v && p[uint(j)].v -} - type timeRv struct { v time.Time r reflect.Value @@ -229,18 +121,6 @@ func (p timeRvSlice) Less(i, j int) bool { return p[uint(i)].v.Before(p[uint(j)].v) } -type timeIntf struct { - v time.Time - i interface{} -} -type timeIntfSlice []timeIntf - -func (p timeIntfSlice) Len() int { return len(p) } -func (p timeIntfSlice) Swap(i, j int) { p[uint(i)], p[uint(j)] = p[uint(j)], p[uint(i)] } -func (p timeIntfSlice) Less(i, j int) bool { - return p[uint(i)].v.Before(p[uint(j)].v) -} - type bytesRv struct { v []byte r reflect.Value diff --git a/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl b/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl index 95d348c..aef9dd0 100644 --- a/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/sort-slice.go.tmpl @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // Code generated from sort-slice.go.tmpl - DO NOT EDIT. @@ -54,11 +54,13 @@ type {{ $v }}Rv struct { type {{ $v }}RvSlice []{{ $v }}Rv {{template "T" args "Kind" $v "Type" (print $v "RvSlice") "V" ".v"}} +{{if eq $v "bytes" -}} type {{ $v }}Intf struct { v {{ $t }} i interface{} } type {{ $v }}IntfSlice []{{ $v }}Intf {{template "T" args "Kind" $v "Type" (print $v "IntfSlice") "V" ".v"}} +{{end}} {{end}} diff --git a/vendor/github.com/ugorji/go/codec/test.py b/vendor/github.com/ugorji/go/codec/test.py index 800376f..25bbf53 100644 --- a/vendor/github.com/ugorji/go/codec/test.py +++ b/vendor/github.com/ugorji/go/codec/test.py @@ -11,8 +11,11 @@ # Ensure all "string" keys are utf strings (else encoded as bytes) +from __future__ import print_function import cbor, msgpack, msgpackrpc, sys, os, threading +mylocaladdr="127.0.0.1" # localhost.localdomain localhost 127.0.0.1 + def get_test_data_list(): # get list with all primitive types, and a combo type l0 = [ @@ -69,13 +72,11 @@ def build_test_data(destdir): for i in range(len(l)): # packer = msgpack.Packer() serialized = msgpack.dumps(l[i]) - f = open(os.path.join(destdir, str(i) + '.msgpack.golden'), 'wb') - f.write(serialized) - f.close() + with open(os.path.join(destdir, str(i) + '.msgpack.golden'), 'wb') as f: + f.write(serialized) serialized = cbor.dumps(l[i]) - f = open(os.path.join(destdir, str(i) + '.cbor.golden'), 'wb') - f.write(serialized) - f.close() + with open(os.path.join(destdir, str(i) + '.cbor.golden'), 'wb') as f: + f.write(serialized) def doRpcServer(port, stopTimeSec): class EchoHandler(object): @@ -84,7 +85,7 @@ def doRpcServer(port, stopTimeSec): def EchoStruct(self, msg): return ("%s" % msg) - addr = msgpackrpc.Address('127.0.0.1', port) + addr = msgpackrpc.Address(mylocaladdr, port) server = msgpackrpc.Server(EchoHandler()) server.listen(addr) # run thread to stop it after stopTimeSec seconds if > 0 @@ -96,17 +97,17 @@ def doRpcServer(port, stopTimeSec): server.start() def doRpcClientToPythonSvc(port): - address = msgpackrpc.Address('127.0.0.1', port) + address = msgpackrpc.Address(mylocaladdr, port) client = msgpackrpc.Client(address, unpack_encoding='utf-8') - print client.call("Echo123", "A1", "B2", "C3") - print client.call("EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"}) + print(client.call("Echo123", "A1", "B2", "C3")) + print(client.call("EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})) def doRpcClientToGoSvc(port): - # print ">>>> port: ", port, " <<<<<" - address = msgpackrpc.Address('127.0.0.1', port) + # print(">>>> port: ", port, " <<<<<") + address = msgpackrpc.Address(mylocaladdr, port) client = msgpackrpc.Client(address, unpack_encoding='utf-8') - print client.call("TestRpcInt.Echo123", ["A1", "B2", "C3"]) - print client.call("TestRpcInt.EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"}) + print(client.call("TestRpcInt.Echo123", ["A1", "B2", "C3"])) + print(client.call("TestRpcInt.EchoStruct", {"A" :"Aa", "B":"Bb", "C":"Cc"})) def doMain(args): if len(args) == 2 and args[0] == "testdata": @@ -123,4 +124,3 @@ def doMain(args): if __name__ == "__main__": doMain(sys.argv[1:]) - diff --git a/vendor/github.com/ugorji/go/codec/writer.go b/vendor/github.com/ugorji/go/codec/writer.go index 764790b..b582bbf 100644 --- a/vendor/github.com/ugorji/go/codec/writer.go +++ b/vendor/github.com/ugorji/go/codec/writer.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -11,9 +11,11 @@ type encWriter interface { writestr(string) writeqstr(string) // write string wrapped in quotes ie "..." writen1(byte) + + // add convenience functions for writing 2,4 writen2(byte, byte) - // writen will write up to 7 bytes at a time. - writen(b [rwNLen]byte, num uint8) + writen4(byte, byte, byte, byte) + end() } @@ -53,23 +55,22 @@ func (z *bufioEncWriter) reset(w io.Writer, bufsize int, blist *bytesFreelist) { z.buf = z.buf[:cap(z.buf)] } -//go:noinline - flush only called intermittently func (z *bufioEncWriter) flushErr() (err error) { n, err := z.w.Write(z.buf[:z.n]) z.n -= n - if z.n > 0 && err == nil { - err = io.ErrShortWrite - } - if n > 0 && z.n > 0 { - copy(z.buf, z.buf[n:z.n+n]) + if z.n > 0 { + if err == nil { + err = io.ErrShortWrite + } + if n > 0 { + copy(z.buf, z.buf[n:z.n+n]) + } } return err } func (z *bufioEncWriter) flush() { - if err := z.flushErr(); err != nil { - panic(err) - } + halt.onerror(z.flushErr()) } func (z *bufioEncWriter) writeb(s []byte) { @@ -127,7 +128,6 @@ func (z *bufioEncWriter) writen1(b1 byte) { z.buf[z.n] = b1 z.n++ } - func (z *bufioEncWriter) writen2(b1, b2 byte) { if 2 > len(z.buf)-z.n { z.flush() @@ -136,13 +136,15 @@ func (z *bufioEncWriter) writen2(b1, b2 byte) { z.buf[z.n] = b1 z.n += 2 } - -func (z *bufioEncWriter) writen(b [rwNLen]byte, num uint8) { - if int(num) > len(z.buf)-z.n { +func (z *bufioEncWriter) writen4(b1, b2, b3, b4 byte) { + if 4 > len(z.buf)-z.n { z.flush() } - copy(z.buf[z.n:], b[:num]) - z.n += int(num) + z.buf[z.n+3] = b4 + z.buf[z.n+2] = b3 + z.buf[z.n+1] = b2 + z.buf[z.n] = b1 + z.n += 4 } func (z *bufioEncWriter) endErr() (err error) { @@ -168,7 +170,6 @@ func (z *bytesEncAppender) writestr(s string) { } func (z *bytesEncAppender) writeqstr(s string) { z.b = append(append(append(z.b, '"'), s...), '"') - // z.b = append(z.b, '"') // z.b = append(z.b, s...) // z.b = append(z.b, '"') @@ -177,13 +178,10 @@ func (z *bytesEncAppender) writen1(b1 byte) { z.b = append(z.b, b1) } func (z *bytesEncAppender) writen2(b1, b2 byte) { - z.b = append(z.b, b1, b2) // cost: 81 + z.b = append(z.b, b1, b2) } -func (z *bytesEncAppender) writen(s [rwNLen]byte, num uint8) { - // if num <= rwNLen { - if int(num) <= len(s) { - z.b = append(z.b, s[:num]...) - } +func (z *bytesEncAppender) writen4(b1, b2, b3, b4 byte) { + z.b = append(z.b, b1, b2, b3, b4) } func (z *bytesEncAppender) endErr() error { *(z.out) = z.b @@ -209,6 +207,11 @@ type encWr struct { wf *bufioEncWriter } +// MARKER: manually inline bytesEncAppender.writenx/writeqstr methods, +// as calling them causes encWr.writenx/writeqstr methods to not be inlined (cost > 80). +// +// i.e. e.g. instead of writing z.wb.writen2(b1, b2), use z.wb.b = append(z.wb.b, b1, b2) + func (z *encWr) writeb(s []byte) { if z.bytes { z.wb.writeb(s) @@ -218,7 +221,8 @@ func (z *encWr) writeb(s []byte) { } func (z *encWr) writeqstr(s string) { if z.bytes { - z.wb.writeqstr(s) + // MARKER: z.wb.writeqstr(s) + z.wb.b = append(append(append(z.wb.b, '"'), s...), '"') } else { z.wf.writeqstr(s) } @@ -237,20 +241,24 @@ func (z *encWr) writen1(b1 byte) { z.wf.writen1(b1) } } + func (z *encWr) writen2(b1, b2 byte) { if z.bytes { - z.wb.writen2(b1, b2) + // MARKER: z.wb.writen2(b1, b2) + z.wb.b = append(z.wb.b, b1, b2) } else { z.wf.writen2(b1, b2) } } -func (z *encWr) writen(b [rwNLen]byte, num uint8) { +func (z *encWr) writen4(b1, b2, b3, b4 byte) { if z.bytes { - z.wb.writen(b, num) + // MARKER: z.wb.writen4(b1, b2, b3, b4) + z.wb.b = append(z.wb.b, b1, b2, b3, b4) } else { - z.wf.writen(b, num) + z.wf.writen4(b1, b2, b3, b4) } } + func (z *encWr) endErr() error { if z.bytes { return z.wb.endErr() @@ -259,9 +267,7 @@ func (z *encWr) endErr() error { } func (z *encWr) end() { - if err := z.endErr(); err != nil { - panic(err) - } + halt.onerror(z.endErr()) } var _ encWriter = (*encWr)(nil) diff --git a/vendor/golang.org/x/crypto/sha3/doc.go b/vendor/golang.org/x/crypto/sha3/doc.go new file mode 100644 index 0000000..c2fef30 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/doc.go @@ -0,0 +1,66 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sha3 implements the SHA-3 fixed-output-length hash functions and +// the SHAKE variable-output-length hash functions defined by FIPS-202. +// +// Both types of hash function use the "sponge" construction and the Keccak +// permutation. For a detailed specification see http://keccak.noekeon.org/ +// +// +// Guidance +// +// If you aren't sure what function you need, use SHAKE256 with at least 64 +// bytes of output. The SHAKE instances are faster than the SHA3 instances; +// the latter have to allocate memory to conform to the hash.Hash interface. +// +// If you need a secret-key MAC (message authentication code), prepend the +// secret key to the input, hash with SHAKE256 and read at least 32 bytes of +// output. +// +// +// Security strengths +// +// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security +// strength against preimage attacks of x bits. Since they only produce "x" +// bits of output, their collision-resistance is only "x/2" bits. +// +// The SHAKE-256 and -128 functions have a generic security strength of 256 and +// 128 bits against all attacks, provided that at least 2x bits of their output +// is used. Requesting more than 64 or 32 bytes of output, respectively, does +// not increase the collision-resistance of the SHAKE functions. +// +// +// The sponge construction +// +// A sponge builds a pseudo-random function from a public pseudo-random +// permutation, by applying the permutation to a state of "rate + capacity" +// bytes, but hiding "capacity" of the bytes. +// +// A sponge starts out with a zero state. To hash an input using a sponge, up +// to "rate" bytes of the input are XORed into the sponge's state. The sponge +// is then "full" and the permutation is applied to "empty" it. This process is +// repeated until all the input has been "absorbed". The input is then padded. +// The digest is "squeezed" from the sponge in the same way, except that output +// is copied out instead of input being XORed in. +// +// A sponge is parameterized by its generic security strength, which is equal +// to half its capacity; capacity + rate is equal to the permutation's width. +// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means +// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2. +// +// +// Recommendations +// +// The SHAKE functions are recommended for most new uses. They can produce +// output of arbitrary length. SHAKE256, with an output length of at least +// 64 bytes, provides 256-bit security against all attacks. The Keccak team +// recommends it for most applications upgrading from SHA2-512. (NIST chose a +// much stronger, but much slower, sponge instance for SHA3-512.) +// +// The SHA-3 functions are "drop-in" replacements for the SHA-2 functions. +// They produce output of the same length, with the same security strengths +// against all attacks. This means, in particular, that SHA3-256 only has +// 128-bit collision resistance, because its output length is 32 bytes. +package sha3 // import "golang.org/x/crypto/sha3" diff --git a/vendor/golang.org/x/crypto/sha3/hashes.go b/vendor/golang.org/x/crypto/sha3/hashes.go new file mode 100644 index 0000000..0d8043f --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/hashes.go @@ -0,0 +1,97 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha3 + +// This file provides functions for creating instances of the SHA-3 +// and SHAKE hash functions, as well as utility functions for hashing +// bytes. + +import ( + "hash" +) + +// New224 creates a new SHA3-224 hash. +// Its generic security strength is 224 bits against preimage attacks, +// and 112 bits against collision attacks. +func New224() hash.Hash { + if h := new224Asm(); h != nil { + return h + } + return &state{rate: 144, outputLen: 28, dsbyte: 0x06} +} + +// New256 creates a new SHA3-256 hash. +// Its generic security strength is 256 bits against preimage attacks, +// and 128 bits against collision attacks. +func New256() hash.Hash { + if h := new256Asm(); h != nil { + return h + } + return &state{rate: 136, outputLen: 32, dsbyte: 0x06} +} + +// New384 creates a new SHA3-384 hash. +// Its generic security strength is 384 bits against preimage attacks, +// and 192 bits against collision attacks. +func New384() hash.Hash { + if h := new384Asm(); h != nil { + return h + } + return &state{rate: 104, outputLen: 48, dsbyte: 0x06} +} + +// New512 creates a new SHA3-512 hash. +// Its generic security strength is 512 bits against preimage attacks, +// and 256 bits against collision attacks. +func New512() hash.Hash { + if h := new512Asm(); h != nil { + return h + } + return &state{rate: 72, outputLen: 64, dsbyte: 0x06} +} + +// NewLegacyKeccak256 creates a new Keccak-256 hash. +// +// Only use this function if you require compatibility with an existing cryptosystem +// that uses non-standard padding. All other users should use New256 instead. +func NewLegacyKeccak256() hash.Hash { return &state{rate: 136, outputLen: 32, dsbyte: 0x01} } + +// NewLegacyKeccak512 creates a new Keccak-512 hash. +// +// Only use this function if you require compatibility with an existing cryptosystem +// that uses non-standard padding. All other users should use New512 instead. +func NewLegacyKeccak512() hash.Hash { return &state{rate: 72, outputLen: 64, dsbyte: 0x01} } + +// Sum224 returns the SHA3-224 digest of the data. +func Sum224(data []byte) (digest [28]byte) { + h := New224() + h.Write(data) + h.Sum(digest[:0]) + return +} + +// Sum256 returns the SHA3-256 digest of the data. +func Sum256(data []byte) (digest [32]byte) { + h := New256() + h.Write(data) + h.Sum(digest[:0]) + return +} + +// Sum384 returns the SHA3-384 digest of the data. +func Sum384(data []byte) (digest [48]byte) { + h := New384() + h.Write(data) + h.Sum(digest[:0]) + return +} + +// Sum512 returns the SHA3-512 digest of the data. +func Sum512(data []byte) (digest [64]byte) { + h := New512() + h.Write(data) + h.Sum(digest[:0]) + return +} diff --git a/vendor/golang.org/x/crypto/sha3/hashes_generic.go b/vendor/golang.org/x/crypto/sha3/hashes_generic.go new file mode 100644 index 0000000..f455147 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/hashes_generic.go @@ -0,0 +1,27 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gccgo appengine !s390x + +package sha3 + +import ( + "hash" +) + +// new224Asm returns an assembly implementation of SHA3-224 if available, +// otherwise it returns nil. +func new224Asm() hash.Hash { return nil } + +// new256Asm returns an assembly implementation of SHA3-256 if available, +// otherwise it returns nil. +func new256Asm() hash.Hash { return nil } + +// new384Asm returns an assembly implementation of SHA3-384 if available, +// otherwise it returns nil. +func new384Asm() hash.Hash { return nil } + +// new512Asm returns an assembly implementation of SHA3-512 if available, +// otherwise it returns nil. +func new512Asm() hash.Hash { return nil } diff --git a/vendor/golang.org/x/crypto/sha3/keccakf.go b/vendor/golang.org/x/crypto/sha3/keccakf.go new file mode 100644 index 0000000..46d03ed --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/keccakf.go @@ -0,0 +1,412 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !amd64 appengine gccgo + +package sha3 + +// rc stores the round constants for use in the ι step. +var rc = [24]uint64{ + 0x0000000000000001, + 0x0000000000008082, + 0x800000000000808A, + 0x8000000080008000, + 0x000000000000808B, + 0x0000000080000001, + 0x8000000080008081, + 0x8000000000008009, + 0x000000000000008A, + 0x0000000000000088, + 0x0000000080008009, + 0x000000008000000A, + 0x000000008000808B, + 0x800000000000008B, + 0x8000000000008089, + 0x8000000000008003, + 0x8000000000008002, + 0x8000000000000080, + 0x000000000000800A, + 0x800000008000000A, + 0x8000000080008081, + 0x8000000000008080, + 0x0000000080000001, + 0x8000000080008008, +} + +// keccakF1600 applies the Keccak permutation to a 1600b-wide +// state represented as a slice of 25 uint64s. +func keccakF1600(a *[25]uint64) { + // Implementation translated from Keccak-inplace.c + // in the keccak reference code. + var t, bc0, bc1, bc2, bc3, bc4, d0, d1, d2, d3, d4 uint64 + + for i := 0; i < 24; i += 4 { + // Combines the 5 steps in each round into 2 steps. + // Unrolls 4 rounds per loop and spreads some steps across rounds. + + // Round 1 + bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20] + bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21] + bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22] + bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23] + bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24] + d0 = bc4 ^ (bc1<<1 | bc1>>63) + d1 = bc0 ^ (bc2<<1 | bc2>>63) + d2 = bc1 ^ (bc3<<1 | bc3>>63) + d3 = bc2 ^ (bc4<<1 | bc4>>63) + d4 = bc3 ^ (bc0<<1 | bc0>>63) + + bc0 = a[0] ^ d0 + t = a[6] ^ d1 + bc1 = t<<44 | t>>(64-44) + t = a[12] ^ d2 + bc2 = t<<43 | t>>(64-43) + t = a[18] ^ d3 + bc3 = t<<21 | t>>(64-21) + t = a[24] ^ d4 + bc4 = t<<14 | t>>(64-14) + a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i] + a[6] = bc1 ^ (bc3 &^ bc2) + a[12] = bc2 ^ (bc4 &^ bc3) + a[18] = bc3 ^ (bc0 &^ bc4) + a[24] = bc4 ^ (bc1 &^ bc0) + + t = a[10] ^ d0 + bc2 = t<<3 | t>>(64-3) + t = a[16] ^ d1 + bc3 = t<<45 | t>>(64-45) + t = a[22] ^ d2 + bc4 = t<<61 | t>>(64-61) + t = a[3] ^ d3 + bc0 = t<<28 | t>>(64-28) + t = a[9] ^ d4 + bc1 = t<<20 | t>>(64-20) + a[10] = bc0 ^ (bc2 &^ bc1) + a[16] = bc1 ^ (bc3 &^ bc2) + a[22] = bc2 ^ (bc4 &^ bc3) + a[3] = bc3 ^ (bc0 &^ bc4) + a[9] = bc4 ^ (bc1 &^ bc0) + + t = a[20] ^ d0 + bc4 = t<<18 | t>>(64-18) + t = a[1] ^ d1 + bc0 = t<<1 | t>>(64-1) + t = a[7] ^ d2 + bc1 = t<<6 | t>>(64-6) + t = a[13] ^ d3 + bc2 = t<<25 | t>>(64-25) + t = a[19] ^ d4 + bc3 = t<<8 | t>>(64-8) + a[20] = bc0 ^ (bc2 &^ bc1) + a[1] = bc1 ^ (bc3 &^ bc2) + a[7] = bc2 ^ (bc4 &^ bc3) + a[13] = bc3 ^ (bc0 &^ bc4) + a[19] = bc4 ^ (bc1 &^ bc0) + + t = a[5] ^ d0 + bc1 = t<<36 | t>>(64-36) + t = a[11] ^ d1 + bc2 = t<<10 | t>>(64-10) + t = a[17] ^ d2 + bc3 = t<<15 | t>>(64-15) + t = a[23] ^ d3 + bc4 = t<<56 | t>>(64-56) + t = a[4] ^ d4 + bc0 = t<<27 | t>>(64-27) + a[5] = bc0 ^ (bc2 &^ bc1) + a[11] = bc1 ^ (bc3 &^ bc2) + a[17] = bc2 ^ (bc4 &^ bc3) + a[23] = bc3 ^ (bc0 &^ bc4) + a[4] = bc4 ^ (bc1 &^ bc0) + + t = a[15] ^ d0 + bc3 = t<<41 | t>>(64-41) + t = a[21] ^ d1 + bc4 = t<<2 | t>>(64-2) + t = a[2] ^ d2 + bc0 = t<<62 | t>>(64-62) + t = a[8] ^ d3 + bc1 = t<<55 | t>>(64-55) + t = a[14] ^ d4 + bc2 = t<<39 | t>>(64-39) + a[15] = bc0 ^ (bc2 &^ bc1) + a[21] = bc1 ^ (bc3 &^ bc2) + a[2] = bc2 ^ (bc4 &^ bc3) + a[8] = bc3 ^ (bc0 &^ bc4) + a[14] = bc4 ^ (bc1 &^ bc0) + + // Round 2 + bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20] + bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21] + bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22] + bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23] + bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24] + d0 = bc4 ^ (bc1<<1 | bc1>>63) + d1 = bc0 ^ (bc2<<1 | bc2>>63) + d2 = bc1 ^ (bc3<<1 | bc3>>63) + d3 = bc2 ^ (bc4<<1 | bc4>>63) + d4 = bc3 ^ (bc0<<1 | bc0>>63) + + bc0 = a[0] ^ d0 + t = a[16] ^ d1 + bc1 = t<<44 | t>>(64-44) + t = a[7] ^ d2 + bc2 = t<<43 | t>>(64-43) + t = a[23] ^ d3 + bc3 = t<<21 | t>>(64-21) + t = a[14] ^ d4 + bc4 = t<<14 | t>>(64-14) + a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+1] + a[16] = bc1 ^ (bc3 &^ bc2) + a[7] = bc2 ^ (bc4 &^ bc3) + a[23] = bc3 ^ (bc0 &^ bc4) + a[14] = bc4 ^ (bc1 &^ bc0) + + t = a[20] ^ d0 + bc2 = t<<3 | t>>(64-3) + t = a[11] ^ d1 + bc3 = t<<45 | t>>(64-45) + t = a[2] ^ d2 + bc4 = t<<61 | t>>(64-61) + t = a[18] ^ d3 + bc0 = t<<28 | t>>(64-28) + t = a[9] ^ d4 + bc1 = t<<20 | t>>(64-20) + a[20] = bc0 ^ (bc2 &^ bc1) + a[11] = bc1 ^ (bc3 &^ bc2) + a[2] = bc2 ^ (bc4 &^ bc3) + a[18] = bc3 ^ (bc0 &^ bc4) + a[9] = bc4 ^ (bc1 &^ bc0) + + t = a[15] ^ d0 + bc4 = t<<18 | t>>(64-18) + t = a[6] ^ d1 + bc0 = t<<1 | t>>(64-1) + t = a[22] ^ d2 + bc1 = t<<6 | t>>(64-6) + t = a[13] ^ d3 + bc2 = t<<25 | t>>(64-25) + t = a[4] ^ d4 + bc3 = t<<8 | t>>(64-8) + a[15] = bc0 ^ (bc2 &^ bc1) + a[6] = bc1 ^ (bc3 &^ bc2) + a[22] = bc2 ^ (bc4 &^ bc3) + a[13] = bc3 ^ (bc0 &^ bc4) + a[4] = bc4 ^ (bc1 &^ bc0) + + t = a[10] ^ d0 + bc1 = t<<36 | t>>(64-36) + t = a[1] ^ d1 + bc2 = t<<10 | t>>(64-10) + t = a[17] ^ d2 + bc3 = t<<15 | t>>(64-15) + t = a[8] ^ d3 + bc4 = t<<56 | t>>(64-56) + t = a[24] ^ d4 + bc0 = t<<27 | t>>(64-27) + a[10] = bc0 ^ (bc2 &^ bc1) + a[1] = bc1 ^ (bc3 &^ bc2) + a[17] = bc2 ^ (bc4 &^ bc3) + a[8] = bc3 ^ (bc0 &^ bc4) + a[24] = bc4 ^ (bc1 &^ bc0) + + t = a[5] ^ d0 + bc3 = t<<41 | t>>(64-41) + t = a[21] ^ d1 + bc4 = t<<2 | t>>(64-2) + t = a[12] ^ d2 + bc0 = t<<62 | t>>(64-62) + t = a[3] ^ d3 + bc1 = t<<55 | t>>(64-55) + t = a[19] ^ d4 + bc2 = t<<39 | t>>(64-39) + a[5] = bc0 ^ (bc2 &^ bc1) + a[21] = bc1 ^ (bc3 &^ bc2) + a[12] = bc2 ^ (bc4 &^ bc3) + a[3] = bc3 ^ (bc0 &^ bc4) + a[19] = bc4 ^ (bc1 &^ bc0) + + // Round 3 + bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20] + bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21] + bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22] + bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23] + bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24] + d0 = bc4 ^ (bc1<<1 | bc1>>63) + d1 = bc0 ^ (bc2<<1 | bc2>>63) + d2 = bc1 ^ (bc3<<1 | bc3>>63) + d3 = bc2 ^ (bc4<<1 | bc4>>63) + d4 = bc3 ^ (bc0<<1 | bc0>>63) + + bc0 = a[0] ^ d0 + t = a[11] ^ d1 + bc1 = t<<44 | t>>(64-44) + t = a[22] ^ d2 + bc2 = t<<43 | t>>(64-43) + t = a[8] ^ d3 + bc3 = t<<21 | t>>(64-21) + t = a[19] ^ d4 + bc4 = t<<14 | t>>(64-14) + a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+2] + a[11] = bc1 ^ (bc3 &^ bc2) + a[22] = bc2 ^ (bc4 &^ bc3) + a[8] = bc3 ^ (bc0 &^ bc4) + a[19] = bc4 ^ (bc1 &^ bc0) + + t = a[15] ^ d0 + bc2 = t<<3 | t>>(64-3) + t = a[1] ^ d1 + bc3 = t<<45 | t>>(64-45) + t = a[12] ^ d2 + bc4 = t<<61 | t>>(64-61) + t = a[23] ^ d3 + bc0 = t<<28 | t>>(64-28) + t = a[9] ^ d4 + bc1 = t<<20 | t>>(64-20) + a[15] = bc0 ^ (bc2 &^ bc1) + a[1] = bc1 ^ (bc3 &^ bc2) + a[12] = bc2 ^ (bc4 &^ bc3) + a[23] = bc3 ^ (bc0 &^ bc4) + a[9] = bc4 ^ (bc1 &^ bc0) + + t = a[5] ^ d0 + bc4 = t<<18 | t>>(64-18) + t = a[16] ^ d1 + bc0 = t<<1 | t>>(64-1) + t = a[2] ^ d2 + bc1 = t<<6 | t>>(64-6) + t = a[13] ^ d3 + bc2 = t<<25 | t>>(64-25) + t = a[24] ^ d4 + bc3 = t<<8 | t>>(64-8) + a[5] = bc0 ^ (bc2 &^ bc1) + a[16] = bc1 ^ (bc3 &^ bc2) + a[2] = bc2 ^ (bc4 &^ bc3) + a[13] = bc3 ^ (bc0 &^ bc4) + a[24] = bc4 ^ (bc1 &^ bc0) + + t = a[20] ^ d0 + bc1 = t<<36 | t>>(64-36) + t = a[6] ^ d1 + bc2 = t<<10 | t>>(64-10) + t = a[17] ^ d2 + bc3 = t<<15 | t>>(64-15) + t = a[3] ^ d3 + bc4 = t<<56 | t>>(64-56) + t = a[14] ^ d4 + bc0 = t<<27 | t>>(64-27) + a[20] = bc0 ^ (bc2 &^ bc1) + a[6] = bc1 ^ (bc3 &^ bc2) + a[17] = bc2 ^ (bc4 &^ bc3) + a[3] = bc3 ^ (bc0 &^ bc4) + a[14] = bc4 ^ (bc1 &^ bc0) + + t = a[10] ^ d0 + bc3 = t<<41 | t>>(64-41) + t = a[21] ^ d1 + bc4 = t<<2 | t>>(64-2) + t = a[7] ^ d2 + bc0 = t<<62 | t>>(64-62) + t = a[18] ^ d3 + bc1 = t<<55 | t>>(64-55) + t = a[4] ^ d4 + bc2 = t<<39 | t>>(64-39) + a[10] = bc0 ^ (bc2 &^ bc1) + a[21] = bc1 ^ (bc3 &^ bc2) + a[7] = bc2 ^ (bc4 &^ bc3) + a[18] = bc3 ^ (bc0 &^ bc4) + a[4] = bc4 ^ (bc1 &^ bc0) + + // Round 4 + bc0 = a[0] ^ a[5] ^ a[10] ^ a[15] ^ a[20] + bc1 = a[1] ^ a[6] ^ a[11] ^ a[16] ^ a[21] + bc2 = a[2] ^ a[7] ^ a[12] ^ a[17] ^ a[22] + bc3 = a[3] ^ a[8] ^ a[13] ^ a[18] ^ a[23] + bc4 = a[4] ^ a[9] ^ a[14] ^ a[19] ^ a[24] + d0 = bc4 ^ (bc1<<1 | bc1>>63) + d1 = bc0 ^ (bc2<<1 | bc2>>63) + d2 = bc1 ^ (bc3<<1 | bc3>>63) + d3 = bc2 ^ (bc4<<1 | bc4>>63) + d4 = bc3 ^ (bc0<<1 | bc0>>63) + + bc0 = a[0] ^ d0 + t = a[1] ^ d1 + bc1 = t<<44 | t>>(64-44) + t = a[2] ^ d2 + bc2 = t<<43 | t>>(64-43) + t = a[3] ^ d3 + bc3 = t<<21 | t>>(64-21) + t = a[4] ^ d4 + bc4 = t<<14 | t>>(64-14) + a[0] = bc0 ^ (bc2 &^ bc1) ^ rc[i+3] + a[1] = bc1 ^ (bc3 &^ bc2) + a[2] = bc2 ^ (bc4 &^ bc3) + a[3] = bc3 ^ (bc0 &^ bc4) + a[4] = bc4 ^ (bc1 &^ bc0) + + t = a[5] ^ d0 + bc2 = t<<3 | t>>(64-3) + t = a[6] ^ d1 + bc3 = t<<45 | t>>(64-45) + t = a[7] ^ d2 + bc4 = t<<61 | t>>(64-61) + t = a[8] ^ d3 + bc0 = t<<28 | t>>(64-28) + t = a[9] ^ d4 + bc1 = t<<20 | t>>(64-20) + a[5] = bc0 ^ (bc2 &^ bc1) + a[6] = bc1 ^ (bc3 &^ bc2) + a[7] = bc2 ^ (bc4 &^ bc3) + a[8] = bc3 ^ (bc0 &^ bc4) + a[9] = bc4 ^ (bc1 &^ bc0) + + t = a[10] ^ d0 + bc4 = t<<18 | t>>(64-18) + t = a[11] ^ d1 + bc0 = t<<1 | t>>(64-1) + t = a[12] ^ d2 + bc1 = t<<6 | t>>(64-6) + t = a[13] ^ d3 + bc2 = t<<25 | t>>(64-25) + t = a[14] ^ d4 + bc3 = t<<8 | t>>(64-8) + a[10] = bc0 ^ (bc2 &^ bc1) + a[11] = bc1 ^ (bc3 &^ bc2) + a[12] = bc2 ^ (bc4 &^ bc3) + a[13] = bc3 ^ (bc0 &^ bc4) + a[14] = bc4 ^ (bc1 &^ bc0) + + t = a[15] ^ d0 + bc1 = t<<36 | t>>(64-36) + t = a[16] ^ d1 + bc2 = t<<10 | t>>(64-10) + t = a[17] ^ d2 + bc3 = t<<15 | t>>(64-15) + t = a[18] ^ d3 + bc4 = t<<56 | t>>(64-56) + t = a[19] ^ d4 + bc0 = t<<27 | t>>(64-27) + a[15] = bc0 ^ (bc2 &^ bc1) + a[16] = bc1 ^ (bc3 &^ bc2) + a[17] = bc2 ^ (bc4 &^ bc3) + a[18] = bc3 ^ (bc0 &^ bc4) + a[19] = bc4 ^ (bc1 &^ bc0) + + t = a[20] ^ d0 + bc3 = t<<41 | t>>(64-41) + t = a[21] ^ d1 + bc4 = t<<2 | t>>(64-2) + t = a[22] ^ d2 + bc0 = t<<62 | t>>(64-62) + t = a[23] ^ d3 + bc1 = t<<55 | t>>(64-55) + t = a[24] ^ d4 + bc2 = t<<39 | t>>(64-39) + a[20] = bc0 ^ (bc2 &^ bc1) + a[21] = bc1 ^ (bc3 &^ bc2) + a[22] = bc2 ^ (bc4 &^ bc3) + a[23] = bc3 ^ (bc0 &^ bc4) + a[24] = bc4 ^ (bc1 &^ bc0) + } +} diff --git a/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go b/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go new file mode 100644 index 0000000..7886795 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go @@ -0,0 +1,13 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build amd64,!appengine,!gccgo + +package sha3 + +// This function is implemented in keccakf_amd64.s. + +//go:noescape + +func keccakF1600(a *[25]uint64) diff --git a/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s b/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s new file mode 100644 index 0000000..f88533a --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s @@ -0,0 +1,390 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build amd64,!appengine,!gccgo + +// This code was translated into a form compatible with 6a from the public +// domain sources at https://github.com/gvanas/KeccakCodePackage + +// Offsets in state +#define _ba (0*8) +#define _be (1*8) +#define _bi (2*8) +#define _bo (3*8) +#define _bu (4*8) +#define _ga (5*8) +#define _ge (6*8) +#define _gi (7*8) +#define _go (8*8) +#define _gu (9*8) +#define _ka (10*8) +#define _ke (11*8) +#define _ki (12*8) +#define _ko (13*8) +#define _ku (14*8) +#define _ma (15*8) +#define _me (16*8) +#define _mi (17*8) +#define _mo (18*8) +#define _mu (19*8) +#define _sa (20*8) +#define _se (21*8) +#define _si (22*8) +#define _so (23*8) +#define _su (24*8) + +// Temporary registers +#define rT1 AX + +// Round vars +#define rpState DI +#define rpStack SP + +#define rDa BX +#define rDe CX +#define rDi DX +#define rDo R8 +#define rDu R9 + +#define rBa R10 +#define rBe R11 +#define rBi R12 +#define rBo R13 +#define rBu R14 + +#define rCa SI +#define rCe BP +#define rCi rBi +#define rCo rBo +#define rCu R15 + +#define MOVQ_RBI_RCE MOVQ rBi, rCe +#define XORQ_RT1_RCA XORQ rT1, rCa +#define XORQ_RT1_RCE XORQ rT1, rCe +#define XORQ_RBA_RCU XORQ rBa, rCu +#define XORQ_RBE_RCU XORQ rBe, rCu +#define XORQ_RDU_RCU XORQ rDu, rCu +#define XORQ_RDA_RCA XORQ rDa, rCa +#define XORQ_RDE_RCE XORQ rDe, rCe + +#define mKeccakRound(iState, oState, rc, B_RBI_RCE, G_RT1_RCA, G_RT1_RCE, G_RBA_RCU, K_RT1_RCA, K_RT1_RCE, K_RBA_RCU, M_RT1_RCA, M_RT1_RCE, M_RBE_RCU, S_RDU_RCU, S_RDA_RCA, S_RDE_RCE) \ + /* Prepare round */ \ + MOVQ rCe, rDa; \ + ROLQ $1, rDa; \ + \ + MOVQ _bi(iState), rCi; \ + XORQ _gi(iState), rDi; \ + XORQ rCu, rDa; \ + XORQ _ki(iState), rCi; \ + XORQ _mi(iState), rDi; \ + XORQ rDi, rCi; \ + \ + MOVQ rCi, rDe; \ + ROLQ $1, rDe; \ + \ + MOVQ _bo(iState), rCo; \ + XORQ _go(iState), rDo; \ + XORQ rCa, rDe; \ + XORQ _ko(iState), rCo; \ + XORQ _mo(iState), rDo; \ + XORQ rDo, rCo; \ + \ + MOVQ rCo, rDi; \ + ROLQ $1, rDi; \ + \ + MOVQ rCu, rDo; \ + XORQ rCe, rDi; \ + ROLQ $1, rDo; \ + \ + MOVQ rCa, rDu; \ + XORQ rCi, rDo; \ + ROLQ $1, rDu; \ + \ + /* Result b */ \ + MOVQ _ba(iState), rBa; \ + MOVQ _ge(iState), rBe; \ + XORQ rCo, rDu; \ + MOVQ _ki(iState), rBi; \ + MOVQ _mo(iState), rBo; \ + MOVQ _su(iState), rBu; \ + XORQ rDe, rBe; \ + ROLQ $44, rBe; \ + XORQ rDi, rBi; \ + XORQ rDa, rBa; \ + ROLQ $43, rBi; \ + \ + MOVQ rBe, rCa; \ + MOVQ rc, rT1; \ + ORQ rBi, rCa; \ + XORQ rBa, rT1; \ + XORQ rT1, rCa; \ + MOVQ rCa, _ba(oState); \ + \ + XORQ rDu, rBu; \ + ROLQ $14, rBu; \ + MOVQ rBa, rCu; \ + ANDQ rBe, rCu; \ + XORQ rBu, rCu; \ + MOVQ rCu, _bu(oState); \ + \ + XORQ rDo, rBo; \ + ROLQ $21, rBo; \ + MOVQ rBo, rT1; \ + ANDQ rBu, rT1; \ + XORQ rBi, rT1; \ + MOVQ rT1, _bi(oState); \ + \ + NOTQ rBi; \ + ORQ rBa, rBu; \ + ORQ rBo, rBi; \ + XORQ rBo, rBu; \ + XORQ rBe, rBi; \ + MOVQ rBu, _bo(oState); \ + MOVQ rBi, _be(oState); \ + B_RBI_RCE; \ + \ + /* Result g */ \ + MOVQ _gu(iState), rBe; \ + XORQ rDu, rBe; \ + MOVQ _ka(iState), rBi; \ + ROLQ $20, rBe; \ + XORQ rDa, rBi; \ + ROLQ $3, rBi; \ + MOVQ _bo(iState), rBa; \ + MOVQ rBe, rT1; \ + ORQ rBi, rT1; \ + XORQ rDo, rBa; \ + MOVQ _me(iState), rBo; \ + MOVQ _si(iState), rBu; \ + ROLQ $28, rBa; \ + XORQ rBa, rT1; \ + MOVQ rT1, _ga(oState); \ + G_RT1_RCA; \ + \ + XORQ rDe, rBo; \ + ROLQ $45, rBo; \ + MOVQ rBi, rT1; \ + ANDQ rBo, rT1; \ + XORQ rBe, rT1; \ + MOVQ rT1, _ge(oState); \ + G_RT1_RCE; \ + \ + XORQ rDi, rBu; \ + ROLQ $61, rBu; \ + MOVQ rBu, rT1; \ + ORQ rBa, rT1; \ + XORQ rBo, rT1; \ + MOVQ rT1, _go(oState); \ + \ + ANDQ rBe, rBa; \ + XORQ rBu, rBa; \ + MOVQ rBa, _gu(oState); \ + NOTQ rBu; \ + G_RBA_RCU; \ + \ + ORQ rBu, rBo; \ + XORQ rBi, rBo; \ + MOVQ rBo, _gi(oState); \ + \ + /* Result k */ \ + MOVQ _be(iState), rBa; \ + MOVQ _gi(iState), rBe; \ + MOVQ _ko(iState), rBi; \ + MOVQ _mu(iState), rBo; \ + MOVQ _sa(iState), rBu; \ + XORQ rDi, rBe; \ + ROLQ $6, rBe; \ + XORQ rDo, rBi; \ + ROLQ $25, rBi; \ + MOVQ rBe, rT1; \ + ORQ rBi, rT1; \ + XORQ rDe, rBa; \ + ROLQ $1, rBa; \ + XORQ rBa, rT1; \ + MOVQ rT1, _ka(oState); \ + K_RT1_RCA; \ + \ + XORQ rDu, rBo; \ + ROLQ $8, rBo; \ + MOVQ rBi, rT1; \ + ANDQ rBo, rT1; \ + XORQ rBe, rT1; \ + MOVQ rT1, _ke(oState); \ + K_RT1_RCE; \ + \ + XORQ rDa, rBu; \ + ROLQ $18, rBu; \ + NOTQ rBo; \ + MOVQ rBo, rT1; \ + ANDQ rBu, rT1; \ + XORQ rBi, rT1; \ + MOVQ rT1, _ki(oState); \ + \ + MOVQ rBu, rT1; \ + ORQ rBa, rT1; \ + XORQ rBo, rT1; \ + MOVQ rT1, _ko(oState); \ + \ + ANDQ rBe, rBa; \ + XORQ rBu, rBa; \ + MOVQ rBa, _ku(oState); \ + K_RBA_RCU; \ + \ + /* Result m */ \ + MOVQ _ga(iState), rBe; \ + XORQ rDa, rBe; \ + MOVQ _ke(iState), rBi; \ + ROLQ $36, rBe; \ + XORQ rDe, rBi; \ + MOVQ _bu(iState), rBa; \ + ROLQ $10, rBi; \ + MOVQ rBe, rT1; \ + MOVQ _mi(iState), rBo; \ + ANDQ rBi, rT1; \ + XORQ rDu, rBa; \ + MOVQ _so(iState), rBu; \ + ROLQ $27, rBa; \ + XORQ rBa, rT1; \ + MOVQ rT1, _ma(oState); \ + M_RT1_RCA; \ + \ + XORQ rDi, rBo; \ + ROLQ $15, rBo; \ + MOVQ rBi, rT1; \ + ORQ rBo, rT1; \ + XORQ rBe, rT1; \ + MOVQ rT1, _me(oState); \ + M_RT1_RCE; \ + \ + XORQ rDo, rBu; \ + ROLQ $56, rBu; \ + NOTQ rBo; \ + MOVQ rBo, rT1; \ + ORQ rBu, rT1; \ + XORQ rBi, rT1; \ + MOVQ rT1, _mi(oState); \ + \ + ORQ rBa, rBe; \ + XORQ rBu, rBe; \ + MOVQ rBe, _mu(oState); \ + \ + ANDQ rBa, rBu; \ + XORQ rBo, rBu; \ + MOVQ rBu, _mo(oState); \ + M_RBE_RCU; \ + \ + /* Result s */ \ + MOVQ _bi(iState), rBa; \ + MOVQ _go(iState), rBe; \ + MOVQ _ku(iState), rBi; \ + XORQ rDi, rBa; \ + MOVQ _ma(iState), rBo; \ + ROLQ $62, rBa; \ + XORQ rDo, rBe; \ + MOVQ _se(iState), rBu; \ + ROLQ $55, rBe; \ + \ + XORQ rDu, rBi; \ + MOVQ rBa, rDu; \ + XORQ rDe, rBu; \ + ROLQ $2, rBu; \ + ANDQ rBe, rDu; \ + XORQ rBu, rDu; \ + MOVQ rDu, _su(oState); \ + \ + ROLQ $39, rBi; \ + S_RDU_RCU; \ + NOTQ rBe; \ + XORQ rDa, rBo; \ + MOVQ rBe, rDa; \ + ANDQ rBi, rDa; \ + XORQ rBa, rDa; \ + MOVQ rDa, _sa(oState); \ + S_RDA_RCA; \ + \ + ROLQ $41, rBo; \ + MOVQ rBi, rDe; \ + ORQ rBo, rDe; \ + XORQ rBe, rDe; \ + MOVQ rDe, _se(oState); \ + S_RDE_RCE; \ + \ + MOVQ rBo, rDi; \ + MOVQ rBu, rDo; \ + ANDQ rBu, rDi; \ + ORQ rBa, rDo; \ + XORQ rBi, rDi; \ + XORQ rBo, rDo; \ + MOVQ rDi, _si(oState); \ + MOVQ rDo, _so(oState) \ + +// func keccakF1600(state *[25]uint64) +TEXT ·keccakF1600(SB), 0, $200-8 + MOVQ state+0(FP), rpState + + // Convert the user state into an internal state + NOTQ _be(rpState) + NOTQ _bi(rpState) + NOTQ _go(rpState) + NOTQ _ki(rpState) + NOTQ _mi(rpState) + NOTQ _sa(rpState) + + // Execute the KeccakF permutation + MOVQ _ba(rpState), rCa + MOVQ _be(rpState), rCe + MOVQ _bu(rpState), rCu + + XORQ _ga(rpState), rCa + XORQ _ge(rpState), rCe + XORQ _gu(rpState), rCu + + XORQ _ka(rpState), rCa + XORQ _ke(rpState), rCe + XORQ _ku(rpState), rCu + + XORQ _ma(rpState), rCa + XORQ _me(rpState), rCe + XORQ _mu(rpState), rCu + + XORQ _sa(rpState), rCa + XORQ _se(rpState), rCe + MOVQ _si(rpState), rDi + MOVQ _so(rpState), rDo + XORQ _su(rpState), rCu + + mKeccakRound(rpState, rpStack, $0x0000000000000001, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x0000000000008082, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x800000000000808a, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x8000000080008000, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x000000000000808b, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x0000000080000001, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x8000000080008081, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x8000000000008009, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x000000000000008a, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x0000000000000088, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x0000000080008009, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x000000008000000a, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x000000008000808b, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x800000000000008b, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x8000000000008089, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x8000000000008003, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x8000000000008002, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x8000000000000080, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x000000000000800a, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x800000008000000a, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x8000000080008081, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x8000000000008080, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpState, rpStack, $0x0000000080000001, MOVQ_RBI_RCE, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBA_RCU, XORQ_RT1_RCA, XORQ_RT1_RCE, XORQ_RBE_RCU, XORQ_RDU_RCU, XORQ_RDA_RCA, XORQ_RDE_RCE) + mKeccakRound(rpStack, rpState, $0x8000000080008008, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP) + + // Revert the internal state to the user state + NOTQ _be(rpState) + NOTQ _bi(rpState) + NOTQ _go(rpState) + NOTQ _ki(rpState) + NOTQ _mi(rpState) + NOTQ _sa(rpState) + + RET diff --git a/vendor/golang.org/x/crypto/sha3/register.go b/vendor/golang.org/x/crypto/sha3/register.go new file mode 100644 index 0000000..3cf6a22 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/register.go @@ -0,0 +1,18 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build go1.4 + +package sha3 + +import ( + "crypto" +) + +func init() { + crypto.RegisterHash(crypto.SHA3_224, New224) + crypto.RegisterHash(crypto.SHA3_256, New256) + crypto.RegisterHash(crypto.SHA3_384, New384) + crypto.RegisterHash(crypto.SHA3_512, New512) +} diff --git a/vendor/golang.org/x/crypto/sha3/sha3.go b/vendor/golang.org/x/crypto/sha3/sha3.go new file mode 100644 index 0000000..ba269a0 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/sha3.go @@ -0,0 +1,193 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha3 + +// spongeDirection indicates the direction bytes are flowing through the sponge. +type spongeDirection int + +const ( + // spongeAbsorbing indicates that the sponge is absorbing input. + spongeAbsorbing spongeDirection = iota + // spongeSqueezing indicates that the sponge is being squeezed. + spongeSqueezing +) + +const ( + // maxRate is the maximum size of the internal buffer. SHAKE-256 + // currently needs the largest buffer. + maxRate = 168 +) + +type state struct { + // Generic sponge components. + a [25]uint64 // main state of the hash + buf []byte // points into storage + rate int // the number of bytes of state to use + + // dsbyte contains the "domain separation" bits and the first bit of + // the padding. Sections 6.1 and 6.2 of [1] separate the outputs of the + // SHA-3 and SHAKE functions by appending bitstrings to the message. + // Using a little-endian bit-ordering convention, these are "01" for SHA-3 + // and "1111" for SHAKE, or 00000010b and 00001111b, respectively. Then the + // padding rule from section 5.1 is applied to pad the message to a multiple + // of the rate, which involves adding a "1" bit, zero or more "0" bits, and + // a final "1" bit. We merge the first "1" bit from the padding into dsbyte, + // giving 00000110b (0x06) and 00011111b (0x1f). + // [1] http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf + // "Draft FIPS 202: SHA-3 Standard: Permutation-Based Hash and + // Extendable-Output Functions (May 2014)" + dsbyte byte + + storage storageBuf + + // Specific to SHA-3 and SHAKE. + outputLen int // the default output size in bytes + state spongeDirection // whether the sponge is absorbing or squeezing +} + +// BlockSize returns the rate of sponge underlying this hash function. +func (d *state) BlockSize() int { return d.rate } + +// Size returns the output size of the hash function in bytes. +func (d *state) Size() int { return d.outputLen } + +// Reset clears the internal state by zeroing the sponge state and +// the byte buffer, and setting Sponge.state to absorbing. +func (d *state) Reset() { + // Zero the permutation's state. + for i := range d.a { + d.a[i] = 0 + } + d.state = spongeAbsorbing + d.buf = d.storage.asBytes()[:0] +} + +func (d *state) clone() *state { + ret := *d + if ret.state == spongeAbsorbing { + ret.buf = ret.storage.asBytes()[:len(ret.buf)] + } else { + ret.buf = ret.storage.asBytes()[d.rate-cap(d.buf) : d.rate] + } + + return &ret +} + +// permute applies the KeccakF-1600 permutation. It handles +// any input-output buffering. +func (d *state) permute() { + switch d.state { + case spongeAbsorbing: + // If we're absorbing, we need to xor the input into the state + // before applying the permutation. + xorIn(d, d.buf) + d.buf = d.storage.asBytes()[:0] + keccakF1600(&d.a) + case spongeSqueezing: + // If we're squeezing, we need to apply the permutatin before + // copying more output. + keccakF1600(&d.a) + d.buf = d.storage.asBytes()[:d.rate] + copyOut(d, d.buf) + } +} + +// pads appends the domain separation bits in dsbyte, applies +// the multi-bitrate 10..1 padding rule, and permutes the state. +func (d *state) padAndPermute(dsbyte byte) { + if d.buf == nil { + d.buf = d.storage.asBytes()[:0] + } + // Pad with this instance's domain-separator bits. We know that there's + // at least one byte of space in d.buf because, if it were full, + // permute would have been called to empty it. dsbyte also contains the + // first one bit for the padding. See the comment in the state struct. + d.buf = append(d.buf, dsbyte) + zerosStart := len(d.buf) + d.buf = d.storage.asBytes()[:d.rate] + for i := zerosStart; i < d.rate; i++ { + d.buf[i] = 0 + } + // This adds the final one bit for the padding. Because of the way that + // bits are numbered from the LSB upwards, the final bit is the MSB of + // the last byte. + d.buf[d.rate-1] ^= 0x80 + // Apply the permutation + d.permute() + d.state = spongeSqueezing + d.buf = d.storage.asBytes()[:d.rate] + copyOut(d, d.buf) +} + +// Write absorbs more data into the hash's state. It produces an error +// if more data is written to the ShakeHash after writing +func (d *state) Write(p []byte) (written int, err error) { + if d.state != spongeAbsorbing { + panic("sha3: write to sponge after read") + } + if d.buf == nil { + d.buf = d.storage.asBytes()[:0] + } + written = len(p) + + for len(p) > 0 { + if len(d.buf) == 0 && len(p) >= d.rate { + // The fast path; absorb a full "rate" bytes of input and apply the permutation. + xorIn(d, p[:d.rate]) + p = p[d.rate:] + keccakF1600(&d.a) + } else { + // The slow path; buffer the input until we can fill the sponge, and then xor it in. + todo := d.rate - len(d.buf) + if todo > len(p) { + todo = len(p) + } + d.buf = append(d.buf, p[:todo]...) + p = p[todo:] + + // If the sponge is full, apply the permutation. + if len(d.buf) == d.rate { + d.permute() + } + } + } + + return +} + +// Read squeezes an arbitrary number of bytes from the sponge. +func (d *state) Read(out []byte) (n int, err error) { + // If we're still absorbing, pad and apply the permutation. + if d.state == spongeAbsorbing { + d.padAndPermute(d.dsbyte) + } + + n = len(out) + + // Now, do the squeezing. + for len(out) > 0 { + n := copy(out, d.buf) + d.buf = d.buf[n:] + out = out[n:] + + // Apply the permutation if we've squeezed the sponge dry. + if len(d.buf) == 0 { + d.permute() + } + } + + return +} + +// Sum applies padding to the hash state and then squeezes out the desired +// number of output bytes. +func (d *state) Sum(in []byte) []byte { + // Make a copy of the original hash so that caller can keep writing + // and summing. + dup := d.clone() + hash := make([]byte, dup.outputLen) + dup.Read(hash) + return append(in, hash...) +} diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go new file mode 100644 index 0000000..259ff4d --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go @@ -0,0 +1,284 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo,!appengine + +package sha3 + +// This file contains code for using the 'compute intermediate +// message digest' (KIMD) and 'compute last message digest' (KLMD) +// instructions to compute SHA-3 and SHAKE hashes on IBM Z. + +import ( + "hash" + + "golang.org/x/sys/cpu" +) + +// codes represent 7-bit KIMD/KLMD function codes as defined in +// the Principles of Operation. +type code uint64 + +const ( + // function codes for KIMD/KLMD + sha3_224 code = 32 + sha3_256 = 33 + sha3_384 = 34 + sha3_512 = 35 + shake_128 = 36 + shake_256 = 37 + nopad = 0x100 +) + +// kimd is a wrapper for the 'compute intermediate message digest' instruction. +// src must be a multiple of the rate for the given function code. +//go:noescape +func kimd(function code, chain *[200]byte, src []byte) + +// klmd is a wrapper for the 'compute last message digest' instruction. +// src padding is handled by the instruction. +//go:noescape +func klmd(function code, chain *[200]byte, dst, src []byte) + +type asmState struct { + a [200]byte // 1600 bit state + buf []byte // care must be taken to ensure cap(buf) is a multiple of rate + rate int // equivalent to block size + storage [3072]byte // underlying storage for buf + outputLen int // output length if fixed, 0 if not + function code // KIMD/KLMD function code + state spongeDirection // whether the sponge is absorbing or squeezing +} + +func newAsmState(function code) *asmState { + var s asmState + s.function = function + switch function { + case sha3_224: + s.rate = 144 + s.outputLen = 28 + case sha3_256: + s.rate = 136 + s.outputLen = 32 + case sha3_384: + s.rate = 104 + s.outputLen = 48 + case sha3_512: + s.rate = 72 + s.outputLen = 64 + case shake_128: + s.rate = 168 + case shake_256: + s.rate = 136 + default: + panic("sha3: unrecognized function code") + } + + // limit s.buf size to a multiple of s.rate + s.resetBuf() + return &s +} + +func (s *asmState) clone() *asmState { + c := *s + c.buf = c.storage[:len(s.buf):cap(s.buf)] + return &c +} + +// copyIntoBuf copies b into buf. It will panic if there is not enough space to +// store all of b. +func (s *asmState) copyIntoBuf(b []byte) { + bufLen := len(s.buf) + s.buf = s.buf[:len(s.buf)+len(b)] + copy(s.buf[bufLen:], b) +} + +// resetBuf points buf at storage, sets the length to 0 and sets cap to be a +// multiple of the rate. +func (s *asmState) resetBuf() { + max := (cap(s.storage) / s.rate) * s.rate + s.buf = s.storage[:0:max] +} + +// Write (via the embedded io.Writer interface) adds more data to the running hash. +// It never returns an error. +func (s *asmState) Write(b []byte) (int, error) { + if s.state != spongeAbsorbing { + panic("sha3: write to sponge after read") + } + length := len(b) + for len(b) > 0 { + if len(s.buf) == 0 && len(b) >= cap(s.buf) { + // Hash the data directly and push any remaining bytes + // into the buffer. + remainder := len(b) % s.rate + kimd(s.function, &s.a, b[:len(b)-remainder]) + if remainder != 0 { + s.copyIntoBuf(b[len(b)-remainder:]) + } + return length, nil + } + + if len(s.buf) == cap(s.buf) { + // flush the buffer + kimd(s.function, &s.a, s.buf) + s.buf = s.buf[:0] + } + + // copy as much as we can into the buffer + n := len(b) + if len(b) > cap(s.buf)-len(s.buf) { + n = cap(s.buf) - len(s.buf) + } + s.copyIntoBuf(b[:n]) + b = b[n:] + } + return length, nil +} + +// Read squeezes an arbitrary number of bytes from the sponge. +func (s *asmState) Read(out []byte) (n int, err error) { + n = len(out) + + // need to pad if we were absorbing + if s.state == spongeAbsorbing { + s.state = spongeSqueezing + + // write hash directly into out if possible + if len(out)%s.rate == 0 { + klmd(s.function, &s.a, out, s.buf) // len(out) may be 0 + s.buf = s.buf[:0] + return + } + + // write hash into buffer + max := cap(s.buf) + if max > len(out) { + max = (len(out)/s.rate)*s.rate + s.rate + } + klmd(s.function, &s.a, s.buf[:max], s.buf) + s.buf = s.buf[:max] + } + + for len(out) > 0 { + // flush the buffer + if len(s.buf) != 0 { + c := copy(out, s.buf) + out = out[c:] + s.buf = s.buf[c:] + continue + } + + // write hash directly into out if possible + if len(out)%s.rate == 0 { + klmd(s.function|nopad, &s.a, out, nil) + return + } + + // write hash into buffer + s.resetBuf() + if cap(s.buf) > len(out) { + s.buf = s.buf[:(len(out)/s.rate)*s.rate+s.rate] + } + klmd(s.function|nopad, &s.a, s.buf, nil) + } + return +} + +// Sum appends the current hash to b and returns the resulting slice. +// It does not change the underlying hash state. +func (s *asmState) Sum(b []byte) []byte { + if s.outputLen == 0 { + panic("sha3: cannot call Sum on SHAKE functions") + } + + // Copy the state to preserve the original. + a := s.a + + // Hash the buffer. Note that we don't clear it because we + // aren't updating the state. + klmd(s.function, &a, nil, s.buf) + return append(b, a[:s.outputLen]...) +} + +// Reset resets the Hash to its initial state. +func (s *asmState) Reset() { + for i := range s.a { + s.a[i] = 0 + } + s.resetBuf() + s.state = spongeAbsorbing +} + +// Size returns the number of bytes Sum will return. +func (s *asmState) Size() int { + return s.outputLen +} + +// BlockSize returns the hash's underlying block size. +// The Write method must be able to accept any amount +// of data, but it may operate more efficiently if all writes +// are a multiple of the block size. +func (s *asmState) BlockSize() int { + return s.rate +} + +// Clone returns a copy of the ShakeHash in its current state. +func (s *asmState) Clone() ShakeHash { + return s.clone() +} + +// new224Asm returns an assembly implementation of SHA3-224 if available, +// otherwise it returns nil. +func new224Asm() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_224) + } + return nil +} + +// new256Asm returns an assembly implementation of SHA3-256 if available, +// otherwise it returns nil. +func new256Asm() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_256) + } + return nil +} + +// new384Asm returns an assembly implementation of SHA3-384 if available, +// otherwise it returns nil. +func new384Asm() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_384) + } + return nil +} + +// new512Asm returns an assembly implementation of SHA3-512 if available, +// otherwise it returns nil. +func new512Asm() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_512) + } + return nil +} + +// newShake128Asm returns an assembly implementation of SHAKE-128 if available, +// otherwise it returns nil. +func newShake128Asm() ShakeHash { + if cpu.S390X.HasSHA3 { + return newAsmState(shake_128) + } + return nil +} + +// newShake256Asm returns an assembly implementation of SHAKE-256 if available, +// otherwise it returns nil. +func newShake256Asm() ShakeHash { + if cpu.S390X.HasSHA3 { + return newAsmState(shake_256) + } + return nil +} diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.s b/vendor/golang.org/x/crypto/sha3/sha3_s390x.s new file mode 100644 index 0000000..8a4458f --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/sha3_s390x.s @@ -0,0 +1,33 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo,!appengine + +#include "textflag.h" + +// func kimd(function code, chain *[200]byte, src []byte) +TEXT ·kimd(SB), NOFRAME|NOSPLIT, $0-40 + MOVD function+0(FP), R0 + MOVD chain+8(FP), R1 + LMG src+16(FP), R2, R3 // R2=base, R3=len + +continue: + WORD $0xB93E0002 // KIMD --, R2 + BVS continue // continue if interrupted + MOVD $0, R0 // reset R0 for pre-go1.8 compilers + RET + +// func klmd(function code, chain *[200]byte, dst, src []byte) +TEXT ·klmd(SB), NOFRAME|NOSPLIT, $0-64 + // TODO: SHAKE support + MOVD function+0(FP), R0 + MOVD chain+8(FP), R1 + LMG dst+16(FP), R2, R3 // R2=base, R3=len + LMG src+40(FP), R4, R5 // R4=base, R5=len + +continue: + WORD $0xB93F0024 // KLMD R2, R4 + BVS continue // continue if interrupted + MOVD $0, R0 // reset R0 for pre-go1.8 compilers + RET diff --git a/vendor/golang.org/x/crypto/sha3/shake.go b/vendor/golang.org/x/crypto/sha3/shake.go new file mode 100644 index 0000000..d7be295 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/shake.go @@ -0,0 +1,173 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha3 + +// This file defines the ShakeHash interface, and provides +// functions for creating SHAKE and cSHAKE instances, as well as utility +// functions for hashing bytes to arbitrary-length output. +// +// +// SHAKE implementation is based on FIPS PUB 202 [1] +// cSHAKE implementations is based on NIST SP 800-185 [2] +// +// [1] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf +// [2] https://doi.org/10.6028/NIST.SP.800-185 + +import ( + "encoding/binary" + "io" +) + +// ShakeHash defines the interface to hash functions that +// support arbitrary-length output. +type ShakeHash interface { + // Write absorbs more data into the hash's state. It panics if input is + // written to it after output has been read from it. + io.Writer + + // Read reads more output from the hash; reading affects the hash's + // state. (ShakeHash.Read is thus very different from Hash.Sum) + // It never returns an error. + io.Reader + + // Clone returns a copy of the ShakeHash in its current state. + Clone() ShakeHash + + // Reset resets the ShakeHash to its initial state. + Reset() +} + +// cSHAKE specific context +type cshakeState struct { + *state // SHA-3 state context and Read/Write operations + + // initBlock is the cSHAKE specific initialization set of bytes. It is initialized + // by newCShake function and stores concatenation of N followed by S, encoded + // by the method specified in 3.3 of [1]. + // It is stored here in order for Reset() to be able to put context into + // initial state. + initBlock []byte +} + +// Consts for configuring initial SHA-3 state +const ( + dsbyteShake = 0x1f + dsbyteCShake = 0x04 + rate128 = 168 + rate256 = 136 +) + +func bytepad(input []byte, w int) []byte { + // leftEncode always returns max 9 bytes + buf := make([]byte, 0, 9+len(input)+w) + buf = append(buf, leftEncode(uint64(w))...) + buf = append(buf, input...) + padlen := w - (len(buf) % w) + return append(buf, make([]byte, padlen)...) +} + +func leftEncode(value uint64) []byte { + var b [9]byte + binary.BigEndian.PutUint64(b[1:], value) + // Trim all but last leading zero bytes + i := byte(1) + for i < 8 && b[i] == 0 { + i++ + } + // Prepend number of encoded bytes + b[i-1] = 9 - i + return b[i-1:] +} + +func newCShake(N, S []byte, rate int, dsbyte byte) ShakeHash { + c := cshakeState{state: &state{rate: rate, dsbyte: dsbyte}} + + // leftEncode returns max 9 bytes + c.initBlock = make([]byte, 0, 9*2+len(N)+len(S)) + c.initBlock = append(c.initBlock, leftEncode(uint64(len(N)*8))...) + c.initBlock = append(c.initBlock, N...) + c.initBlock = append(c.initBlock, leftEncode(uint64(len(S)*8))...) + c.initBlock = append(c.initBlock, S...) + c.Write(bytepad(c.initBlock, c.rate)) + return &c +} + +// Reset resets the hash to initial state. +func (c *cshakeState) Reset() { + c.state.Reset() + c.Write(bytepad(c.initBlock, c.rate)) +} + +// Clone returns copy of a cSHAKE context within its current state. +func (c *cshakeState) Clone() ShakeHash { + b := make([]byte, len(c.initBlock)) + copy(b, c.initBlock) + return &cshakeState{state: c.clone(), initBlock: b} +} + +// Clone returns copy of SHAKE context within its current state. +func (c *state) Clone() ShakeHash { + return c.clone() +} + +// NewShake128 creates a new SHAKE128 variable-output-length ShakeHash. +// Its generic security strength is 128 bits against all attacks if at +// least 32 bytes of its output are used. +func NewShake128() ShakeHash { + if h := newShake128Asm(); h != nil { + return h + } + return &state{rate: rate128, dsbyte: dsbyteShake} +} + +// NewShake256 creates a new SHAKE256 variable-output-length ShakeHash. +// Its generic security strength is 256 bits against all attacks if +// at least 64 bytes of its output are used. +func NewShake256() ShakeHash { + if h := newShake256Asm(); h != nil { + return h + } + return &state{rate: rate256, dsbyte: dsbyteShake} +} + +// NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash, +// a customizable variant of SHAKE128. +// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is +// desired. S is a customization byte string used for domain separation - two cSHAKE +// computations on same input with different S yield unrelated outputs. +// When N and S are both empty, this is equivalent to NewShake128. +func NewCShake128(N, S []byte) ShakeHash { + if len(N) == 0 && len(S) == 0 { + return NewShake128() + } + return newCShake(N, S, rate128, dsbyteCShake) +} + +// NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash, +// a customizable variant of SHAKE256. +// N is used to define functions based on cSHAKE, it can be empty when plain cSHAKE is +// desired. S is a customization byte string used for domain separation - two cSHAKE +// computations on same input with different S yield unrelated outputs. +// When N and S are both empty, this is equivalent to NewShake256. +func NewCShake256(N, S []byte) ShakeHash { + if len(N) == 0 && len(S) == 0 { + return NewShake256() + } + return newCShake(N, S, rate256, dsbyteCShake) +} + +// ShakeSum128 writes an arbitrary-length digest of data into hash. +func ShakeSum128(hash, data []byte) { + h := NewShake128() + h.Write(data) + h.Read(hash) +} + +// ShakeSum256 writes an arbitrary-length digest of data into hash. +func ShakeSum256(hash, data []byte) { + h := NewShake256() + h.Write(data) + h.Read(hash) +} diff --git a/vendor/golang.org/x/crypto/sha3/shake_generic.go b/vendor/golang.org/x/crypto/sha3/shake_generic.go new file mode 100644 index 0000000..add4e73 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/shake_generic.go @@ -0,0 +1,19 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gccgo appengine !s390x + +package sha3 + +// newShake128Asm returns an assembly implementation of SHAKE-128 if available, +// otherwise it returns nil. +func newShake128Asm() ShakeHash { + return nil +} + +// newShake256Asm returns an assembly implementation of SHAKE-256 if available, +// otherwise it returns nil. +func newShake256Asm() ShakeHash { + return nil +} diff --git a/vendor/golang.org/x/crypto/sha3/xor.go b/vendor/golang.org/x/crypto/sha3/xor.go new file mode 100644 index 0000000..079b650 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/xor.go @@ -0,0 +1,23 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !amd64,!386,!ppc64le appengine + +package sha3 + +// A storageBuf is an aligned array of maxRate bytes. +type storageBuf [maxRate]byte + +func (b *storageBuf) asBytes() *[maxRate]byte { + return (*[maxRate]byte)(b) +} + +var ( + xorIn = xorInGeneric + copyOut = copyOutGeneric + xorInUnaligned = xorInGeneric + copyOutUnaligned = copyOutGeneric +) + +const xorImplementationUnaligned = "generic" diff --git a/vendor/golang.org/x/crypto/sha3/xor_generic.go b/vendor/golang.org/x/crypto/sha3/xor_generic.go new file mode 100644 index 0000000..fd35f02 --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/xor_generic.go @@ -0,0 +1,28 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package sha3 + +import "encoding/binary" + +// xorInGeneric xors the bytes in buf into the state; it +// makes no non-portable assumptions about memory layout +// or alignment. +func xorInGeneric(d *state, buf []byte) { + n := len(buf) / 8 + + for i := 0; i < n; i++ { + a := binary.LittleEndian.Uint64(buf) + d.a[i] ^= a + buf = buf[8:] + } +} + +// copyOutGeneric copies ulint64s to a byte buffer. +func copyOutGeneric(d *state, b []byte) { + for i := 0; len(b) >= 8; i++ { + binary.LittleEndian.PutUint64(b, d.a[i]) + b = b[8:] + } +} diff --git a/vendor/golang.org/x/crypto/sha3/xor_unaligned.go b/vendor/golang.org/x/crypto/sha3/xor_unaligned.go new file mode 100644 index 0000000..5f19cdf --- /dev/null +++ b/vendor/golang.org/x/crypto/sha3/xor_unaligned.go @@ -0,0 +1,67 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build amd64 386 ppc64le +// +build !appengine + +package sha3 + +import "unsafe" + +// A storageBuf is an aligned array of maxRate bytes. +type storageBuf [maxRate / 8]uint64 + +func (b *storageBuf) asBytes() *[maxRate]byte { + return (*[maxRate]byte)(unsafe.Pointer(b)) +} + +// xorInUnaligned uses unaligned reads and writes to update d.a to contain d.a +// XOR buf. +func xorInUnaligned(d *state, buf []byte) { + n := len(buf) + bw := (*[maxRate / 8]uint64)(unsafe.Pointer(&buf[0]))[: n/8 : n/8] + if n >= 72 { + d.a[0] ^= bw[0] + d.a[1] ^= bw[1] + d.a[2] ^= bw[2] + d.a[3] ^= bw[3] + d.a[4] ^= bw[4] + d.a[5] ^= bw[5] + d.a[6] ^= bw[6] + d.a[7] ^= bw[7] + d.a[8] ^= bw[8] + } + if n >= 104 { + d.a[9] ^= bw[9] + d.a[10] ^= bw[10] + d.a[11] ^= bw[11] + d.a[12] ^= bw[12] + } + if n >= 136 { + d.a[13] ^= bw[13] + d.a[14] ^= bw[14] + d.a[15] ^= bw[15] + d.a[16] ^= bw[16] + } + if n >= 144 { + d.a[17] ^= bw[17] + } + if n >= 168 { + d.a[18] ^= bw[18] + d.a[19] ^= bw[19] + d.a[20] ^= bw[20] + } +} + +func copyOutUnaligned(d *state, buf []byte) { + ab := (*[maxRate]uint8)(unsafe.Pointer(&d.a[0])) + copy(buf, ab[:]) +} + +var ( + xorIn = xorInUnaligned + copyOut = copyOutUnaligned +) + +const xorImplementationUnaligned = "unaligned" diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s new file mode 100644 index 0000000..06f84b8 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s @@ -0,0 +1,17 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +#include "textflag.h" + +// +// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go +// + +TEXT ·syscall6(SB),NOSPLIT,$0-88 + JMP syscall·syscall6(SB) + +TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 + JMP syscall·rawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/cpu/byteorder.go b/vendor/golang.org/x/sys/cpu/byteorder.go new file mode 100644 index 0000000..dcbb14e --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/byteorder.go @@ -0,0 +1,65 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +import ( + "runtime" +) + +// byteOrder is a subset of encoding/binary.ByteOrder. +type byteOrder interface { + Uint32([]byte) uint32 + Uint64([]byte) uint64 +} + +type littleEndian struct{} +type bigEndian struct{} + +func (littleEndian) Uint32(b []byte) uint32 { + _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func (littleEndian) Uint64(b []byte) uint64 { + _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} + +func (bigEndian) Uint32(b []byte) uint32 { + _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 + return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 +} + +func (bigEndian) Uint64(b []byte) uint64 { + _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | + uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 +} + +// hostByteOrder returns littleEndian on little-endian machines and +// bigEndian on big-endian machines. +func hostByteOrder() byteOrder { + switch runtime.GOARCH { + case "386", "amd64", "amd64p32", + "alpha", + "arm", "arm64", + "mipsle", "mips64le", "mips64p32le", + "nios2", + "ppc64le", + "riscv", "riscv64", + "sh": + return littleEndian{} + case "armbe", "arm64be", + "m68k", + "mips", "mips64", "mips64p32", + "ppc", "ppc64", + "s390", "s390x", + "shbe", + "sparc", "sparc64": + return bigEndian{} + } + panic("unknown architecture") +} diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go new file mode 100644 index 0000000..f77701f --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -0,0 +1,287 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package cpu implements processor feature detection for +// various CPU architectures. +package cpu + +import ( + "os" + "strings" +) + +// Initialized reports whether the CPU features were initialized. +// +// For some GOOS/GOARCH combinations initialization of the CPU features depends +// on reading an operating specific file, e.g. /proc/self/auxv on linux/arm +// Initialized will report false if reading the file fails. +var Initialized bool + +// CacheLinePad is used to pad structs to avoid false sharing. +type CacheLinePad struct{ _ [cacheLineSize]byte } + +// X86 contains the supported CPU features of the +// current X86/AMD64 platform. If the current platform +// is not X86/AMD64 then all feature flags are false. +// +// X86 is padded to avoid false sharing. Further the HasAVX +// and HasAVX2 are only set if the OS supports XMM and YMM +// registers in addition to the CPUID feature bit being set. +var X86 struct { + _ CacheLinePad + HasAES bool // AES hardware implementation (AES NI) + HasADX bool // Multi-precision add-carry instruction extensions + HasAVX bool // Advanced vector extension + HasAVX2 bool // Advanced vector extension 2 + HasAVX512 bool // Advanced vector extension 512 + HasAVX512F bool // Advanced vector extension 512 Foundation Instructions + HasAVX512CD bool // Advanced vector extension 512 Conflict Detection Instructions + HasAVX512ER bool // Advanced vector extension 512 Exponential and Reciprocal Instructions + HasAVX512PF bool // Advanced vector extension 512 Prefetch Instructions Instructions + HasAVX512VL bool // Advanced vector extension 512 Vector Length Extensions + HasAVX512BW bool // Advanced vector extension 512 Byte and Word Instructions + HasAVX512DQ bool // Advanced vector extension 512 Doubleword and Quadword Instructions + HasAVX512IFMA bool // Advanced vector extension 512 Integer Fused Multiply Add + HasAVX512VBMI bool // Advanced vector extension 512 Vector Byte Manipulation Instructions + HasAVX5124VNNIW bool // Advanced vector extension 512 Vector Neural Network Instructions Word variable precision + HasAVX5124FMAPS bool // Advanced vector extension 512 Fused Multiply Accumulation Packed Single precision + HasAVX512VPOPCNTDQ bool // Advanced vector extension 512 Double and quad word population count instructions + HasAVX512VPCLMULQDQ bool // Advanced vector extension 512 Vector carry-less multiply operations + HasAVX512VNNI bool // Advanced vector extension 512 Vector Neural Network Instructions + HasAVX512GFNI bool // Advanced vector extension 512 Galois field New Instructions + HasAVX512VAES bool // Advanced vector extension 512 Vector AES instructions + HasAVX512VBMI2 bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2 + HasAVX512BITALG bool // Advanced vector extension 512 Bit Algorithms + HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions + HasBMI1 bool // Bit manipulation instruction set 1 + HasBMI2 bool // Bit manipulation instruction set 2 + HasERMS bool // Enhanced REP for MOVSB and STOSB + HasFMA bool // Fused-multiply-add instructions + HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. + HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM + HasPOPCNT bool // Hamming weight instruction POPCNT. + HasRDRAND bool // RDRAND instruction (on-chip random number generator) + HasRDSEED bool // RDSEED instruction (on-chip random number generator) + HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64) + HasSSE3 bool // Streaming SIMD extension 3 + HasSSSE3 bool // Supplemental streaming SIMD extension 3 + HasSSE41 bool // Streaming SIMD extension 4 and 4.1 + HasSSE42 bool // Streaming SIMD extension 4 and 4.2 + _ CacheLinePad +} + +// ARM64 contains the supported CPU features of the +// current ARMv8(aarch64) platform. If the current platform +// is not arm64 then all feature flags are false. +var ARM64 struct { + _ CacheLinePad + HasFP bool // Floating-point instruction set (always available) + HasASIMD bool // Advanced SIMD (always available) + HasEVTSTRM bool // Event stream support + HasAES bool // AES hardware implementation + HasPMULL bool // Polynomial multiplication instruction set + HasSHA1 bool // SHA1 hardware implementation + HasSHA2 bool // SHA2 hardware implementation + HasCRC32 bool // CRC32 hardware implementation + HasATOMICS bool // Atomic memory operation instruction set + HasFPHP bool // Half precision floating-point instruction set + HasASIMDHP bool // Advanced SIMD half precision instruction set + HasCPUID bool // CPUID identification scheme registers + HasASIMDRDM bool // Rounding double multiply add/subtract instruction set + HasJSCVT bool // Javascript conversion from floating-point to integer + HasFCMA bool // Floating-point multiplication and addition of complex numbers + HasLRCPC bool // Release Consistent processor consistent support + HasDCPOP bool // Persistent memory support + HasSHA3 bool // SHA3 hardware implementation + HasSM3 bool // SM3 hardware implementation + HasSM4 bool // SM4 hardware implementation + HasASIMDDP bool // Advanced SIMD double precision instruction set + HasSHA512 bool // SHA512 hardware implementation + HasSVE bool // Scalable Vector Extensions + HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 + _ CacheLinePad +} + +// ARM contains the supported CPU features of the current ARM (32-bit) platform. +// All feature flags are false if: +// 1. the current platform is not arm, or +// 2. the current operating system is not Linux. +var ARM struct { + _ CacheLinePad + HasSWP bool // SWP instruction support + HasHALF bool // Half-word load and store support + HasTHUMB bool // ARM Thumb instruction set + Has26BIT bool // Address space limited to 26-bits + HasFASTMUL bool // 32-bit operand, 64-bit result multiplication support + HasFPA bool // Floating point arithmetic support + HasVFP bool // Vector floating point support + HasEDSP bool // DSP Extensions support + HasJAVA bool // Java instruction set + HasIWMMXT bool // Intel Wireless MMX technology support + HasCRUNCH bool // MaverickCrunch context switching and handling + HasTHUMBEE bool // Thumb EE instruction set + HasNEON bool // NEON instruction set + HasVFPv3 bool // Vector floating point version 3 support + HasVFPv3D16 bool // Vector floating point version 3 D8-D15 + HasTLS bool // Thread local storage support + HasVFPv4 bool // Vector floating point version 4 support + HasIDIVA bool // Integer divide instruction support in ARM mode + HasIDIVT bool // Integer divide instruction support in Thumb mode + HasVFPD32 bool // Vector floating point version 3 D15-D31 + HasLPAE bool // Large Physical Address Extensions + HasEVTSTRM bool // Event stream support + HasAES bool // AES hardware implementation + HasPMULL bool // Polynomial multiplication instruction set + HasSHA1 bool // SHA1 hardware implementation + HasSHA2 bool // SHA2 hardware implementation + HasCRC32 bool // CRC32 hardware implementation + _ CacheLinePad +} + +// MIPS64X contains the supported CPU features of the current mips64/mips64le +// platforms. If the current platform is not mips64/mips64le or the current +// operating system is not Linux then all feature flags are false. +var MIPS64X struct { + _ CacheLinePad + HasMSA bool // MIPS SIMD architecture + _ CacheLinePad +} + +// PPC64 contains the supported CPU features of the current ppc64/ppc64le platforms. +// If the current platform is not ppc64/ppc64le then all feature flags are false. +// +// For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00, +// since there are no optional categories. There are some exceptions that also +// require kernel support to work (DARN, SCV), so there are feature bits for +// those as well. The minimum processor requirement is POWER8 (ISA 2.07). +// The struct is padded to avoid false sharing. +var PPC64 struct { + _ CacheLinePad + HasDARN bool // Hardware random number generator (requires kernel enablement) + HasSCV bool // Syscall vectored (requires kernel enablement) + IsPOWER8 bool // ISA v2.07 (POWER8) + IsPOWER9 bool // ISA v3.00 (POWER9) + _ CacheLinePad +} + +// S390X contains the supported CPU features of the current IBM Z +// (s390x) platform. If the current platform is not IBM Z then all +// feature flags are false. +// +// S390X is padded to avoid false sharing. Further HasVX is only set +// if the OS supports vector registers in addition to the STFLE +// feature bit being set. +var S390X struct { + _ CacheLinePad + HasZARCH bool // z/Architecture mode is active [mandatory] + HasSTFLE bool // store facility list extended + HasLDISP bool // long (20-bit) displacements + HasEIMM bool // 32-bit immediates + HasDFP bool // decimal floating point + HasETF3EH bool // ETF-3 enhanced + HasMSA bool // message security assist (CPACF) + HasAES bool // KM-AES{128,192,256} functions + HasAESCBC bool // KMC-AES{128,192,256} functions + HasAESCTR bool // KMCTR-AES{128,192,256} functions + HasAESGCM bool // KMA-GCM-AES{128,192,256} functions + HasGHASH bool // KIMD-GHASH function + HasSHA1 bool // K{I,L}MD-SHA-1 functions + HasSHA256 bool // K{I,L}MD-SHA-256 functions + HasSHA512 bool // K{I,L}MD-SHA-512 functions + HasSHA3 bool // K{I,L}MD-SHA3-{224,256,384,512} and K{I,L}MD-SHAKE-{128,256} functions + HasVX bool // vector facility + HasVXE bool // vector-enhancements facility 1 + _ CacheLinePad +} + +func init() { + archInit() + initOptions() + processOptions() +} + +// options contains the cpu debug options that can be used in GODEBUG. +// Options are arch dependent and are added by the arch specific initOptions functions. +// Features that are mandatory for the specific GOARCH should have the Required field set +// (e.g. SSE2 on amd64). +var options []option + +// Option names should be lower case. e.g. avx instead of AVX. +type option struct { + Name string + Feature *bool + Specified bool // whether feature value was specified in GODEBUG + Enable bool // whether feature should be enabled + Required bool // whether feature is mandatory and can not be disabled +} + +func processOptions() { + env := os.Getenv("GODEBUG") +field: + for env != "" { + field := "" + i := strings.IndexByte(env, ',') + if i < 0 { + field, env = env, "" + } else { + field, env = env[:i], env[i+1:] + } + if len(field) < 4 || field[:4] != "cpu." { + continue + } + i = strings.IndexByte(field, '=') + if i < 0 { + print("GODEBUG sys/cpu: no value specified for \"", field, "\"\n") + continue + } + key, value := field[4:i], field[i+1:] // e.g. "SSE2", "on" + + var enable bool + switch value { + case "on": + enable = true + case "off": + enable = false + default: + print("GODEBUG sys/cpu: value \"", value, "\" not supported for cpu option \"", key, "\"\n") + continue field + } + + if key == "all" { + for i := range options { + options[i].Specified = true + options[i].Enable = enable || options[i].Required + } + continue field + } + + for i := range options { + if options[i].Name == key { + options[i].Specified = true + options[i].Enable = enable + continue field + } + } + + print("GODEBUG sys/cpu: unknown cpu feature \"", key, "\"\n") + } + + for _, o := range options { + if !o.Specified { + continue + } + + if o.Enable && !*o.Feature { + print("GODEBUG sys/cpu: can not enable \"", o.Name, "\", missing CPU support\n") + continue + } + + if !o.Enable && o.Required { + print("GODEBUG sys/cpu: can not disable \"", o.Name, "\", required CPU feature\n") + continue + } + + *o.Feature = o.Enable + } +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix.go b/vendor/golang.org/x/sys/cpu/cpu_aix.go new file mode 100644 index 0000000..464a209 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_aix.go @@ -0,0 +1,32 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build aix + +package cpu + +const ( + // getsystemcfg constants + _SC_IMPL = 2 + _IMPL_POWER8 = 0x10000 + _IMPL_POWER9 = 0x20000 +) + +func archInit() { + impl := getsystemcfg(_SC_IMPL) + if impl&_IMPL_POWER8 != 0 { + PPC64.IsPOWER8 = true + } + if impl&_IMPL_POWER9 != 0 { + PPC64.IsPOWER9 = true + } + + Initialized = true +} + +func getsystemcfg(label int) (n uint64) { + r0, _ := callgetsystemcfg(label) + n = uint64(r0) + return +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm.go b/vendor/golang.org/x/sys/cpu/cpu_arm.go new file mode 100644 index 0000000..301b752 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_arm.go @@ -0,0 +1,73 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const cacheLineSize = 32 + +// HWCAP/HWCAP2 bits. +// These are specific to Linux. +const ( + hwcap_SWP = 1 << 0 + hwcap_HALF = 1 << 1 + hwcap_THUMB = 1 << 2 + hwcap_26BIT = 1 << 3 + hwcap_FAST_MULT = 1 << 4 + hwcap_FPA = 1 << 5 + hwcap_VFP = 1 << 6 + hwcap_EDSP = 1 << 7 + hwcap_JAVA = 1 << 8 + hwcap_IWMMXT = 1 << 9 + hwcap_CRUNCH = 1 << 10 + hwcap_THUMBEE = 1 << 11 + hwcap_NEON = 1 << 12 + hwcap_VFPv3 = 1 << 13 + hwcap_VFPv3D16 = 1 << 14 + hwcap_TLS = 1 << 15 + hwcap_VFPv4 = 1 << 16 + hwcap_IDIVA = 1 << 17 + hwcap_IDIVT = 1 << 18 + hwcap_VFPD32 = 1 << 19 + hwcap_LPAE = 1 << 20 + hwcap_EVTSTRM = 1 << 21 + + hwcap2_AES = 1 << 0 + hwcap2_PMULL = 1 << 1 + hwcap2_SHA1 = 1 << 2 + hwcap2_SHA2 = 1 << 3 + hwcap2_CRC32 = 1 << 4 +) + +func initOptions() { + options = []option{ + {Name: "pmull", Feature: &ARM.HasPMULL}, + {Name: "sha1", Feature: &ARM.HasSHA1}, + {Name: "sha2", Feature: &ARM.HasSHA2}, + {Name: "swp", Feature: &ARM.HasSWP}, + {Name: "thumb", Feature: &ARM.HasTHUMB}, + {Name: "thumbee", Feature: &ARM.HasTHUMBEE}, + {Name: "tls", Feature: &ARM.HasTLS}, + {Name: "vfp", Feature: &ARM.HasVFP}, + {Name: "vfpd32", Feature: &ARM.HasVFPD32}, + {Name: "vfpv3", Feature: &ARM.HasVFPv3}, + {Name: "vfpv3d16", Feature: &ARM.HasVFPv3D16}, + {Name: "vfpv4", Feature: &ARM.HasVFPv4}, + {Name: "half", Feature: &ARM.HasHALF}, + {Name: "26bit", Feature: &ARM.Has26BIT}, + {Name: "fastmul", Feature: &ARM.HasFASTMUL}, + {Name: "fpa", Feature: &ARM.HasFPA}, + {Name: "edsp", Feature: &ARM.HasEDSP}, + {Name: "java", Feature: &ARM.HasJAVA}, + {Name: "iwmmxt", Feature: &ARM.HasIWMMXT}, + {Name: "crunch", Feature: &ARM.HasCRUNCH}, + {Name: "neon", Feature: &ARM.HasNEON}, + {Name: "idivt", Feature: &ARM.HasIDIVT}, + {Name: "idiva", Feature: &ARM.HasIDIVA}, + {Name: "lpae", Feature: &ARM.HasLPAE}, + {Name: "evtstrm", Feature: &ARM.HasEVTSTRM}, + {Name: "aes", Feature: &ARM.HasAES}, + {Name: "crc32", Feature: &ARM.HasCRC32}, + } + +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go new file mode 100644 index 0000000..951078f --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -0,0 +1,173 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +import "runtime" + +const cacheLineSize = 64 + +func initOptions() { + options = []option{ + {Name: "fp", Feature: &ARM64.HasFP}, + {Name: "asimd", Feature: &ARM64.HasASIMD}, + {Name: "evstrm", Feature: &ARM64.HasEVTSTRM}, + {Name: "aes", Feature: &ARM64.HasAES}, + {Name: "fphp", Feature: &ARM64.HasFPHP}, + {Name: "jscvt", Feature: &ARM64.HasJSCVT}, + {Name: "lrcpc", Feature: &ARM64.HasLRCPC}, + {Name: "pmull", Feature: &ARM64.HasPMULL}, + {Name: "sha1", Feature: &ARM64.HasSHA1}, + {Name: "sha2", Feature: &ARM64.HasSHA2}, + {Name: "sha3", Feature: &ARM64.HasSHA3}, + {Name: "sha512", Feature: &ARM64.HasSHA512}, + {Name: "sm3", Feature: &ARM64.HasSM3}, + {Name: "sm4", Feature: &ARM64.HasSM4}, + {Name: "sve", Feature: &ARM64.HasSVE}, + {Name: "crc32", Feature: &ARM64.HasCRC32}, + {Name: "atomics", Feature: &ARM64.HasATOMICS}, + {Name: "asimdhp", Feature: &ARM64.HasASIMDHP}, + {Name: "cpuid", Feature: &ARM64.HasCPUID}, + {Name: "asimrdm", Feature: &ARM64.HasASIMDRDM}, + {Name: "fcma", Feature: &ARM64.HasFCMA}, + {Name: "dcpop", Feature: &ARM64.HasDCPOP}, + {Name: "asimddp", Feature: &ARM64.HasASIMDDP}, + {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM}, + } +} + +func archInit() { + switch runtime.GOOS { + case "android", "darwin", "ios", "netbsd": + // Android and iOS don't seem to allow reading these registers. + // + // NetBSD: + // ID_AA64ISAR0_EL1 is a privileged register and cannot be read from EL0. + // It can be read via sysctl(3). Example for future implementers: + // https://nxr.netbsd.org/xref/src/usr.sbin/cpuctl/arch/aarch64.c + // + // Fake the minimal features expected by + // TestARM64minimalFeatures. + ARM64.HasASIMD = true + ARM64.HasFP = true + case "linux": + doinit() + default: + readARM64Registers() + } +} + +func readARM64Registers() { + Initialized = true + + // ID_AA64ISAR0_EL1 + isar0 := getisar0() + + switch extractBits(isar0, 4, 7) { + case 1: + ARM64.HasAES = true + case 2: + ARM64.HasAES = true + ARM64.HasPMULL = true + } + + switch extractBits(isar0, 8, 11) { + case 1: + ARM64.HasSHA1 = true + } + + switch extractBits(isar0, 12, 15) { + case 1: + ARM64.HasSHA2 = true + case 2: + ARM64.HasSHA2 = true + ARM64.HasSHA512 = true + } + + switch extractBits(isar0, 16, 19) { + case 1: + ARM64.HasCRC32 = true + } + + switch extractBits(isar0, 20, 23) { + case 2: + ARM64.HasATOMICS = true + } + + switch extractBits(isar0, 28, 31) { + case 1: + ARM64.HasASIMDRDM = true + } + + switch extractBits(isar0, 32, 35) { + case 1: + ARM64.HasSHA3 = true + } + + switch extractBits(isar0, 36, 39) { + case 1: + ARM64.HasSM3 = true + } + + switch extractBits(isar0, 40, 43) { + case 1: + ARM64.HasSM4 = true + } + + switch extractBits(isar0, 44, 47) { + case 1: + ARM64.HasASIMDDP = true + } + + // ID_AA64ISAR1_EL1 + isar1 := getisar1() + + switch extractBits(isar1, 0, 3) { + case 1: + ARM64.HasDCPOP = true + } + + switch extractBits(isar1, 12, 15) { + case 1: + ARM64.HasJSCVT = true + } + + switch extractBits(isar1, 16, 19) { + case 1: + ARM64.HasFCMA = true + } + + switch extractBits(isar1, 20, 23) { + case 1: + ARM64.HasLRCPC = true + } + + // ID_AA64PFR0_EL1 + pfr0 := getpfr0() + + switch extractBits(pfr0, 16, 19) { + case 0: + ARM64.HasFP = true + case 1: + ARM64.HasFP = true + ARM64.HasFPHP = true + } + + switch extractBits(pfr0, 20, 23) { + case 0: + ARM64.HasASIMD = true + case 1: + ARM64.HasASIMD = true + ARM64.HasASIMDHP = true + } + + switch extractBits(pfr0, 32, 35) { + case 1: + ARM64.HasSVE = true + } +} + +func extractBits(data uint64, start, end uint) uint { + return (uint)(data>>start) & ((1 << (end - start + 1)) - 1) +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s new file mode 100644 index 0000000..a54436e --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -0,0 +1,31 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +#include "textflag.h" + +// func getisar0() uint64 +TEXT ·getisar0(SB),NOSPLIT,$0-8 + // get Instruction Set Attributes 0 into x0 + // mrs x0, ID_AA64ISAR0_EL1 = d5380600 + WORD $0xd5380600 + MOVD R0, ret+0(FP) + RET + +// func getisar1() uint64 +TEXT ·getisar1(SB),NOSPLIT,$0-8 + // get Instruction Set Attributes 1 into x0 + // mrs x0, ID_AA64ISAR1_EL1 = d5380620 + WORD $0xd5380620 + MOVD R0, ret+0(FP) + RET + +// func getpfr0() uint64 +TEXT ·getpfr0(SB),NOSPLIT,$0-8 + // get Processor Feature Register 0 into x0 + // mrs x0, ID_AA64PFR0_EL1 = d5380400 + WORD $0xd5380400 + MOVD R0, ret+0(FP) + RET diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go similarity index 54% rename from vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go rename to vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index 0e3f25a..7b88e86 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin,arm,!go1.12 +// +build !gccgo -package unix +package cpu -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return 0, ENOSYS -} +func getisar0() uint64 +func getisar1() uint64 +func getpfr0() uint64 diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go new file mode 100644 index 0000000..568bcd0 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go @@ -0,0 +1,21 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +package cpu + +// haveAsmFunctions reports whether the other functions in this file can +// be safely called. +func haveAsmFunctions() bool { return true } + +// The following feature detection functions are defined in cpu_s390x.s. +// They are likely to be expensive to call so the results should be cached. +func stfle() facilityList +func kmQuery() queryResult +func kmcQuery() queryResult +func kmctrQuery() queryResult +func kmaQuery() queryResult +func kimdQuery() queryResult +func klmdQuery() queryResult diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go new file mode 100644 index 0000000..f7cb469 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go @@ -0,0 +1,16 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build !gccgo + +package cpu + +// cpuid is implemented in cpu_x86.s for gc compiler +// and in cpu_gccgo.c for gccgo. +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) + +// xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler +// and in cpu_gccgo.c for gccgo. +func xgetbv() (eax, edx uint32) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go similarity index 53% rename from vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go rename to vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go index 01d4504..53ca8d6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin,arm64,!go1.12 +// +build gccgo -package unix +package cpu -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return 0, ENOSYS -} +func getisar0() uint64 { return 0 } +func getisar1() uint64 { return 0 } +func getpfr0() uint64 { return 0 } diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go new file mode 100644 index 0000000..aa986f7 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gccgo + +package cpu + +// haveAsmFunctions reports whether the other functions in this file can +// be safely called. +func haveAsmFunctions() bool { return false } + +// TODO(mundaym): the following feature detection functions are currently +// stubs. See https://golang.org/cl/162887 for how to fix this. +// They are likely to be expensive to call so the results should be cached. +func stfle() facilityList { panic("not implemented for gccgo") } +func kmQuery() queryResult { panic("not implemented for gccgo") } +func kmcQuery() queryResult { panic("not implemented for gccgo") } +func kmctrQuery() queryResult { panic("not implemented for gccgo") } +func kmaQuery() queryResult { panic("not implemented for gccgo") } +func kimdQuery() queryResult { panic("not implemented for gccgo") } +func klmdQuery() queryResult { panic("not implemented for gccgo") } diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c new file mode 100644 index 0000000..e363c7d --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c @@ -0,0 +1,43 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build gccgo + +#include +#include + +// Need to wrap __get_cpuid_count because it's declared as static. +int +gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, + uint32_t *eax, uint32_t *ebx, + uint32_t *ecx, uint32_t *edx) +{ + return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx); +} + +// xgetbv reads the contents of an XCR (Extended Control Register) +// specified in the ECX register into registers EDX:EAX. +// Currently, the only supported value for XCR is 0. +// +// TODO: Replace with a better alternative: +// +// #include +// +// #pragma GCC target("xsave") +// +// void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { +// unsigned long long x = _xgetbv(0); +// *eax = x & 0xffffffff; +// *edx = (x >> 32) & 0xffffffff; +// } +// +// Note that _xgetbv is defined starting with GCC 8. +void +gccgoXgetbv(uint32_t *eax, uint32_t *edx) +{ + __asm(" xorl %%ecx, %%ecx\n" + " xgetbv" + : "=a"(*eax), "=d"(*edx)); +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go new file mode 100644 index 0000000..ba49b91 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go @@ -0,0 +1,26 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 +// +build gccgo + +package cpu + +//extern gccgoGetCpuidCount +func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32) + +func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { + var a, b, c, d uint32 + gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d) + return a, b, c, d +} + +//extern gccgoXgetbv +func gccgoXgetbv(eax, edx *uint32) + +func xgetbv() (eax, edx uint32) { + var a, d uint32 + gccgoXgetbv(&a, &d) + return a, d +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux.go b/vendor/golang.org/x/sys/cpu/cpu_linux.go new file mode 100644 index 0000000..6fc874f --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux.go @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !386,!amd64,!amd64p32,!arm64 + +package cpu + +func archInit() { + if err := readHWCAP(); err != nil { + return + } + doinit() + Initialized = true +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm.go new file mode 100644 index 0000000..2057006 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm.go @@ -0,0 +1,39 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +func doinit() { + ARM.HasSWP = isSet(hwCap, hwcap_SWP) + ARM.HasHALF = isSet(hwCap, hwcap_HALF) + ARM.HasTHUMB = isSet(hwCap, hwcap_THUMB) + ARM.Has26BIT = isSet(hwCap, hwcap_26BIT) + ARM.HasFASTMUL = isSet(hwCap, hwcap_FAST_MULT) + ARM.HasFPA = isSet(hwCap, hwcap_FPA) + ARM.HasVFP = isSet(hwCap, hwcap_VFP) + ARM.HasEDSP = isSet(hwCap, hwcap_EDSP) + ARM.HasJAVA = isSet(hwCap, hwcap_JAVA) + ARM.HasIWMMXT = isSet(hwCap, hwcap_IWMMXT) + ARM.HasCRUNCH = isSet(hwCap, hwcap_CRUNCH) + ARM.HasTHUMBEE = isSet(hwCap, hwcap_THUMBEE) + ARM.HasNEON = isSet(hwCap, hwcap_NEON) + ARM.HasVFPv3 = isSet(hwCap, hwcap_VFPv3) + ARM.HasVFPv3D16 = isSet(hwCap, hwcap_VFPv3D16) + ARM.HasTLS = isSet(hwCap, hwcap_TLS) + ARM.HasVFPv4 = isSet(hwCap, hwcap_VFPv4) + ARM.HasIDIVA = isSet(hwCap, hwcap_IDIVA) + ARM.HasIDIVT = isSet(hwCap, hwcap_IDIVT) + ARM.HasVFPD32 = isSet(hwCap, hwcap_VFPD32) + ARM.HasLPAE = isSet(hwCap, hwcap_LPAE) + ARM.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM) + ARM.HasAES = isSet(hwCap2, hwcap2_AES) + ARM.HasPMULL = isSet(hwCap2, hwcap2_PMULL) + ARM.HasSHA1 = isSet(hwCap2, hwcap2_SHA1) + ARM.HasSHA2 = isSet(hwCap2, hwcap2_SHA2) + ARM.HasCRC32 = isSet(hwCap2, hwcap2_CRC32) +} + +func isSet(hwc uint, value uint) bool { + return hwc&value != 0 +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go new file mode 100644 index 0000000..79a38a0 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go @@ -0,0 +1,71 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +// HWCAP/HWCAP2 bits. These are exposed by Linux. +const ( + hwcap_FP = 1 << 0 + hwcap_ASIMD = 1 << 1 + hwcap_EVTSTRM = 1 << 2 + hwcap_AES = 1 << 3 + hwcap_PMULL = 1 << 4 + hwcap_SHA1 = 1 << 5 + hwcap_SHA2 = 1 << 6 + hwcap_CRC32 = 1 << 7 + hwcap_ATOMICS = 1 << 8 + hwcap_FPHP = 1 << 9 + hwcap_ASIMDHP = 1 << 10 + hwcap_CPUID = 1 << 11 + hwcap_ASIMDRDM = 1 << 12 + hwcap_JSCVT = 1 << 13 + hwcap_FCMA = 1 << 14 + hwcap_LRCPC = 1 << 15 + hwcap_DCPOP = 1 << 16 + hwcap_SHA3 = 1 << 17 + hwcap_SM3 = 1 << 18 + hwcap_SM4 = 1 << 19 + hwcap_ASIMDDP = 1 << 20 + hwcap_SHA512 = 1 << 21 + hwcap_SVE = 1 << 22 + hwcap_ASIMDFHM = 1 << 23 +) + +func doinit() { + if err := readHWCAP(); err != nil { + // failed to read /proc/self/auxv, try reading registers directly + readARM64Registers() + return + } + + // HWCAP feature bits + ARM64.HasFP = isSet(hwCap, hwcap_FP) + ARM64.HasASIMD = isSet(hwCap, hwcap_ASIMD) + ARM64.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM) + ARM64.HasAES = isSet(hwCap, hwcap_AES) + ARM64.HasPMULL = isSet(hwCap, hwcap_PMULL) + ARM64.HasSHA1 = isSet(hwCap, hwcap_SHA1) + ARM64.HasSHA2 = isSet(hwCap, hwcap_SHA2) + ARM64.HasCRC32 = isSet(hwCap, hwcap_CRC32) + ARM64.HasATOMICS = isSet(hwCap, hwcap_ATOMICS) + ARM64.HasFPHP = isSet(hwCap, hwcap_FPHP) + ARM64.HasASIMDHP = isSet(hwCap, hwcap_ASIMDHP) + ARM64.HasCPUID = isSet(hwCap, hwcap_CPUID) + ARM64.HasASIMDRDM = isSet(hwCap, hwcap_ASIMDRDM) + ARM64.HasJSCVT = isSet(hwCap, hwcap_JSCVT) + ARM64.HasFCMA = isSet(hwCap, hwcap_FCMA) + ARM64.HasLRCPC = isSet(hwCap, hwcap_LRCPC) + ARM64.HasDCPOP = isSet(hwCap, hwcap_DCPOP) + ARM64.HasSHA3 = isSet(hwCap, hwcap_SHA3) + ARM64.HasSM3 = isSet(hwCap, hwcap_SM3) + ARM64.HasSM4 = isSet(hwCap, hwcap_SM4) + ARM64.HasASIMDDP = isSet(hwCap, hwcap_ASIMDDP) + ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) + ARM64.HasSVE = isSet(hwCap, hwcap_SVE) + ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) +} + +func isSet(hwc uint, value uint) bool { + return hwc&value != 0 +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go new file mode 100644 index 0000000..5a41890 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go @@ -0,0 +1,23 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build mips64 mips64le + +package cpu + +// HWCAP bits. These are exposed by the Linux kernel 5.4. +const ( + // CPU features + hwcap_MIPS_MSA = 1 << 1 +) + +func doinit() { + // HWCAP feature bits + MIPS64X.HasMSA = isSet(hwCap, hwcap_MIPS_MSA) +} + +func isSet(hwc uint, value uint) bool { + return hwc&value != 0 +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go similarity index 53% rename from vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go rename to vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go index 6b223f9..42b5d33 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin,386,!go1.12 +// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x -package unix +package cpu -//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 +func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go new file mode 100644 index 0000000..99f8a63 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go @@ -0,0 +1,31 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build ppc64 ppc64le + +package cpu + +// HWCAP/HWCAP2 bits. These are exposed by the kernel. +const ( + // ISA Level + _PPC_FEATURE2_ARCH_2_07 = 0x80000000 + _PPC_FEATURE2_ARCH_3_00 = 0x00800000 + + // CPU features + _PPC_FEATURE2_DARN = 0x00200000 + _PPC_FEATURE2_SCV = 0x00100000 +) + +func doinit() { + // HWCAP2 feature bits + PPC64.IsPOWER8 = isSet(hwCap2, _PPC_FEATURE2_ARCH_2_07) + PPC64.IsPOWER9 = isSet(hwCap2, _PPC_FEATURE2_ARCH_3_00) + PPC64.HasDARN = isSet(hwCap2, _PPC_FEATURE2_DARN) + PPC64.HasSCV = isSet(hwCap2, _PPC_FEATURE2_SCV) +} + +func isSet(hwc uint, value uint) bool { + return hwc&value != 0 +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go new file mode 100644 index 0000000..b88d6b8 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go @@ -0,0 +1,159 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const ( + // bit mask values from /usr/include/bits/hwcap.h + hwcap_ZARCH = 2 + hwcap_STFLE = 4 + hwcap_MSA = 8 + hwcap_LDISP = 16 + hwcap_EIMM = 32 + hwcap_DFP = 64 + hwcap_ETF3EH = 256 + hwcap_VX = 2048 + hwcap_VXE = 8192 +) + +// bitIsSet reports whether the bit at index is set. The bit index +// is in big endian order, so bit index 0 is the leftmost bit. +func bitIsSet(bits []uint64, index uint) bool { + return bits[index/64]&((1<<63)>>(index%64)) != 0 +} + +// function is the code for the named cryptographic function. +type function uint8 + +const ( + // KM{,A,C,CTR} function codes + aes128 function = 18 // AES-128 + aes192 function = 19 // AES-192 + aes256 function = 20 // AES-256 + + // K{I,L}MD function codes + sha1 function = 1 // SHA-1 + sha256 function = 2 // SHA-256 + sha512 function = 3 // SHA-512 + sha3_224 function = 32 // SHA3-224 + sha3_256 function = 33 // SHA3-256 + sha3_384 function = 34 // SHA3-384 + sha3_512 function = 35 // SHA3-512 + shake128 function = 36 // SHAKE-128 + shake256 function = 37 // SHAKE-256 + + // KLMD function codes + ghash function = 65 // GHASH +) + +// queryResult contains the result of a Query function +// call. Bits are numbered in big endian order so the +// leftmost bit (the MSB) is at index 0. +type queryResult struct { + bits [2]uint64 +} + +// Has reports whether the given functions are present. +func (q *queryResult) Has(fns ...function) bool { + if len(fns) == 0 { + panic("no function codes provided") + } + for _, f := range fns { + if !bitIsSet(q.bits[:], uint(f)) { + return false + } + } + return true +} + +// facility is a bit index for the named facility. +type facility uint8 + +const ( + // cryptography facilities + msa4 facility = 77 // message-security-assist extension 4 + msa8 facility = 146 // message-security-assist extension 8 +) + +// facilityList contains the result of an STFLE call. +// Bits are numbered in big endian order so the +// leftmost bit (the MSB) is at index 0. +type facilityList struct { + bits [4]uint64 +} + +// Has reports whether the given facilities are present. +func (s *facilityList) Has(fs ...facility) bool { + if len(fs) == 0 { + panic("no facility bits provided") + } + for _, f := range fs { + if !bitIsSet(s.bits[:], uint(f)) { + return false + } + } + return true +} + +func doinit() { + // test HWCAP bit vector + has := func(featureMask uint) bool { + return hwCap&featureMask == featureMask + } + + // mandatory + S390X.HasZARCH = has(hwcap_ZARCH) + + // optional + S390X.HasSTFLE = has(hwcap_STFLE) + S390X.HasLDISP = has(hwcap_LDISP) + S390X.HasEIMM = has(hwcap_EIMM) + S390X.HasETF3EH = has(hwcap_ETF3EH) + S390X.HasDFP = has(hwcap_DFP) + S390X.HasMSA = has(hwcap_MSA) + S390X.HasVX = has(hwcap_VX) + if S390X.HasVX { + S390X.HasVXE = has(hwcap_VXE) + } + + // We need implementations of stfle, km and so on + // to detect cryptographic features. + if !haveAsmFunctions() { + return + } + + // optional cryptographic functions + if S390X.HasMSA { + aes := []function{aes128, aes192, aes256} + + // cipher message + km, kmc := kmQuery(), kmcQuery() + S390X.HasAES = km.Has(aes...) + S390X.HasAESCBC = kmc.Has(aes...) + if S390X.HasSTFLE { + facilities := stfle() + if facilities.Has(msa4) { + kmctr := kmctrQuery() + S390X.HasAESCTR = kmctr.Has(aes...) + } + if facilities.Has(msa8) { + kma := kmaQuery() + S390X.HasAESGCM = kma.Has(aes...) + } + } + + // compute message digest + kimd := kimdQuery() // intermediate (no padding) + klmd := klmdQuery() // last (padding) + S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1) + S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256) + S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512) + S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist + sha3 := []function{ + sha3_224, sha3_256, sha3_384, sha3_512, + shake128, shake256, + } + S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...) + } +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go new file mode 100644 index 0000000..57b5b67 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go @@ -0,0 +1,15 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build mips64 mips64le + +package cpu + +const cacheLineSize = 32 + +func initOptions() { + options = []option{ + {Name: "msa", Feature: &MIPS64X.HasMSA}, + } +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go new file mode 100644 index 0000000..cfc1946 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go @@ -0,0 +1,11 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build mips mipsle + +package cpu + +const cacheLineSize = 32 + +func initOptions() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go new file mode 100644 index 0000000..b412efc --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go @@ -0,0 +1,9 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !linux,arm + +package cpu + +func archInit() {} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go similarity index 53% rename from vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go rename to vendor/golang.org/x/sys/cpu/cpu_other_arm64.go index 68ebd6f..3ffc4af 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go +++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin,amd64,!go1.12 +// +build !linux,arm64 -package unix +package cpu -//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 +func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go new file mode 100644 index 0000000..d28d675 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go @@ -0,0 +1,16 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ppc64 ppc64le + +package cpu + +const cacheLineSize = 128 + +func initOptions() { + options = []option{ + {Name: "darn", Feature: &PPC64.HasDARN}, + {Name: "scv", Feature: &PPC64.HasSCV}, + } +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go new file mode 100644 index 0000000..8b08de3 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build riscv64 + +package cpu + +const cacheLineSize = 32 + +func initOptions() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_s390x.go new file mode 100644 index 0000000..544cd62 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.go @@ -0,0 +1,30 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu + +const cacheLineSize = 256 + +func initOptions() { + options = []option{ + {Name: "zarch", Feature: &S390X.HasZARCH}, + {Name: "stfle", Feature: &S390X.HasSTFLE}, + {Name: "ldisp", Feature: &S390X.HasLDISP}, + {Name: "eimm", Feature: &S390X.HasEIMM}, + {Name: "dfp", Feature: &S390X.HasDFP}, + {Name: "etf3eh", Feature: &S390X.HasETF3EH}, + {Name: "msa", Feature: &S390X.HasMSA}, + {Name: "aes", Feature: &S390X.HasAES}, + {Name: "aescbc", Feature: &S390X.HasAESCBC}, + {Name: "aesctr", Feature: &S390X.HasAESCTR}, + {Name: "aesgcm", Feature: &S390X.HasAESGCM}, + {Name: "ghash", Feature: &S390X.HasGHASH}, + {Name: "sha1", Feature: &S390X.HasSHA1}, + {Name: "sha256", Feature: &S390X.HasSHA256}, + {Name: "sha3", Feature: &S390X.HasSHA3}, + {Name: "sha512", Feature: &S390X.HasSHA512}, + {Name: "vx", Feature: &S390X.HasVX}, + {Name: "vxe", Feature: &S390X.HasVXE}, + } +} diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.s new file mode 100644 index 0000000..e5037d9 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.s @@ -0,0 +1,57 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +#include "textflag.h" + +// func stfle() facilityList +TEXT ·stfle(SB), NOSPLIT|NOFRAME, $0-32 + MOVD $ret+0(FP), R1 + MOVD $3, R0 // last doubleword index to store + XC $32, (R1), (R1) // clear 4 doublewords (32 bytes) + WORD $0xb2b01000 // store facility list extended (STFLE) + RET + +// func kmQuery() queryResult +TEXT ·kmQuery(SB), NOSPLIT|NOFRAME, $0-16 + MOVD $0, R0 // set function code to 0 (KM-Query) + MOVD $ret+0(FP), R1 // address of 16-byte return value + WORD $0xB92E0024 // cipher message (KM) + RET + +// func kmcQuery() queryResult +TEXT ·kmcQuery(SB), NOSPLIT|NOFRAME, $0-16 + MOVD $0, R0 // set function code to 0 (KMC-Query) + MOVD $ret+0(FP), R1 // address of 16-byte return value + WORD $0xB92F0024 // cipher message with chaining (KMC) + RET + +// func kmctrQuery() queryResult +TEXT ·kmctrQuery(SB), NOSPLIT|NOFRAME, $0-16 + MOVD $0, R0 // set function code to 0 (KMCTR-Query) + MOVD $ret+0(FP), R1 // address of 16-byte return value + WORD $0xB92D4024 // cipher message with counter (KMCTR) + RET + +// func kmaQuery() queryResult +TEXT ·kmaQuery(SB), NOSPLIT|NOFRAME, $0-16 + MOVD $0, R0 // set function code to 0 (KMA-Query) + MOVD $ret+0(FP), R1 // address of 16-byte return value + WORD $0xb9296024 // cipher message with authentication (KMA) + RET + +// func kimdQuery() queryResult +TEXT ·kimdQuery(SB), NOSPLIT|NOFRAME, $0-16 + MOVD $0, R0 // set function code to 0 (KIMD-Query) + MOVD $ret+0(FP), R1 // address of 16-byte return value + WORD $0xB93E0024 // compute intermediate message digest (KIMD) + RET + +// func klmdQuery() queryResult +TEXT ·klmdQuery(SB), NOSPLIT|NOFRAME, $0-16 + MOVD $0, R0 // set function code to 0 (KLMD-Query) + MOVD $ret+0(FP), R1 // address of 16-byte return value + WORD $0xB93F0024 // compute last message digest (KLMD) + RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/vendor/golang.org/x/sys/cpu/cpu_wasm.go new file mode 100644 index 0000000..5382f2a --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_wasm.go @@ -0,0 +1,17 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build wasm + +package cpu + +// We're compiling the cpu package for an unknown (software-abstracted) CPU. +// Make CacheLinePad an empty struct and hope that the usual struct alignment +// rules are good enough. + +const cacheLineSize = 0 + +func initOptions() {} + +func archInit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go new file mode 100644 index 0000000..48d4293 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -0,0 +1,135 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build 386 amd64 amd64p32 + +package cpu + +import "runtime" + +const cacheLineSize = 64 + +func initOptions() { + options = []option{ + {Name: "adx", Feature: &X86.HasADX}, + {Name: "aes", Feature: &X86.HasAES}, + {Name: "avx", Feature: &X86.HasAVX}, + {Name: "avx2", Feature: &X86.HasAVX2}, + {Name: "avx512", Feature: &X86.HasAVX512}, + {Name: "avx512f", Feature: &X86.HasAVX512F}, + {Name: "avx512cd", Feature: &X86.HasAVX512CD}, + {Name: "avx512er", Feature: &X86.HasAVX512ER}, + {Name: "avx512pf", Feature: &X86.HasAVX512PF}, + {Name: "avx512vl", Feature: &X86.HasAVX512VL}, + {Name: "avx512bw", Feature: &X86.HasAVX512BW}, + {Name: "avx512dq", Feature: &X86.HasAVX512DQ}, + {Name: "avx512ifma", Feature: &X86.HasAVX512IFMA}, + {Name: "avx512vbmi", Feature: &X86.HasAVX512VBMI}, + {Name: "avx512vnniw", Feature: &X86.HasAVX5124VNNIW}, + {Name: "avx5124fmaps", Feature: &X86.HasAVX5124FMAPS}, + {Name: "avx512vpopcntdq", Feature: &X86.HasAVX512VPOPCNTDQ}, + {Name: "avx512vpclmulqdq", Feature: &X86.HasAVX512VPCLMULQDQ}, + {Name: "avx512vnni", Feature: &X86.HasAVX512VNNI}, + {Name: "avx512gfni", Feature: &X86.HasAVX512GFNI}, + {Name: "avx512vaes", Feature: &X86.HasAVX512VAES}, + {Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2}, + {Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG}, + {Name: "avx512bf16", Feature: &X86.HasAVX512BF16}, + {Name: "bmi1", Feature: &X86.HasBMI1}, + {Name: "bmi2", Feature: &X86.HasBMI2}, + {Name: "erms", Feature: &X86.HasERMS}, + {Name: "fma", Feature: &X86.HasFMA}, + {Name: "osxsave", Feature: &X86.HasOSXSAVE}, + {Name: "pclmulqdq", Feature: &X86.HasPCLMULQDQ}, + {Name: "popcnt", Feature: &X86.HasPOPCNT}, + {Name: "rdrand", Feature: &X86.HasRDRAND}, + {Name: "rdseed", Feature: &X86.HasRDSEED}, + {Name: "sse3", Feature: &X86.HasSSE3}, + {Name: "sse41", Feature: &X86.HasSSE41}, + {Name: "sse42", Feature: &X86.HasSSE42}, + {Name: "ssse3", Feature: &X86.HasSSSE3}, + + // These capabilities should always be enabled on amd64: + {Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"}, + } +} + +func archInit() { + + Initialized = true + + maxID, _, _, _ := cpuid(0, 0) + + if maxID < 1 { + return + } + + _, _, ecx1, edx1 := cpuid(1, 0) + X86.HasSSE2 = isSet(26, edx1) + + X86.HasSSE3 = isSet(0, ecx1) + X86.HasPCLMULQDQ = isSet(1, ecx1) + X86.HasSSSE3 = isSet(9, ecx1) + X86.HasFMA = isSet(12, ecx1) + X86.HasSSE41 = isSet(19, ecx1) + X86.HasSSE42 = isSet(20, ecx1) + X86.HasPOPCNT = isSet(23, ecx1) + X86.HasAES = isSet(25, ecx1) + X86.HasOSXSAVE = isSet(27, ecx1) + X86.HasRDRAND = isSet(30, ecx1) + + var osSupportsAVX, osSupportsAVX512 bool + // For XGETBV, OSXSAVE bit is required and sufficient. + if X86.HasOSXSAVE { + eax, _ := xgetbv() + // Check if XMM and YMM registers have OS support. + osSupportsAVX = isSet(1, eax) && isSet(2, eax) + + // Check if OPMASK and ZMM registers have OS support. + osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax) + } + + X86.HasAVX = isSet(28, ecx1) && osSupportsAVX + + if maxID < 7 { + return + } + + _, ebx7, ecx7, edx7 := cpuid(7, 0) + X86.HasBMI1 = isSet(3, ebx7) + X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX + X86.HasBMI2 = isSet(8, ebx7) + X86.HasERMS = isSet(9, ebx7) + X86.HasRDSEED = isSet(18, ebx7) + X86.HasADX = isSet(19, ebx7) + + X86.HasAVX512 = isSet(16, ebx7) && osSupportsAVX512 // Because avx-512 foundation is the core required extension + if X86.HasAVX512 { + X86.HasAVX512F = true + X86.HasAVX512CD = isSet(28, ebx7) + X86.HasAVX512ER = isSet(27, ebx7) + X86.HasAVX512PF = isSet(26, ebx7) + X86.HasAVX512VL = isSet(31, ebx7) + X86.HasAVX512BW = isSet(30, ebx7) + X86.HasAVX512DQ = isSet(17, ebx7) + X86.HasAVX512IFMA = isSet(21, ebx7) + X86.HasAVX512VBMI = isSet(1, ecx7) + X86.HasAVX5124VNNIW = isSet(2, edx7) + X86.HasAVX5124FMAPS = isSet(3, edx7) + X86.HasAVX512VPOPCNTDQ = isSet(14, ecx7) + X86.HasAVX512VPCLMULQDQ = isSet(10, ecx7) + X86.HasAVX512VNNI = isSet(11, ecx7) + X86.HasAVX512GFNI = isSet(8, ecx7) + X86.HasAVX512VAES = isSet(9, ecx7) + X86.HasAVX512VBMI2 = isSet(6, ecx7) + X86.HasAVX512BITALG = isSet(12, ecx7) + + eax71, _, _, _ := cpuid(7, 1) + X86.HasAVX512BF16 = isSet(5, eax71) + } +} + +func isSet(bitpos uint, value uint32) bool { + return value&(1<> 63)) +) + +// For those platforms don't have a 'cpuid' equivalent we use HWCAP/HWCAP2 +// These are initialized in cpu_$GOARCH.go +// and should not be changed after they are initialized. +var hwCap uint +var hwCap2 uint + +func readHWCAP() error { + buf, err := ioutil.ReadFile(procAuxv) + if err != nil { + // e.g. on android /proc/self/auxv is not accessible, so silently + // ignore the error and leave Initialized = false. On some + // architectures (e.g. arm64) doinit() implements a fallback + // readout and will set Initialized = true again. + return err + } + bo := hostByteOrder() + for len(buf) >= 2*(uintSize/8) { + var tag, val uint + switch uintSize { + case 32: + tag = uint(bo.Uint32(buf[0:])) + val = uint(bo.Uint32(buf[4:])) + buf = buf[8:] + case 64: + tag = uint(bo.Uint64(buf[0:])) + val = uint(bo.Uint64(buf[8:])) + buf = buf[16:] + } + switch tag { + case _AT_HWCAP: + hwCap = val + case _AT_HWCAP2: + hwCap2 = val + } + } + return nil +} diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go new file mode 100644 index 0000000..76fbe40 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go @@ -0,0 +1,27 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Recreate a getsystemcfg syscall handler instead of +// using the one provided by x/sys/unix to avoid having +// the dependency between them. (See golang.org/issue/32102) +// Morever, this file will be used during the building of +// gccgo's libgo and thus must not used a CGo method. + +// +build aix +// +build gccgo + +package cpu + +import ( + "syscall" +) + +//extern getsystemcfg +func gccgoGetsystemcfg(label uint32) (r uint64) + +func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) { + r1 = uintptr(gccgoGetsystemcfg(uint32(label))) + e1 = syscall.GetErrno() + return +} diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go new file mode 100644 index 0000000..78fe25e --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go @@ -0,0 +1,36 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Minimal copy of x/sys/unix so the cpu package can make a +// system call on AIX without depending on x/sys/unix. +// (See golang.org/issue/32102) + +// +build aix,ppc64 +// +build !gccgo + +package cpu + +import ( + "syscall" + "unsafe" +) + +//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" + +//go:linkname libc_getsystemcfg libc_getsystemcfg + +type syscallFunc uintptr + +var libc_getsystemcfg syscallFunc + +type errno = syscall.Errno + +// Implemented in runtime/syscall_aix.go. +func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) +func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) + +func callgetsystemcfg(label int) (r1 uintptr, e1 errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) + return +} diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s new file mode 100644 index 0000000..567a476 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s @@ -0,0 +1,29 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +#include "textflag.h" + +// +// System call support for mips64, OpenBSD +// + +// Just jump to package syscall's implementation for all these functions. +// The runtime may know about them. + +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP syscall·Syscall(SB) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP syscall·Syscall6(SB) + +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + JMP syscall·Syscall9(SB) + +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/fcntl_darwin.go b/vendor/golang.org/x/sys/unix/fcntl_darwin.go index 5868a4a..a9911c7 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_darwin.go +++ b/vendor/golang.org/x/sys/unix/fcntl_darwin.go @@ -16,3 +16,9 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) return err } + +// FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command. +func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error { + _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore)))) + return err +} diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go index cd6f5a6..86032c1 100644 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ b/vendor/golang.org/x/sys/unix/gccgo.go @@ -12,10 +12,8 @@ import "syscall" // We can't use the gc-syntax .s files for gccgo. On the plus side // much of the functionality can be written directly in Go. -//extern gccgoRealSyscallNoError func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) -//extern gccgoRealSyscall func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c index c44730c..2cb1fef 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_c.c +++ b/vendor/golang.org/x/sys/unix/gccgo_c.c @@ -21,6 +21,9 @@ struct ret { uintptr_t err; }; +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) + __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscall"); + 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) { @@ -32,6 +35,9 @@ gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintp return r; } +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) + __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscallNoError"); + 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) { diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl.go index 3559e5d..5641678 100644 --- a/vendor/golang.org/x/sys/unix/ioctl.go +++ b/vendor/golang.org/x/sys/unix/ioctl.go @@ -20,6 +20,15 @@ func IoctlSetInt(fd int, req uint, value int) error { return ioctl(fd, req, uintptr(value)) } +// IoctlSetPointerInt performs an ioctl operation which sets an +// integer value on fd, using the specified request number. The ioctl +// argument is called with a pointer to the integer value, rather than +// passing the integer value directly. +func IoctlSetPointerInt(fd int, req uint, value int) error { + v := int32(value) + return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) +} + // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // // To change fd's window size, the req argument should be TIOCSWINSZ. diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index ece31e9..d257fac 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -73,26 +73,22 @@ aix_ppc64) darwin_386) mkerrors="$mkerrors -m32" mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; darwin_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; darwin_arm) mkerrors="$mkerrors" mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; darwin_arm64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; @@ -184,6 +180,15 @@ openbsd_arm64) # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; +openbsd_mips64) + mkerrors="$mkerrors -m64" + mksyscall="go run mksyscall.go -openbsd" + mksysctl="go run mksysctl_openbsd.go" + mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + # Let the type of C char be signed for making the bare syscall + # API consistent across platforms. + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; solaris_amd64) mksyscall="go run mksyscall_solaris.go" mkerrors="$mkerrors -m64" @@ -217,8 +222,6 @@ esac # aix/ppc64 script generates files instead of writing to stdin. echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ; elif [ "$GOOS" == "darwin" ]; then - # pre-1.12, direct syscalls - echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go"; # 1.12 and later, syscalls via libSystem echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; # 1.13 and later, syscalls via libSystem (including syscallPtr) diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 40534f0..0d72dbb 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -58,6 +58,7 @@ includes_Darwin=' #define _DARWIN_USE_64_BIT_INODE #include #include +#include #include #include #include @@ -93,6 +94,7 @@ includes_DragonFly=' #include #include #include +#include #include #include #include @@ -193,6 +195,8 @@ struct ltchars { #include #include #include +#include +#include #include #include #include @@ -514,6 +518,7 @@ ccflags="$@" $2 ~ /^CP_/ || $2 ~ /^CPUSTATES$/ || $2 ~ /^ALG_/ || + $2 ~ /^FI(CLONE|DEDUPERANGE)/ || $2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ || $2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|[GS]ETFLAGS)/ || $2 ~ /^FS_VERITY_/ || @@ -523,7 +528,7 @@ ccflags="$@" $2 ~ /^RND/ || $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ || $2 ~ /^KEYCTL_/ || - $2 ~ /^PERF_EVENT_IOC_/ || + $2 ~ /^PERF_/ || $2 ~ /^SECCOMP_MODE_/ || $2 ~ /^SPLICE_/ || $2 ~ /^SYNC_FILE_RANGE_/ || @@ -542,7 +547,7 @@ ccflags="$@" $2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ || $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ || $2 ~ /^FSOPT_/ || - $2 ~ /^WDIOC_/ || + $2 ~ /^WDIO[CFS]_/ || $2 ~ /^NFN/ || $2 ~ /^XDP_/ || $2 ~ /^RWF_/ || diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go index 7d08dae..57a0021 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go @@ -20,7 +20,7 @@ func cmsgAlignOf(salen int) int { case "aix": // There is no alignment on AIX. salign = 1 - case "darwin", "illumos", "solaris": + case "darwin", "ios", "illumos", "solaris": // NOTE: It seems like 64-bit Darwin, Illumos and Solaris // kernels still require 32-bit aligned access to network // subsystem. @@ -32,6 +32,10 @@ func cmsgAlignOf(salen int) int { if runtime.GOARCH == "arm" { salign = 8 } + // NetBSD aarch64 requires 128-bit alignment. + if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" { + salign = 16 + } } return (salen + salign - 1) & ^(salign - 1) diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 60bbe10..123536a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -18,6 +18,21 @@ import ( "unsafe" ) +const ImplementsGetwd = true + +func Getwd() (string, error) { + var buf [PathMax]byte + _, err := Getcwd(buf[0:]) + if err != nil { + return "", err + } + n := clen(buf[:]) + if n < 1 { + return "", EINVAL + } + return string(buf[:n]), nil +} + /* * Wrapped */ @@ -272,7 +287,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { if err != nil { return } - if runtime.GOOS == "darwin" && len == 0 { + if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 { // Accepted socket has no address. // This is likely due to a bug in xnu kernels, // where instead of ECONNABORTED error socket diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go index 6a15cba..b31ef03 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go @@ -10,6 +10,8 @@ import ( "unsafe" ) +const _SYS_GETDIRENTRIES64 = 344 + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // To implement this using libSystem we'd need syscall_syscallPtr for // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall @@ -20,7 +22,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { } else { p = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { return n, errnoErr(e1) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 0cf31ac..21b8092 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -13,29 +13,10 @@ package unix import ( - "errors" "syscall" "unsafe" ) -const ImplementsGetwd = true - -func Getwd() (string, error) { - buf := make([]byte, 2048) - attrs, err := getAttrList(".", attrList{CommonAttr: attrCmnFullpath}, buf, 0) - if err == nil && len(attrs) == 1 && len(attrs[0]) >= 2 { - wd := string(attrs[0]) - // Sanity check that it's an absolute path and ends - // in a null byte, which we then strip. - if wd[0] == '/' && wd[len(wd)-1] == 0 { - return wd[:len(wd)-1], nil - } - } - // If pkg/os/getwd.go gets ENOTSUP, it will fall back to the - // slow algorithm. - return "", ENOTSUP -} - // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 @@ -49,6 +30,11 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +// Some external packages rely on SYS___SYSCTL being defined to implement their +// own sysctl wrappers. Provide it here, even though direct syscalls are no +// longer supported on darwin. +const SYS___SYSCTL = 202 + // Translate "kern.hostname" to []_C_int{0,1,2,3}. func nametomib(name string) (mib []_C_int, err error) { const siz = unsafe.Sizeof(mib[0]) @@ -92,11 +78,6 @@ func direntNamlen(buf []byte) (uint64, bool) { func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } -const ( - attrBitMapCount = 5 - attrCmnFullpath = 0x08000000 -) - type attrList struct { bitmapCount uint16 _ uint16 @@ -107,54 +88,6 @@ type attrList struct { Forkattr uint32 } -func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) { - if len(attrBuf) < 4 { - return nil, errors.New("attrBuf too small") - } - attrList.bitmapCount = attrBitMapCount - - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return nil, err - } - - if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil { - return nil, err - } - size := *(*uint32)(unsafe.Pointer(&attrBuf[0])) - - // dat is the section of attrBuf that contains valid data, - // without the 4 byte length header. All attribute offsets - // are relative to dat. - dat := attrBuf - if int(size) < len(attrBuf) { - dat = dat[:size] - } - dat = dat[4:] // remove length prefix - - for i := uint32(0); int(i) < len(dat); { - header := dat[i:] - if len(header) < 8 { - return attrs, errors.New("truncated attribute header") - } - datOff := *(*int32)(unsafe.Pointer(&header[0])) - attrLen := *(*uint32)(unsafe.Pointer(&header[4])) - if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) { - return attrs, errors.New("truncated results; attrBuf too small") - } - end := uint32(datOff) + attrLen - attrs = append(attrs, dat[datOff:end]) - i = end - if r := i % 4; r != 0 { - i += (4 - r) - } - } - return -} - -//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) - //sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { @@ -396,6 +329,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chroot(path string) (err error) //sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) +//sys Clonefile(src string, dst string, flags int) (err error) +//sys Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) //sys Exchangedata(path1 string, path2 string, options int) (err error) @@ -407,10 +342,12 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) +//sys Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) +//sys Getcwd(buf []byte) (n int, err error) //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go index 2724e3a..ea0be1e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go @@ -44,10 +44,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/386 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index ce2e0d2..5862404 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -44,10 +44,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/amd64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go index fc17a3f..b8b3141 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go @@ -44,10 +44,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/arm the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index 1e91ddf..6741398 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -46,10 +46,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/arm64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 8a195ae..bed7dcf 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -129,23 +129,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { var _p0 unsafe.Pointer var bufsize uintptr diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 6932e7c..f6db02a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -140,23 +140,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { var ( _p0 unsafe.Pointer diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 99e62dc..bbc4f3e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -24,7 +24,7 @@ func bytes2iovec(bs [][]byte) []Iovec { return iovecs } -//sys readv(fd int, iovs []Iovec) (n int, err error) +//sys readv(fd int, iovs []Iovec) (n int, err error) func Readv(fd int, iovs [][]byte) (n int, err error) { iovecs := bytes2iovec(iovs) @@ -32,7 +32,7 @@ func Readv(fd int, iovs [][]byte) (n int, err error) { return n, err } -//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error) +//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error) func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) { iovecs := bytes2iovec(iovs) @@ -40,7 +40,7 @@ func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) { return n, err } -//sys writev(fd int, iovs []Iovec) (n int, err error) +//sys writev(fd int, iovs []Iovec) (n int, err error) func Writev(fd int, iovs [][]byte) (n int, err error) { iovecs := bytes2iovec(iovs) @@ -48,10 +48,43 @@ func Writev(fd int, iovs [][]byte) (n int, err error) { return n, err } -//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error) +//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error) func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) { iovecs := bytes2iovec(iovs) n, err = pwritev(fd, iovecs, off) return n, err } + +//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) = libsocket.accept4 + +func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + nfd, err = accept4(fd, &rsa, &len, flags) + if err != nil { + return + } + if len > SizeofSockaddrAny { + panic("RawSockaddrAny too small") + } + sa, err = anyToSockaddr(fd, &rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} + +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index c48f5dd..84a9e52 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -82,15 +82,6 @@ func IoctlRetInt(fd int, req uint) (int, error) { return int(ret), nil } -// IoctlSetPointerInt performs an ioctl operation which sets an -// integer value on fd, using the specified request number. The ioctl -// argument is called with a pointer to the integer value, rather than -// passing the integer value directly. -func IoctlSetPointerInt(fd int, req uint, value int) error { - v := int32(value) - return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) -} - func IoctlSetRTCTime(fd int, value *RTCTime) error { err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) runtime.KeepAlive(value) @@ -115,12 +106,53 @@ func IoctlGetRTCTime(fd int) (*RTCTime, error) { return &value, err } +// IoctlGetWatchdogInfo fetches information about a watchdog device from the +// Linux watchdog API. For more information, see: +// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. +func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) { + var value WatchdogInfo + err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value))) + return &value, err +} + func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) { var value RTCWkAlrm err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value))) return &value, err } +// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the +// range of data conveyed in value to the file associated with the file +// descriptor destFd. See the ioctl_ficlonerange(2) man page for details. +func IoctlFileCloneRange(destFd int, value *FileCloneRange) error { + err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value))) + runtime.KeepAlive(value) + return err +} + +// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file +// associated with the file description srcFd to the file associated with the +// file descriptor destFd. See the ioctl_ficlone(2) man page for details. +func IoctlFileClone(destFd, srcFd int) error { + return ioctl(destFd, FICLONE, uintptr(srcFd)) +} + +// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the +// range of data conveyed in value with the file associated with the file +// descriptor destFd. See the ioctl_fideduperange(2) man page for details. +func IoctlFileDedupeRange(destFd int, value *FileDedupeRange) error { + err := ioctl(destFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(value))) + runtime.KeepAlive(value) + return err +} + +// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For +// more information, see: +// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. +func IoctlWatchdogKeepalive(fd int) error { + return ioctl(fd, WDIOC_KEEPALIVE, 0) +} + //sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) func Link(oldpath string, newpath string) (err error) { @@ -145,6 +177,12 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) return openat(dirfd, path, flags|O_LARGEFILE, mode) } +//sys openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) + +func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) { + return openat2(dirfd, path, how, SizeofOpenHow) +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { @@ -1111,6 +1149,21 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } return sa, nil + case AF_CAN: + pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa)) + sa := &SockaddrCAN{ + Ifindex: int(pp.Ifindex), + } + rx := (*[4]byte)(unsafe.Pointer(&sa.RxID)) + for i := 0; i < 4; i++ { + rx[i] = pp.Addr[i] + } + tx := (*[4]byte)(unsafe.Pointer(&sa.TxID)) + for i := 0; i < 4; i++ { + tx[i] = pp.Addr[i+4] + } + return sa, nil + } return nil, EAFNOSUPPORT } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index e1913e2..496837b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -7,7 +7,6 @@ package unix import ( - "syscall" "unsafe" ) @@ -49,10 +48,6 @@ func Pipe2(p []int, flags int) (err error) { return } -// Underlying system call writes to newoffset via pointer. -// Implemented in assembly to avoid allocation. -func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { newoffset, errno := seek(fd, offset, whence) if errno != 0 { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go new file mode 100644 index 0000000..8c514c9 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go @@ -0,0 +1,13 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build arm,!gccgo,linux + +package unix + +import "syscall" + +// Underlying system call writes to newoffset via pointer. +// Implemented in assembly to avoid allocation. +func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 45b50a6..dbd5e03 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -141,23 +141,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - // TODO func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { return -1, ENOSYS diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index a266e92..2c1f46e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -114,23 +114,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go new file mode 100644 index 0000000..30f2853 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go @@ -0,0 +1,35 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package unix + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions +// of OpenBSD the syscall is called sysctl instead of __sysctl. +const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 0e2a696..fee6e99 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -13,6 +13,7 @@ package unix import ( + "runtime" "syscall" "unsafe" ) @@ -553,8 +554,10 @@ func Minor(dev uint64) uint32 { //sys ioctl(fd int, req uint, arg uintptr) (err error) -func IoctlSetTermio(fd int, req uint, value *Termio) (err error) { - return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +func IoctlSetTermio(fd int, req uint, value *Termio) error { + err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) + runtime.KeepAlive(value) + return err } func IoctlGetTermio(fd int, req uint) (*Termio, error) { diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go index 6217cdb..6f33359 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go @@ -232,6 +232,8 @@ const ( CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index e3ff2ee..db767eb 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -232,6 +232,8 @@ const ( CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go index 3e41757..ddc5d00 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go @@ -232,6 +232,8 @@ const ( CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index cbd8ed1..0614d26 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -232,6 +232,8 @@ const ( CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index 6130471..f5e91b7 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -62,6 +62,7 @@ const ( B28800 = 0x7080 B300 = 0x12c B38400 = 0x9600 + B460800 = 0x70800 B4800 = 0x12c0 B50 = 0x32 B57600 = 0xe100 @@ -69,12 +70,15 @@ const ( B7200 = 0x1c20 B75 = 0x4b B76800 = 0x12c00 + B921600 = 0xe1000 B9600 = 0x2580 + BIOCFEEDBACK = 0x8004427d BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 BIOCGDLT = 0x4004426a BIOCGDLTLIST = 0xc0104279 BIOCGETIF = 0x4020426b + BIOCGFEEDBACK = 0x4004427c BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044272 BIOCGRTIMEOUT = 0x4010426e @@ -88,6 +92,7 @@ const ( BIOCSETF = 0x80104267 BIOCSETIF = 0x8020426c BIOCSETWF = 0x8010427b + BIOCSFEEDBACK = 0x8004427d BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 BIOCSRTIMEOUT = 0x8010426d @@ -125,6 +130,7 @@ const ( BPF_MINBUFSIZE = 0x20 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 + BPF_MOD = 0x90 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 @@ -139,6 +145,7 @@ const ( BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XOR = 0xa0 BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 @@ -156,6 +163,12 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -175,6 +188,7 @@ const ( DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 DLT_ARCNET_LINUX = 0x81 @@ -184,22 +198,33 @@ const ( DLT_AX25 = 0x3 DLT_AX25_KISS = 0xca DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_BREDR_BB = 0xff DLT_BLUETOOTH_HCI_H4 = 0xbb DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_BLUETOOTH_LE_LL = 0xfb + DLT_BLUETOOTH_LE_LL_WITH_PHDR = 0x100 + DLT_BLUETOOTH_LINUX_MONITOR = 0xfe DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CHDLC = 0x68 DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 DLT_ENC = 0x6d + DLT_EPON = 0x103 DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa DLT_FLEXRAY = 0xd2 DLT_FRELAY = 0x6b @@ -209,6 +234,8 @@ const ( DLT_GPF_F = 0xab DLT_GPF_T = 0xaa DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 DLT_HHDLC = 0x79 DLT_IBM_SN = 0x92 DLT_IBM_SP = 0x91 @@ -218,18 +245,28 @@ const ( DLT_IEEE802_11_RADIO_AVS = 0xa3 DLT_IEEE802_15_4 = 0xc3 DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 DLT_IEEE802_15_4_NONASK_PHY = 0xd7 DLT_IEEE802_16_MAC_CPS = 0xbc DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 DLT_IPMB = 0xc7 DLT_IPMB_LINUX = 0xd1 + DLT_IPMI_HPM_2 = 0x104 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 DLT_IP_OVER_FC = 0x7a + DLT_ISO_14443 = 0x108 DLT_JUNIPER_ATM1 = 0x89 DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee DLT_JUNIPER_CHDLC = 0xb5 DLT_JUNIPER_ES = 0x84 DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea DLT_JUNIPER_FRELAY = 0xb4 DLT_JUNIPER_GGSN = 0x85 DLT_JUNIPER_ISM = 0xc2 @@ -242,25 +279,40 @@ const ( DLT_JUNIPER_PPPOE = 0xa7 DLT_JUNIPER_PPPOE_ATM = 0xa8 DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 DLT_JUNIPER_ST = 0xc8 DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 DLT_LAPB_WITH_DIR = 0xcf DLT_LAPD = 0xcb DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 DLT_LINUX_IRDA = 0x90 DLT_LINUX_LAPD = 0xb1 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x109 + DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb DLT_MTP2 = 0x8c DLT_MTP2_WITH_PHDR = 0x8b DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NETLINK = 0xfd + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 DLT_NULL = 0x0 DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 + DLT_PKTAP = 0x102 DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 @@ -269,22 +321,51 @@ const ( DLT_PPP_SERIAL = 0x32 DLT_PPP_WITH_DIR = 0xcc DLT_PRISM_HEADER = 0x77 + DLT_PROFIBUS_DL = 0x101 DLT_PRONET = 0x4 DLT_RAIF1 = 0xc6 DLT_RAW = 0xc + DLT_RDS = 0x109 DLT_REDBACK_SMARTEDGE = 0x20 DLT_RIO = 0x7c + DLT_RTAC_SERIAL = 0xfa DLT_SCCP = 0x8e + DLT_SCTP = 0xf8 DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba + DLT_USBPCAP = 0xf9 + DLT_USB_FREEBSD = 0xba DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WATTSTOPPER_DLM = 0x107 + DLT_WIHART = 0xdf + DLT_WIRESHARK_UPPER_PDU = 0xfc DLT_X2E_SERIAL = 0xd5 DLT_X2E_XORAYA = 0xd6 + DLT_ZWAVE_R1_R2 = 0x105 + DLT_ZWAVE_R3 = 0x106 DT_BLK = 0x6 DT_CHR = 0x2 DT_DBF = 0xf @@ -323,10 +404,11 @@ const ( EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 + EV_HUP = 0x800 EV_NODATA = 0x1000 EV_ONESHOT = 0x10 EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTEXIT_LWP = 0x10000 @@ -365,8 +447,9 @@ const ( IFF_ALLMULTI = 0x200 IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 - IFF_CANTCHANGE = 0x118e72 + IFF_CANTCHANGE = 0x318e72 IFF_DEBUG = 0x4 + IFF_IDIRECT = 0x200000 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 IFF_LINK2 = 0x4000 @@ -441,7 +524,6 @@ const ( IFT_EPLRS = 0x57 IFT_ESCON = 0x49 IFT_ETHER = 0x6 - IFT_FAITH = 0xf2 IFT_FAST = 0x7d IFT_FASTETHER = 0x3e IFT_FASTETHERFX = 0x45 @@ -614,6 +696,7 @@ const ( IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LOOPBACKNET = 0x7f + IN_RFC3021_MASK = 0xfffffffe IPPROTO_3PC = 0x22 IPPROTO_ADFS = 0x44 IPPROTO_AH = 0x33 @@ -735,7 +818,6 @@ const ( IPV6_DEFHLIM = 0x40 IPV6_DONTFRAG = 0x3e IPV6_DSTOPTS = 0x32 - IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FRAGTTL = 0x78 @@ -747,7 +829,6 @@ const ( IPV6_HLIMDEC = 0x1 IPV6_HOPLIMIT = 0x2f IPV6_HOPOPTS = 0x31 - IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff @@ -795,16 +876,22 @@ const ( IP_DUMMYNET_DEL = 0x3d IP_DUMMYNET_FLUSH = 0x3e IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 IP_FW_ADD = 0x32 IP_FW_DEL = 0x33 IP_FW_FLUSH = 0x34 IP_FW_GET = 0x36 IP_FW_RESETLOG = 0x37 + IP_FW_TBL_ADD = 0x2a + IP_FW_TBL_CREATE = 0x28 + IP_FW_TBL_DEL = 0x2b + IP_FW_TBL_DESTROY = 0x29 + IP_FW_TBL_EXPIRE = 0x2f + IP_FW_TBL_FLUSH = 0x2c + IP_FW_TBL_GET = 0x2d + IP_FW_TBL_ZERO = 0x2e IP_FW_X = 0x31 IP_FW_ZERO = 0x35 IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 IP_MAXPACKET = 0xffff IP_MAX_MEMBERSHIPS = 0x14 IP_MF = 0x2000 @@ -1080,12 +1167,10 @@ const ( RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_NEWMADDR = 0xf - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x6 + RTM_VERSION = 0x7 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_IWCAPSEGS = 0x400 @@ -1106,13 +1191,13 @@ const ( SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 - SIOCADDRT = 0x8040720a SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 SIOCALIFADDR = 0x8118691b SIOCATMARK = 0x40047307 SIOCDELMULTI = 0x80206932 - SIOCDELRT = 0x8040720b SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 SIOCDIFPHYADDR = 0x80206949 SIOCDLIFADDR = 0x8118691d SIOCGDRVSPEC = 0xc028697b @@ -1120,6 +1205,7 @@ const ( SIOCGETVIFCNT = 0xc028720f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc0406929 SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0106924 @@ -1128,6 +1214,7 @@ const ( SIOCGIFFLAGS = 0xc0206911 SIOCGIFGENERIC = 0xc020693a SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 SIOCGIFINDEX = 0xc0206920 SIOCGIFMEDIA = 0xc0306938 SIOCGIFMETRIC = 0xc0206917 @@ -1194,6 +1281,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x2000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_SNDBUF = 0x1001 @@ -1233,6 +1321,9 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 + TAB0 = 0x0 + TAB3 = 0x4 + TABDLY = 0x4 TCIFLUSH = 0x1 TCIOFF = 0x3 TCIOFLUSH = 0x3 @@ -1259,6 +1350,8 @@ const ( TCP_NOPUSH = 0x4 TCP_SIGNATURE_ENABLE = 0x10 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 @@ -1272,7 +1365,6 @@ const ( TIOCGETD = 0x4004741a TIOCGPGRP = 0x40047477 TIOCGSID = 0x40047463 - TIOCGSIZE = 0x40087468 TIOCGWINSZ = 0x40087468 TIOCISPTMASTER = 0x20007455 TIOCMBIC = 0x8004746b @@ -1317,7 +1409,6 @@ const ( TIOCSETD = 0x8004741b TIOCSIG = 0x2000745f TIOCSPGRP = 0x80047476 - TIOCSSIZE = 0x80087467 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 TIOCSTI = 0x80017472 @@ -1326,6 +1417,8 @@ const ( TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 + UTIME_NOW = -0x1 + UTIME_OMIT = -0x2 VCHECKPT = 0x13 VDISCARD = 0xf VDSUSP = 0xb @@ -1350,9 +1443,12 @@ const ( VWERASE = 0x4 WCONTINUED = 0x4 WCOREFLAG = 0x80 + WEXITED = 0x10 WLINUXCLONE = 0x80000000 WNOHANG = 0x1 - WSTOPPED = 0x7f + WNOWAIT = 0x8 + WSTOPPED = 0x2 + WTRAPPED = 0x20 WUNTRACED = 0x2 ) @@ -1452,11 +1548,6 @@ const ( ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) - EUNUSED94 = syscall.Errno(0x5e) - EUNUSED95 = syscall.Errno(0x5f) - EUNUSED96 = syscall.Errno(0x60) - EUNUSED97 = syscall.Errno(0x61) - EUNUSED98 = syscall.Errno(0x62) EUSERS = syscall.Errno(0x44) EWOULDBLOCK = syscall.Errno(0x23) EXDEV = syscall.Errno(0x12) @@ -1600,12 +1691,7 @@ var errorList = [...]struct { {91, "ENOLINK", "link has been severed"}, {92, "EPROTO", "protocol error"}, {93, "ENOMEDIUM", "no medium found"}, - {94, "EUNUSED94", "unknown error: 94"}, - {95, "EUNUSED95", "unknown error: 95"}, - {96, "EUNUSED96", "unknown error: 96"}, - {97, "EUNUSED97", "unknown error: 97"}, - {98, "EUNUSED98", "unknown error: 98"}, - {99, "ELAST", "unknown error: 99"}, + {99, "EASYNC", "unknown error: 99"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index e80d4e9..6232b2e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -244,8 +244,66 @@ const ( CAN_EFF_FLAG = 0x80000000 CAN_EFF_ID_BITS = 0x1d CAN_EFF_MASK = 0x1fffffff + CAN_ERR_ACK = 0x20 + CAN_ERR_BUSERROR = 0x80 + CAN_ERR_BUSOFF = 0x40 + CAN_ERR_CRTL = 0x4 + CAN_ERR_CRTL_ACTIVE = 0x40 + CAN_ERR_CRTL_RX_OVERFLOW = 0x1 + CAN_ERR_CRTL_RX_PASSIVE = 0x10 + CAN_ERR_CRTL_RX_WARNING = 0x4 + CAN_ERR_CRTL_TX_OVERFLOW = 0x2 + CAN_ERR_CRTL_TX_PASSIVE = 0x20 + CAN_ERR_CRTL_TX_WARNING = 0x8 + CAN_ERR_CRTL_UNSPEC = 0x0 + CAN_ERR_DLC = 0x8 CAN_ERR_FLAG = 0x20000000 + CAN_ERR_LOSTARB = 0x2 + CAN_ERR_LOSTARB_UNSPEC = 0x0 CAN_ERR_MASK = 0x1fffffff + CAN_ERR_PROT = 0x8 + CAN_ERR_PROT_ACTIVE = 0x40 + CAN_ERR_PROT_BIT = 0x1 + CAN_ERR_PROT_BIT0 = 0x8 + CAN_ERR_PROT_BIT1 = 0x10 + CAN_ERR_PROT_FORM = 0x2 + CAN_ERR_PROT_LOC_ACK = 0x19 + CAN_ERR_PROT_LOC_ACK_DEL = 0x1b + CAN_ERR_PROT_LOC_CRC_DEL = 0x18 + CAN_ERR_PROT_LOC_CRC_SEQ = 0x8 + CAN_ERR_PROT_LOC_DATA = 0xa + CAN_ERR_PROT_LOC_DLC = 0xb + CAN_ERR_PROT_LOC_EOF = 0x1a + CAN_ERR_PROT_LOC_ID04_00 = 0xe + CAN_ERR_PROT_LOC_ID12_05 = 0xf + CAN_ERR_PROT_LOC_ID17_13 = 0x7 + CAN_ERR_PROT_LOC_ID20_18 = 0x6 + CAN_ERR_PROT_LOC_ID28_21 = 0x2 + CAN_ERR_PROT_LOC_IDE = 0x5 + CAN_ERR_PROT_LOC_INTERM = 0x12 + CAN_ERR_PROT_LOC_RES0 = 0x9 + CAN_ERR_PROT_LOC_RES1 = 0xd + CAN_ERR_PROT_LOC_RTR = 0xc + CAN_ERR_PROT_LOC_SOF = 0x3 + CAN_ERR_PROT_LOC_SRTR = 0x4 + CAN_ERR_PROT_LOC_UNSPEC = 0x0 + CAN_ERR_PROT_OVERLOAD = 0x20 + CAN_ERR_PROT_STUFF = 0x4 + CAN_ERR_PROT_TX = 0x80 + CAN_ERR_PROT_UNSPEC = 0x0 + CAN_ERR_RESTARTED = 0x100 + CAN_ERR_TRX = 0x10 + CAN_ERR_TRX_CANH_NO_WIRE = 0x4 + CAN_ERR_TRX_CANH_SHORT_TO_BAT = 0x5 + CAN_ERR_TRX_CANH_SHORT_TO_GND = 0x7 + CAN_ERR_TRX_CANH_SHORT_TO_VCC = 0x6 + CAN_ERR_TRX_CANL_NO_WIRE = 0x40 + CAN_ERR_TRX_CANL_SHORT_TO_BAT = 0x50 + CAN_ERR_TRX_CANL_SHORT_TO_CANH = 0x80 + CAN_ERR_TRX_CANL_SHORT_TO_GND = 0x70 + CAN_ERR_TRX_CANL_SHORT_TO_VCC = 0x60 + CAN_ERR_TRX_UNSPEC = 0x0 + CAN_ERR_TX_TIMEOUT = 0x1 CAN_INV_FILTER = 0x20000000 CAN_ISOTP = 0x6 CAN_J1939 = 0x7 @@ -628,6 +686,7 @@ const ( FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 + FIDEDUPERANGE = 0xc0189436 FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8 FSCRYPT_KEY_DESC_PREFIX = "fscrypt:" FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8 @@ -1449,6 +1508,92 @@ const ( PARITY_DEFAULT = 0x0 PARITY_NONE = 0x1 PARMRK = 0x8 + PERF_ATTR_SIZE_VER0 = 0x40 + PERF_ATTR_SIZE_VER1 = 0x48 + PERF_ATTR_SIZE_VER2 = 0x50 + PERF_ATTR_SIZE_VER3 = 0x60 + PERF_ATTR_SIZE_VER4 = 0x68 + PERF_ATTR_SIZE_VER5 = 0x70 + PERF_ATTR_SIZE_VER6 = 0x78 + PERF_AUX_FLAG_COLLISION = 0x8 + PERF_AUX_FLAG_OVERWRITE = 0x2 + PERF_AUX_FLAG_PARTIAL = 0x4 + PERF_AUX_FLAG_TRUNCATED = 0x1 + PERF_FLAG_FD_CLOEXEC = 0x8 + PERF_FLAG_FD_NO_GROUP = 0x1 + PERF_FLAG_FD_OUTPUT = 0x2 + PERF_FLAG_PID_CGROUP = 0x4 + PERF_MAX_CONTEXTS_PER_STACK = 0x8 + PERF_MAX_STACK_DEPTH = 0x7f + PERF_MEM_LOCK_LOCKED = 0x2 + PERF_MEM_LOCK_NA = 0x1 + PERF_MEM_LOCK_SHIFT = 0x18 + PERF_MEM_LVLNUM_ANY_CACHE = 0xb + PERF_MEM_LVLNUM_L1 = 0x1 + PERF_MEM_LVLNUM_L2 = 0x2 + PERF_MEM_LVLNUM_L3 = 0x3 + PERF_MEM_LVLNUM_L4 = 0x4 + PERF_MEM_LVLNUM_LFB = 0xc + PERF_MEM_LVLNUM_NA = 0xf + PERF_MEM_LVLNUM_PMEM = 0xe + PERF_MEM_LVLNUM_RAM = 0xd + PERF_MEM_LVLNUM_SHIFT = 0x21 + PERF_MEM_LVL_HIT = 0x2 + PERF_MEM_LVL_IO = 0x1000 + PERF_MEM_LVL_L1 = 0x8 + PERF_MEM_LVL_L2 = 0x20 + PERF_MEM_LVL_L3 = 0x40 + PERF_MEM_LVL_LFB = 0x10 + PERF_MEM_LVL_LOC_RAM = 0x80 + PERF_MEM_LVL_MISS = 0x4 + PERF_MEM_LVL_NA = 0x1 + PERF_MEM_LVL_REM_CCE1 = 0x400 + PERF_MEM_LVL_REM_CCE2 = 0x800 + PERF_MEM_LVL_REM_RAM1 = 0x100 + PERF_MEM_LVL_REM_RAM2 = 0x200 + PERF_MEM_LVL_SHIFT = 0x5 + PERF_MEM_LVL_UNC = 0x2000 + PERF_MEM_OP_EXEC = 0x10 + PERF_MEM_OP_LOAD = 0x2 + PERF_MEM_OP_NA = 0x1 + PERF_MEM_OP_PFETCH = 0x8 + PERF_MEM_OP_SHIFT = 0x0 + PERF_MEM_OP_STORE = 0x4 + PERF_MEM_REMOTE_REMOTE = 0x1 + PERF_MEM_REMOTE_SHIFT = 0x25 + PERF_MEM_SNOOPX_FWD = 0x1 + PERF_MEM_SNOOPX_SHIFT = 0x25 + PERF_MEM_SNOOP_HIT = 0x4 + PERF_MEM_SNOOP_HITM = 0x10 + PERF_MEM_SNOOP_MISS = 0x8 + PERF_MEM_SNOOP_NA = 0x1 + PERF_MEM_SNOOP_NONE = 0x2 + PERF_MEM_SNOOP_SHIFT = 0x13 + PERF_MEM_TLB_HIT = 0x2 + PERF_MEM_TLB_L1 = 0x8 + PERF_MEM_TLB_L2 = 0x10 + PERF_MEM_TLB_MISS = 0x4 + PERF_MEM_TLB_NA = 0x1 + PERF_MEM_TLB_OS = 0x40 + PERF_MEM_TLB_SHIFT = 0x1a + PERF_MEM_TLB_WK = 0x20 + PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER = 0x1 + PERF_RECORD_MISC_COMM_EXEC = 0x2000 + PERF_RECORD_MISC_CPUMODE_MASK = 0x7 + PERF_RECORD_MISC_CPUMODE_UNKNOWN = 0x0 + PERF_RECORD_MISC_EXACT_IP = 0x4000 + PERF_RECORD_MISC_EXT_RESERVED = 0x8000 + PERF_RECORD_MISC_FORK_EXEC = 0x2000 + PERF_RECORD_MISC_GUEST_KERNEL = 0x4 + PERF_RECORD_MISC_GUEST_USER = 0x5 + PERF_RECORD_MISC_HYPERVISOR = 0x3 + PERF_RECORD_MISC_KERNEL = 0x1 + PERF_RECORD_MISC_MMAP_DATA = 0x2000 + PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT = 0x1000 + PERF_RECORD_MISC_SWITCH_OUT = 0x2000 + PERF_RECORD_MISC_SWITCH_OUT_PREEMPT = 0x4000 + PERF_RECORD_MISC_USER = 0x2 + PERF_SAMPLE_BRANCH_PLM_ALL = 0x7 PIPEFS_MAGIC = 0x50495045 PPC_CMM_MAGIC = 0xc7571590 PPPIOCGNPMODE = 0xc008744c @@ -1985,6 +2130,7 @@ const ( SOL_ATM = 0x108 SOL_CAIF = 0x116 SOL_CAN_BASE = 0x64 + SOL_CAN_RAW = 0x65 SOL_DCCP = 0x10d SOL_DECNET = 0x105 SOL_ICMPV6 = 0x3a @@ -2297,6 +2443,23 @@ const ( WCONTINUED = 0x8 WDIOC_SETPRETIMEOUT = 0xc0045708 WDIOC_SETTIMEOUT = 0xc0045706 + WDIOF_ALARMONLY = 0x400 + WDIOF_CARDRESET = 0x20 + WDIOF_EXTERN1 = 0x4 + WDIOF_EXTERN2 = 0x8 + WDIOF_FANFAULT = 0x2 + WDIOF_KEEPALIVEPING = 0x8000 + WDIOF_MAGICCLOSE = 0x100 + WDIOF_OVERHEAT = 0x1 + WDIOF_POWEROVER = 0x40 + WDIOF_POWERUNDER = 0x10 + WDIOF_PRETIMEOUT = 0x200 + WDIOF_SETTIMEOUT = 0x80 + WDIOF_UNKNOWN = -0x1 + WDIOS_DISABLECARD = 0x1 + WDIOS_ENABLECARD = 0x2 + WDIOS_TEMPPANIC = 0x4 + WDIOS_UNKNOWN = -0x1 WEXITED = 0x4 WIN_ACKMEDIACHANGE = 0xdb WIN_CHECKPOWERMODE1 = 0xe5 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 11b25f6..dd282c0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FP_XSTATE_MAGIC2 = 0x46505845 FS_IOC_ENABLE_VERITY = 0x40806685 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index f92cff6..82fc93c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FP_XSTATE_MAGIC2 = 0x46505845 FS_IOC_ENABLE_VERITY = 0x40806685 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 12bcbf8..fe7094f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x40806685 FS_IOC_GETFLAGS = 0x80046601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 84f71e9..3b6cc58 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -73,6 +73,8 @@ const ( EXTRA_MAGIC = 0x45585401 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FPSIMD_MAGIC = 0x46508001 FS_IOC_ENABLE_VERITY = 0x40806685 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index eeadea9..ce3d9ae 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40046601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 0be6c4c..7a85215 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 0880b74..07d4cc1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index c8a6662..d4842ba 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40046601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 97aae63..941e20d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000000 FF1 = 0x4000 FFDLY = 0x4000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x800000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index b0c3b06..63d3bc5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000000 FF1 = 0x4000 FFDLY = 0x4000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x800000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 0c05181..490bee1 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x40806685 FS_IOC_GETFLAGS = 0x80086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 0b96bd4..467b821 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -71,6 +71,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x40806685 FS_IOC_GETFLAGS = 0x80086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index bd5c305..79fbafb 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -75,6 +75,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go new file mode 100644 index 0000000..a74639a --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -0,0 +1,1862 @@ +// mkerrors.sh -m64 +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build mips64,openbsd + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_ENCAP = 0x1c + AF_HYLINK = 0xf + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_KEY = 0x1e + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SIP = 0x1d + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ALTWERASE = 0x200 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc010427b + BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 + BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x200000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 + CREAD = 0x800 + CRTSCTS = 0x10000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0xff + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DIOCADDQUEUE = 0xc110445d + DIOCADDRULE = 0xcd604404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcd60441a + DIOCCLRIFFLAG = 0xc028445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0e04412 + DIOCCLRSTATUS = 0xc0284416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1204460 + DIOCGETQUEUE = 0xc110445f + DIOCGETQUEUES = 0xc110445e + DIOCGETRULE = 0xcd604407 + DIOCGETRULES = 0xcd604406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0104454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0104419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0284457 + DIOCKILLSRCNODES = 0xc080445b + DIOCKILLSTATES = 0xc0e04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f + DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc4504443 + DIOCRADDTABLES = 0xc450443d + DIOCRCLRADDRS = 0xc4504442 + DIOCRCLRASTATS = 0xc4504448 + DIOCRCLRTABLES = 0xc450443c + DIOCRCLRTSTATS = 0xc4504441 + DIOCRDELADDRS = 0xc4504444 + DIOCRDELTABLES = 0xc450443e + DIOCRGETADDRS = 0xc4504446 + DIOCRGETASTATS = 0xc4504447 + DIOCRGETTABLES = 0xc450443f + DIOCRGETTSTATS = 0xc4504440 + DIOCRINADEFINE = 0xc450444d + DIOCRSETADDRS = 0xc4504445 + DIOCRSETTFLAGS = 0xc450444a + DIOCRTSTADDRS = 0xc4504449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0284459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0284414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc0104451 + DIOCXCOMMIT = 0xc0104452 + DIOCXROLLBACK = 0xc0104453 + DLT_ARCNET = 0x7 + DLT_ATM_RFC1483 = 0xb + DLT_AX25 = 0x3 + DLT_CHAOS = 0x5 + DLT_C_HDLC = 0x68 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0xd + DLT_FDDI = 0xa + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_LOOP = 0xc + DLT_MPLS = 0xdb + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_SERIAL = 0x32 + DLT_PRONET = 0x4 + DLT_RAW = 0xe + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PAE = 0x888e + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x8 + EVFILT_TIMER = -0x7 + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xa + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETOWN = 0x5 + F_ISATTY = 0xb + F_OK = 0x0 + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_UDPLITE = 0x88 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xfffffff + IPV6_FLOWLABEL_MASK = 0xfffff + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_AUTH_LEVEL = 0x14 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 + IP_HDRINCL = 0x2 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0xfff + IP_MF = 0x2000 + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PIPEX = 0x22 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + IUCLC = 0x1000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LCNT_OVERLOAD_FLUSH = 0x6 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x0 + MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_DEFEXPORTED = 0x200 + MNT_DELEXPORT = 0x20000 + MNT_DOOMED = 0x8000000 + MNT_EXPORTANON = 0x400 + MNT_EXPORTED = 0x100 + MNT_EXRDONLY = 0x80 + MNT_FORCE = 0x80000 + MNT_LAZY = 0x3 + MNT_LOCAL = 0x1000 + MNT_NOATIME = 0x8000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 + MNT_NOSUID = 0x8 + MNT_NOWAIT = 0x2 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_ROOTFS = 0x4000 + MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 + MNT_SYNCHRONOUS = 0x2 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0x400ffff + MNT_WAIT = 0x1 + MNT_WANTRDWR = 0x2000000 + MNT_WXALLOWED = 0x800 + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 + NFDBITS = 0x20 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRUNCATE = 0x80 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OLCUC = 0x20 + ONLCR = 0x2 + ONLRET = 0x80 + ONOCR = 0x40 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x10000 + O_CREAT = 0x200 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x80 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PF_FLUSH = 0x1 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb + RTAX_BRD = 0x7 + RTAX_DNS = 0xc + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf + RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd + RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 + RTA_BRD = 0x80 + RTA_DNS = 0x1000 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_LABEL = 0x400 + RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 + RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x2000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 + RTM_ADD = 0x1 + RTM_BFD = 0x12 + RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DESYNC = 0x10 + RTM_GET = 0x4 + RTM_IFANNOUNCE = 0xf + RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 + RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x4 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0186941 + SIOCBRDGGFD = 0xc0186952 + SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0186953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0186950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0186946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80186940 + SIOCBRDGSFD = 0x80186952 + SIOCBRDGSHT = 0x80186951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80186953 + SIOCBRDGSPRI = 0x80186950 + SIOCBRDGSPROTO = 0x8018695a + SIOCBRDGSTO = 0x80186945 + SIOCBRDGSTXHC = 0x80186959 + SIOCDELLABEL = 0x80206997 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc020697e + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 + SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFDESCR = 0x80206980 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x8020697f + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 + SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SIOCSWGDPID = 0xc018695b + SIOCSWGMAXFLOW = 0xc0186960 + SIOCSWGMAXGROUP = 0xc018695d + SIOCSWSDPID = 0x8018695c + SIOCSWSPORTNO = 0xc060695f + SOCK_CLOEXEC = 0x8000 + SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NETPROC = 0x1020 + SO_OOBINLINE = 0x100 + SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RTABLE = 0x1021 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCP_MAXBURST = 0x4 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x3 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x4 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 + TCP_SACK_ENABLE = 0x8 + TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b + TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALTSIG = 0x4 + WCONTINUED = 0x8 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WUNTRACED = 0x2 + XCASE = 0x1000000 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0x23) + EALREADY = syscall.Errno(0x25) + EAUTH = syscall.Errno(0x50) + EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) + EBADRPC = syscall.Errno(0x48) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x58) + ECHILD = syscall.Errno(0xa) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0xb) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EFTYPE = syscall.Errno(0x4f) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EIDRM = syscall.Errno(0x59) + EILSEQ = syscall.Errno(0x54) + EINPROGRESS = syscall.Errno(0x24) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EIPSEC = syscall.Errno(0x52) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + ELAST = syscall.Errno(0x5f) + ELOOP = syscall.Errno(0x3e) + EMEDIUMTYPE = syscall.Errno(0x56) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + ENAMETOOLONG = syscall.Errno(0x3f) + ENEEDAUTH = syscall.Errno(0x51) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOATTR = syscall.Errno(0x53) + ENOBUFS = syscall.Errno(0x37) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOLCK = syscall.Errno(0x4d) + ENOMEDIUM = syscall.Errno(0x55) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x5a) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSYS = syscall.Errno(0x4e) + ENOTBLK = syscall.Errno(0xf) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x5b) + ENOTTY = syscall.Errno(0x19) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROCUNAVAIL = syscall.Errno(0x4c) + EPROGMISMATCH = syscall.Errno(0x4b) + EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMOTE = syscall.Errno(0x47) + EROFS = syscall.Errno(0x1e) + ERPCMISMATCH = syscall.Errno(0x49) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESTALE = syscall.Errno(0x46) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0x23) + EXDEV = syscall.Errno(0x12) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINFO = syscall.Signal(0x1d) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGPIPE = syscall.Signal(0xd) + SIGPROF = syscall.Signal(0x1b) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTHR = syscall.Signal(0x20) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "device not configured"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EDEADLK", "resource deadlock avoided"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "cross-device link"}, + {19, "ENODEV", "operation not supported by device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "result too large"}, + {35, "EAGAIN", "resource temporarily unavailable"}, + {36, "EINPROGRESS", "operation now in progress"}, + {37, "EALREADY", "operation already in progress"}, + {38, "ENOTSOCK", "socket operation on non-socket"}, + {39, "EDESTADDRREQ", "destination address required"}, + {40, "EMSGSIZE", "message too long"}, + {41, "EPROTOTYPE", "protocol wrong type for socket"}, + {42, "ENOPROTOOPT", "protocol not available"}, + {43, "EPROTONOSUPPORT", "protocol not supported"}, + {44, "ESOCKTNOSUPPORT", "socket type not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, + {46, "EPFNOSUPPORT", "protocol family not supported"}, + {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, + {48, "EADDRINUSE", "address already in use"}, + {49, "EADDRNOTAVAIL", "can't assign requested address"}, + {50, "ENETDOWN", "network is down"}, + {51, "ENETUNREACH", "network is unreachable"}, + {52, "ENETRESET", "network dropped connection on reset"}, + {53, "ECONNABORTED", "software caused connection abort"}, + {54, "ECONNRESET", "connection reset by peer"}, + {55, "ENOBUFS", "no buffer space available"}, + {56, "EISCONN", "socket is already connected"}, + {57, "ENOTCONN", "socket is not connected"}, + {58, "ESHUTDOWN", "can't send after socket shutdown"}, + {59, "ETOOMANYREFS", "too many references: can't splice"}, + {60, "ETIMEDOUT", "operation timed out"}, + {61, "ECONNREFUSED", "connection refused"}, + {62, "ELOOP", "too many levels of symbolic links"}, + {63, "ENAMETOOLONG", "file name too long"}, + {64, "EHOSTDOWN", "host is down"}, + {65, "EHOSTUNREACH", "no route to host"}, + {66, "ENOTEMPTY", "directory not empty"}, + {67, "EPROCLIM", "too many processes"}, + {68, "EUSERS", "too many users"}, + {69, "EDQUOT", "disk quota exceeded"}, + {70, "ESTALE", "stale NFS file handle"}, + {71, "EREMOTE", "too many levels of remote in path"}, + {72, "EBADRPC", "RPC struct is bad"}, + {73, "ERPCMISMATCH", "RPC version wrong"}, + {74, "EPROGUNAVAIL", "RPC program not available"}, + {75, "EPROGMISMATCH", "program version wrong"}, + {76, "EPROCUNAVAIL", "bad procedure for program"}, + {77, "ENOLCK", "no locks available"}, + {78, "ENOSYS", "function not implemented"}, + {79, "EFTYPE", "inappropriate file type or format"}, + {80, "EAUTH", "authentication error"}, + {81, "ENEEDAUTH", "need authenticator"}, + {82, "EIPSEC", "IPsec processing failure"}, + {83, "ENOATTR", "attribute not found"}, + {84, "EILSEQ", "illegal byte sequence"}, + {85, "ENOMEDIUM", "no medium found"}, + {86, "EMEDIUMTYPE", "wrong medium type"}, + {87, "EOVERFLOW", "value too large to be stored in data type"}, + {88, "ECANCELED", "operation canceled"}, + {89, "EIDRM", "identifier removed"}, + {90, "ENOMSG", "no message of desired type"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/BPT trap"}, + {6, "SIGABRT", "abort trap"}, + {7, "SIGEMT", "EMT trap"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad system call"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGURG", "urgent I/O condition"}, + {17, "SIGSTOP", "suspended (signal)"}, + {18, "SIGTSTP", "suspended"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGXCPU", "cputime limit exceeded"}, + {25, "SIGXFSZ", "filesize limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window size changes"}, + {29, "SIGINFO", "information request"}, + {30, "SIGUSR1", "user defined signal 1"}, + {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGTHR", "thread AST"}, +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go deleted file mode 100644 index 23e94d3..0000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go +++ /dev/null @@ -1,1809 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_386.1_11.go syscall_darwin_386.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go index e2ffb3b..bd13b38 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go @@ -490,21 +490,6 @@ func libc_munlockall_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe() (r int, w int, err error) { r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) r = int(r0) @@ -958,6 +943,56 @@ func libc_close_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Clonefile(src string, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefile_trampoline() + +//go:linkname libc_clonefile libc_clonefile +//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefileat_trampoline() + +//go:linkname libc_clonefileat libc_clonefileat +//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup(fd int) (nfd int, err error) { r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) nfd = int(r0) @@ -1146,6 +1181,26 @@ func libc_fchownat_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fclonefileat_trampoline() + +//go:linkname libc_fclonefileat libc_fclonefileat +//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Flock(fd int, how int) (err error) { _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1207,6 +1262,28 @@ func libc_ftruncate_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_getcwd_trampoline() + +//go:linkname libc_getcwd libc_getcwd +//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdtablesize() (size int) { r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) size = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s index 6836a41..d5fb53f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s @@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 @@ -110,6 +108,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) +TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefile(SB) +TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefileat(SB) TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 @@ -132,6 +134,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) +TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fclonefileat(SB) TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 @@ -140,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 @@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 @@ -266,8 +274,6 @@ TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go deleted file mode 100644 index 1025617..0000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go +++ /dev/null @@ -1,1809 +0,0 @@ -// go run mksyscall.go -tags darwin,amd64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.1_11.go syscall_darwin_amd64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,amd64,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index c67e336..d81696f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -490,21 +490,6 @@ func libc_munlockall_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe() (r int, w int, err error) { r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) r = int(r0) @@ -958,6 +943,56 @@ func libc_close_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Clonefile(src string, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefile_trampoline() + +//go:linkname libc_clonefile libc_clonefile +//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefileat_trampoline() + +//go:linkname libc_clonefileat libc_clonefileat +//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup(fd int) (nfd int, err error) { r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) nfd = int(r0) @@ -1146,6 +1181,26 @@ func libc_fchownat_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fclonefileat_trampoline() + +//go:linkname libc_fclonefileat libc_fclonefileat +//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Flock(fd int, how int) (err error) { _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1207,6 +1262,28 @@ func libc_ftruncate_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_getcwd_trampoline() + +//go:linkname libc_getcwd libc_getcwd +//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdtablesize() (size int) { r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) size = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index a3fdf09..887fd5f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 @@ -110,6 +108,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) +TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefile(SB) +TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefileat(SB) TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 @@ -132,6 +134,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) +TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fclonefileat(SB) TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 @@ -140,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 @@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 @@ -266,8 +274,6 @@ TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go deleted file mode 100644 index d34e6df..0000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go +++ /dev/null @@ -1,1782 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.1_11.go syscall_darwin_arm.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go index b759757..d6b5249 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go @@ -490,21 +490,6 @@ func libc_munlockall_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe() (r int, w int, err error) { r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) r = int(r0) @@ -958,6 +943,56 @@ func libc_close_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Clonefile(src string, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefile_trampoline() + +//go:linkname libc_clonefile libc_clonefile +//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefileat_trampoline() + +//go:linkname libc_clonefileat libc_clonefileat +//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup(fd int) (nfd int, err error) { r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) nfd = int(r0) @@ -1146,6 +1181,26 @@ func libc_fchownat_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fclonefileat_trampoline() + +//go:linkname libc_fclonefileat libc_fclonefileat +//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Flock(fd int, how int) (err error) { _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1207,6 +1262,28 @@ func libc_ftruncate_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_getcwd_trampoline() + +//go:linkname libc_getcwd libc_getcwd +//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdtablesize() (size int) { r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) size = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s index b67f518..5eec5f1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s @@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 @@ -110,6 +108,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) +TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefile(SB) +TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefileat(SB) TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 @@ -132,6 +134,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) +TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fclonefileat(SB) TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 @@ -140,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 @@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 @@ -264,8 +272,6 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index b288612..0863843 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -490,21 +490,6 @@ func libc_munlockall_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe() (r int, w int, err error) { r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) r = int(r0) @@ -958,6 +943,56 @@ func libc_close_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Clonefile(src string, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall(funcPC(libc_clonefile_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefile_trampoline() + +//go:linkname libc_clonefile libc_clonefile +//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_clonefileat_trampoline), uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clonefileat_trampoline() + +//go:linkname libc_clonefileat libc_clonefileat +//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup(fd int) (nfd int, err error) { r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) nfd = int(r0) @@ -1146,6 +1181,26 @@ func libc_fchownat_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(funcPC(libc_fclonefileat_trampoline), uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fclonefileat_trampoline() + +//go:linkname libc_fclonefileat libc_fclonefileat +//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Flock(fd int, how int) (err error) { _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) if e1 != 0 { @@ -1207,6 +1262,28 @@ func libc_ftruncate_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_getcwd_trampoline() + +//go:linkname libc_getcwd libc_getcwd +//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdtablesize() (size int) { r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) size = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 40cce1b..16aebee 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -60,8 +60,6 @@ TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 @@ -110,6 +108,10 @@ TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) +TEXT ·libc_clonefile_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefile(SB) +TEXT ·libc_clonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clonefileat(SB) TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 @@ -132,6 +134,8 @@ TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) +TEXT ·libc_fclonefileat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fclonefileat(SB) TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 @@ -140,6 +144,8 @@ TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 @@ -164,6 +170,8 @@ TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 @@ -264,8 +272,6 @@ TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index fe1fdd7..aebfe51 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -214,22 +214,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -439,6 +423,22 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index 92efa1d..d3af083 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -13,17 +13,23 @@ import ( //go:cgo_import_dynamic libc_preadv preadv "libc.so" //go:cgo_import_dynamic libc_writev writev "libc.so" //go:cgo_import_dynamic libc_pwritev pwritev "libc.so" +//go:cgo_import_dynamic libc_accept4 accept4 "libsocket.so" +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" //go:linkname procreadv libc_readv //go:linkname procpreadv libc_preadv //go:linkname procwritev libc_writev //go:linkname procpwritev libc_pwritev +//go:linkname procaccept4 libc_accept4 +//go:linkname procpipe2 libc_pipe2 var ( procreadv, procpreadv, procwritev, - procpwritev syscallFunc + procpwritev, + procaccept4, + procpipe2 syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -85,3 +91,24 @@ func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept4)), 4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 4eec7a7..2fbbbe5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -83,6 +83,22 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_OPENAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(open_how)), uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go similarity index 86% rename from vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go rename to vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index 8d39a09..ec6bd5b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1,7 +1,7 @@ -// go run mksyscall.go -tags darwin,arm64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.1_11.go syscall_darwin_arm64.go +// go run mksyscall.go -openbsd -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build darwin,arm64,!go1.12 +// +build openbsd,mips64 package unix @@ -350,8 +350,8 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } @@ -360,10 +360,15 @@ func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } @@ -372,163 +377,15 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) + r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } @@ -554,7 +411,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } @@ -563,8 +420,9 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) +func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } @@ -704,18 +562,8 @@ func Dup2(from int, to int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) +func Dup3(from int, to int, flags int) (err error) { + _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } @@ -837,6 +685,41 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { @@ -848,7 +731,7 @@ func Fsync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) if e1 != 0 { err = errnoErr(e1) } @@ -857,14 +740,6 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getegid() (egid int) { r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) @@ -945,6 +820,17 @@ func Getrlimit(which int, lim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getrtable() (rtable int, err error) { + r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + rtable = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { @@ -966,8 +852,8 @@ func Getsid(pid int) (sid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -985,13 +871,23 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) @@ -1068,6 +964,21 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1113,6 +1024,21 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1128,6 +1054,31 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1183,7 +1134,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1200,7 +1151,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1342,7 +1293,7 @@ func Rmdir(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1364,7 +1315,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1428,16 +1379,6 @@ func Setpriority(which int, who int, prio int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { @@ -1458,6 +1399,26 @@ func Setreuid(ruid int, euid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { @@ -1468,6 +1429,16 @@ func Setrlimit(which int, lim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Setrtable(rtable int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) @@ -1499,6 +1470,36 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1555,7 +1556,7 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) if e1 != 0 { err = errnoErr(e1) } @@ -1572,21 +1573,6 @@ func Umask(newmask int) (oldmask int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1650,7 +1636,7 @@ func write(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1692,89 +1678,13 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go new file mode 100644 index 0000000..aca34b3 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -0,0 +1,279 @@ +// go run mksysctl_openbsd.go +// Code generated by the command above; DO NOT EDIT. + +// +build mips64,openbsd + +package unix + +type mibentry struct { + ctlname string + ctloid []_C_int +} + +var sysctlMib = []mibentry{ + {"ddb.console", []_C_int{9, 6}}, + {"ddb.log", []_C_int{9, 7}}, + {"ddb.max_line", []_C_int{9, 3}}, + {"ddb.max_width", []_C_int{9, 2}}, + {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, + {"ddb.radix", []_C_int{9, 1}}, + {"ddb.tab_stop_width", []_C_int{9, 4}}, + {"ddb.trigger", []_C_int{9, 8}}, + {"fs.posix.setuid", []_C_int{3, 1, 1}}, + {"hw.allowpowerdown", []_C_int{6, 22}}, + {"hw.byteorder", []_C_int{6, 4}}, + {"hw.cpuspeed", []_C_int{6, 12}}, + {"hw.diskcount", []_C_int{6, 10}}, + {"hw.disknames", []_C_int{6, 8}}, + {"hw.diskstats", []_C_int{6, 9}}, + {"hw.machine", []_C_int{6, 1}}, + {"hw.model", []_C_int{6, 2}}, + {"hw.ncpu", []_C_int{6, 3}}, + {"hw.ncpufound", []_C_int{6, 21}}, + {"hw.ncpuonline", []_C_int{6, 25}}, + {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, + {"hw.physmem", []_C_int{6, 19}}, + {"hw.product", []_C_int{6, 15}}, + {"hw.serialno", []_C_int{6, 17}}, + {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, + {"hw.usermem", []_C_int{6, 20}}, + {"hw.uuid", []_C_int{6, 18}}, + {"hw.vendor", []_C_int{6, 14}}, + {"hw.version", []_C_int{6, 16}}, + {"kern.allowdt", []_C_int{1, 65}}, + {"kern.allowkmem", []_C_int{1, 52}}, + {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, + {"kern.boottime", []_C_int{1, 21}}, + {"kern.bufcachepercent", []_C_int{1, 72}}, + {"kern.ccpu", []_C_int{1, 45}}, + {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, + {"kern.consdev", []_C_int{1, 75}}, + {"kern.cp_time", []_C_int{1, 40}}, + {"kern.cp_time2", []_C_int{1, 71}}, + {"kern.cpustats", []_C_int{1, 85}}, + {"kern.domainname", []_C_int{1, 22}}, + {"kern.file", []_C_int{1, 73}}, + {"kern.forkstat", []_C_int{1, 42}}, + {"kern.fscale", []_C_int{1, 46}}, + {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, + {"kern.hostid", []_C_int{1, 11}}, + {"kern.hostname", []_C_int{1, 10}}, + {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, + {"kern.job_control", []_C_int{1, 19}}, + {"kern.malloc.buckets", []_C_int{1, 39, 1}}, + {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, + {"kern.maxclusters", []_C_int{1, 67}}, + {"kern.maxfiles", []_C_int{1, 7}}, + {"kern.maxlocksperuid", []_C_int{1, 70}}, + {"kern.maxpartitions", []_C_int{1, 23}}, + {"kern.maxproc", []_C_int{1, 6}}, + {"kern.maxthread", []_C_int{1, 25}}, + {"kern.maxvnodes", []_C_int{1, 5}}, + {"kern.mbstat", []_C_int{1, 59}}, + {"kern.msgbuf", []_C_int{1, 48}}, + {"kern.msgbufsize", []_C_int{1, 38}}, + {"kern.nchstats", []_C_int{1, 41}}, + {"kern.netlivelocks", []_C_int{1, 76}}, + {"kern.nfiles", []_C_int{1, 56}}, + {"kern.ngroups", []_C_int{1, 18}}, + {"kern.nosuidcoredump", []_C_int{1, 32}}, + {"kern.nprocs", []_C_int{1, 47}}, + {"kern.nselcoll", []_C_int{1, 43}}, + {"kern.nthreads", []_C_int{1, 26}}, + {"kern.numvnodes", []_C_int{1, 58}}, + {"kern.osrelease", []_C_int{1, 2}}, + {"kern.osrevision", []_C_int{1, 3}}, + {"kern.ostype", []_C_int{1, 1}}, + {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, + {"kern.pool_debug", []_C_int{1, 77}}, + {"kern.posix1version", []_C_int{1, 17}}, + {"kern.proc", []_C_int{1, 66}}, + {"kern.rawpartition", []_C_int{1, 24}}, + {"kern.saved_ids", []_C_int{1, 20}}, + {"kern.securelevel", []_C_int{1, 9}}, + {"kern.seminfo", []_C_int{1, 61}}, + {"kern.shminfo", []_C_int{1, 62}}, + {"kern.somaxconn", []_C_int{1, 28}}, + {"kern.sominconn", []_C_int{1, 29}}, + {"kern.splassert", []_C_int{1, 54}}, + {"kern.stackgap_random", []_C_int{1, 50}}, + {"kern.sysvipc_info", []_C_int{1, 51}}, + {"kern.sysvmsg", []_C_int{1, 34}}, + {"kern.sysvsem", []_C_int{1, 35}}, + {"kern.sysvshm", []_C_int{1, 36}}, + {"kern.timecounter.choice", []_C_int{1, 69, 4}}, + {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, + {"kern.timecounter.tick", []_C_int{1, 69, 1}}, + {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.timeout_stats", []_C_int{1, 87}}, + {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, + {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, + {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, + {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, + {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, + {"kern.ttycount", []_C_int{1, 57}}, + {"kern.utc_offset", []_C_int{1, 88}}, + {"kern.version", []_C_int{1, 4}}, + {"kern.watchdog.auto", []_C_int{1, 64, 2}}, + {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, + {"net.bpf.bufsize", []_C_int{4, 31, 1}}, + {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, + {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, + {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, + {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, + {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, + {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, + {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, + {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, + {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, + {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, + {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, + {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, + {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, + {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, + {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, + {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, + {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, + {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, + {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, + {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, + {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, + {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, + {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, + {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, + {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, + {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, + {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, + {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, + {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, + {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, + {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, + {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, + {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, + {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, + {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, + {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, + {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, + {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, + {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, + {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, + {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, + {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, + {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, + {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, + {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, + {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, + {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, + {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, + {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, + {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, + {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, + {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, + {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, + {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, + {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, + {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, + {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, + {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, + {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, + {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, + {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, + {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, + {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, + {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, + {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, + {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, + {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, + {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, + {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, + {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, + {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, + {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, + {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, + {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, + {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, + {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, + {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, + {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, + {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, + {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, + {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, + {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, + {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, + {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, + {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, + {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, + {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, + {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, + {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, + {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, + {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, + {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, + {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, + {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, + {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, + {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, + {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, + {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, + {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, + {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, + {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, + {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, + {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, + {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, + {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, + {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, + {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, + {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, + {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, + {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, + {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, + {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, + {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, + {"net.key.sadb_dump", []_C_int{4, 30, 1}}, + {"net.key.spd_dump", []_C_int{4, 30, 2}}, + {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, + {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, + {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, + {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, + {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, + {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, + {"net.mpls.ttl", []_C_int{4, 33, 2}}, + {"net.pflow.stats", []_C_int{4, 34, 1}}, + {"net.pipex.enable", []_C_int{4, 35, 1}}, + {"vm.anonmin", []_C_int{2, 7}}, + {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, + {"vm.maxslp", []_C_int{2, 10}}, + {"vm.nkmempages", []_C_int{2, 6}}, + {"vm.psstrings", []_C_int{2, 3}}, + {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, + {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, + {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, + {"vm.uspace", []_C_int{2, 11}}, + {"vm.uvmexp", []_C_int{2, 4}}, + {"vm.vmmeter", []_C_int{2, 1}}, + {"vm.vnodemin", []_C_int{2, 9}}, + {"vm.vtextmin", []_C_int{2, 8}}, +} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go deleted file mode 100644 index f336145..0000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go +++ /dev/null @@ -1,436 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build 386,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go deleted file mode 100644 index 654dd3d..0000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ /dev/null @@ -1,438 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build amd64,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_KQUEUE_WORKLOOP_CTL = 530 - SYS___MACH_BRIDGE_REMOTE_TIME = 531 - SYS_MAXSYSCALL = 532 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go deleted file mode 100644 index 103a72e..0000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go +++ /dev/null @@ -1,436 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go deleted file mode 100644 index 7ab2130..0000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ /dev/null @@ -1,436 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm64,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 464c9a9..9912c6e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -6,129 +6,125 @@ package unix const ( - // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void exit(int rval); } - SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } - SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int - SYS_LINK = 9 // { int link(char *path, char *link); } - SYS_UNLINK = 10 // { int unlink(char *path); } - SYS_CHDIR = 12 // { int chdir(char *path); } - SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } - SYS_CHMOD = 15 // { int chmod(char *path, int mode); } - SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int - SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } - SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } - SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } - SYS_SETUID = 23 // { int setuid(uid_t uid); } - SYS_GETUID = 24 // { uid_t getuid(void); } - SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } - SYS_ACCESS = 33 // { int access(char *path, int flags); } - SYS_CHFLAGS = 34 // { int chflags(char *path, int flags); } - SYS_FCHFLAGS = 35 // { int fchflags(int fd, int flags); } - SYS_SYNC = 36 // { int sync(void); } - SYS_KILL = 37 // { int kill(int pid, int signum); } - SYS_GETPPID = 39 // { pid_t getppid(void); } - SYS_DUP = 41 // { int dup(int fd); } - SYS_PIPE = 42 // { int pipe(void); } - SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } - SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } - SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } - SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } - SYS_REBOOT = 55 // { int reboot(int opt); } - SYS_REVOKE = 56 // { int revoke(char *path); } - SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int - SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } - SYS_VFORK = 66 // { pid_t vfork(void); } - SYS_SBRK = 69 // { int sbrk(int incr); } - SYS_SSTK = 70 // { int sstk(int incr); } - SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } - SYS_GETPGRP = 81 // { int getpgrp(void); } - SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } - SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } - SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } - SYS_DUP2 = 90 // { int dup2(int from, int to); } - SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } - SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } - SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } - SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } - SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } - SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } - SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } - SYS_RENAME = 128 // { int rename(char *from, char *to); } - SYS_FLOCK = 131 // { int flock(int fd, int how); } - SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } - SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } - SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } - SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } - SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } - SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } - SYS_GETDOMAINNAME = 162 // { int getdomainname(char *domainname, int len); } - SYS_SETDOMAINNAME = 163 // { int setdomainname(char *domainname, int len); } - SYS_UNAME = 164 // { int uname(struct utsname *name); } - SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } - SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } - SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } - SYS_SETGID = 181 // { int setgid(gid_t gid); } - SYS_SETEGID = 182 // { int setegid(gid_t egid); } - SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } - SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } - // SYS_NOSYS = 198; // { int nosys(void); } __syscall __syscall_args int + SYS_EXIT = 1 // { void exit(int rval); } + SYS_FORK = 2 // { int fork(void); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } + SYS_CLOSE = 6 // { int close(int fd); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int + // SYS_NOSYS = 8; // { int nosys(void); } __nosys nosys_args int + SYS_LINK = 9 // { int link(char *path, char *link); } + SYS_UNLINK = 10 // { int unlink(char *path); } + SYS_CHDIR = 12 // { int chdir(char *path); } + SYS_FCHDIR = 13 // { int fchdir(int fd); } + SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } + SYS_CHMOD = 15 // { int chmod(char *path, int mode); } + SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } + SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETPID = 20 // { pid_t getpid(void); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } + SYS_SETUID = 23 // { int setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t getuid(void); } + SYS_GETEUID = 25 // { uid_t geteuid(void); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } + SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } + SYS_ACCESS = 33 // { int access(char *path, int flags); } + SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } + SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } + SYS_SYNC = 36 // { int sync(void); } + SYS_KILL = 37 // { int kill(int pid, int signum); } + SYS_GETPPID = 39 // { pid_t getppid(void); } + SYS_DUP = 41 // { int dup(int fd); } + SYS_PIPE = 42 // { int pipe(void); } + SYS_GETEGID = 43 // { gid_t getegid(void); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_GETGID = 47 // { gid_t getgid(void); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, size_t namelen); } + SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } + SYS_ACCT = 51 // { int acct(char *path); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_REBOOT = 55 // { int reboot(int opt); } + SYS_REVOKE = 56 // { int revoke(char *path); } + SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } + SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_CHROOT = 61 // { int chroot(char *path); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_VFORK = 66 // { pid_t vfork(void); } + SYS_SBRK = 69 // { caddr_t sbrk(size_t incr); } + SYS_SSTK = 70 // { int sstk(size_t incr); } + SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_GETPGRP = 81 // { int getpgrp(void); } + SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SWAPON = 85 // { int swapon(char *name); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } + SYS_DUP2 = 90 // { int dup2(int from, int to); } + SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_FSYNC = 95 // { int fsync(int fd); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } + SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_LISTEN = 106 // { int listen(int s, int backlog); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } + SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } + SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } + SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } + SYS_RENAME = 128 // { int rename(char *from, char *to); } + SYS_FLOCK = 131 // { int flock(int fd, int how); } + SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } + SYS_RMDIR = 137 // { int rmdir(char *path); } + SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_SETSID = 147 // { int setsid(void); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } + SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } + SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } + SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } + SYS_SETGID = 181 // { int setgid(gid_t gid); } + SYS_SETEGID = 182 // { int setegid(gid_t egid); } + SYS_SETEUID = 183 // { int seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } + SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int + SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } SYS_LSEEK = 199 // { off_t lseek(int fd, int pad, off_t offset, int whence); } SYS_TRUNCATE = 200 // { int truncate(char *path, int pad, off_t length); } SYS_FTRUNCATE = 201 // { int ftruncate(int fd, int pad, off_t length); } @@ -161,8 +157,8 @@ const ( SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, struct iovec *iovp, u_int iovcnt, int flags, off_t offset); } - SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, struct iovec *iovp,u_int iovcnt, int flags, off_t offset); } + SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); } + SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); } SYS_FHSTATFS = 297 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } SYS_MODNEXT = 300 // { int modnext(int modid); } @@ -225,7 +221,7 @@ const ( SYS_KQUEUE = 362 // { int kqueue(void); } SYS_KEVENT = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(char *path, int flags); } + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_VARSYM_SET = 450 // { int varsym_set(int level, const char *name, const char *data); } @@ -302,7 +298,7 @@ const ( SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); } SYS_VMM_GUEST_SYNC_ADDR = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); } SYS_PROCCTL = 536 // { int procctl(idtype_t idtype, id_t id, int cmd, void *data); } - SYS_CHFLAGSAT = 537 // { int chflagsat(int fd, const char *path, int flags, int atflags);} + SYS_CHFLAGSAT = 537 // { int chflagsat(int fd, const char *path, u_long flags, int atflags);} SYS_PIPE2 = 538 // { int pipe2(int *fildes, int flags); } SYS_UTIMENSAT = 539 // { int utimensat(int fd, const char *path, const struct timespec *ts, int flags); } SYS_FUTIMENS = 540 // { int futimens(int fd, const struct timespec *ts); } @@ -312,4 +308,9 @@ const ( SYS_LWP_SETAFFINITY = 544 // { int lwp_setaffinity(pid_t pid, lwpid_t tid, const cpumask_t *mask); } SYS_LWP_GETAFFINITY = 545 // { int lwp_getaffinity(pid_t pid, lwpid_t tid, cpumask_t *mask); } SYS_LWP_CREATE2 = 546 // { int lwp_create2(struct lwp_params *params, const cpumask_t *mask); } + SYS_GETCPUCLOCKID = 547 // { int getcpuclockid(pid_t pid, lwpid_t lwp_id, clockid_t *clock_id); } + SYS_WAIT6 = 548 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } + SYS_LWP_GETNAME = 549 // { int lwp_getname(lwpid_t tid, char *name, size_t len); } + SYS_GETRANDOM = 550 // { ssize_t getrandom(void *buf, size_t len, unsigned flags); } + SYS___REALPATH = 551 // { ssize_t __realpath(const char *path, char *buf, size_t len); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go new file mode 100644 index 0000000..5c08d57 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -0,0 +1,220 @@ +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build mips64,openbsd + +package unix + +const ( + SYS_EXIT = 1 // { void sys_exit(int rval); } + SYS_FORK = 2 // { int sys_fork(void); } + SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_CLOSE = 6 // { int sys_close(int fd); } + SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } + SYS_UNLINK = 10 // { int sys_unlink(const char *path); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_CHDIR = 12 // { int sys_chdir(const char *path); } + SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break + SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETPID = 20 // { pid_t sys_getpid(void); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } + SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t sys_getuid(void); } + SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } + SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } + SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } + SYS_SYNC = 36 // { void sys_sync(void); } + SYS_MSYSCALL = 37 // { int sys_msyscall(void *addr, size_t len); } + SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } + SYS_GETPPID = 39 // { pid_t sys_getppid(void); } + SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } + SYS_DUP = 41 // { int sys_dup(int fd); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_GETEGID = 43 // { gid_t sys_getegid(void); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_GETGID = 47 // { gid_t sys_getgid(void); } + SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } + SYS_ACCT = 51 // { int sys_acct(const char *path); } + SYS_SIGPENDING = 52 // { int sys_sigpending(void); } + SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_REBOOT = 55 // { int sys_reboot(int opt); } + SYS_REVOKE = 56 // { int sys_revoke(const char *path); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } + SYS_CHROOT = 61 // { int sys_chroot(const char *path); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } + SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_VFORK = 66 // { int sys_vfork(void); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } + SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } + SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } + SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } + SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_GETPGRP = 81 // { int sys_getpgrp(void); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_FSYNC = 95 // { int sys_fsync(int fd); } + SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } + SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } + SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } + SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } + SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } + SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } + SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } + SYS___REALPATH = 115 // { int sys___realpath(const char *pathname, char *resolved); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } + SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_KILL = 122 // { int sys_kill(int pid, int signum); } + SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } + SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } + SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } + SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); } + SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } + SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } + SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } + SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_SETSID = 147 // { int sys_setsid(void); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } + SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } + SYS___TMPFD = 164 // { int sys___tmpfd(int flags); } + SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } + SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } + SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } + SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } + SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } + SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } + SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_ISSETUGID = 253 // { int sys_issetugid(void); } + SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } + SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } + SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } + SYS_PIPE = 263 // { int sys_pipe(int *fdp); } + SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_KQUEUE = 269 // { int sys_kqueue(void); } + SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } + SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } + SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } + SYS_GETRTABLE = 311 // { int sys_getrtable(void); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } + SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index 9f47b87..dd56ab8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -92,9 +92,9 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 + Fstypename [16]byte + Mntonname [1024]byte + Mntfromname [1024]byte Reserved [8]uint32 } @@ -145,6 +145,10 @@ type Dirent struct { _ [3]byte } +const ( + PathMax = 0x400 +) + type RawSockaddrInet4 struct { Len uint8 Family uint8 @@ -301,7 +305,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -344,7 +347,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -365,7 +367,6 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Refcount int32 } @@ -374,7 +375,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -396,7 +396,8 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - Filler [4]uint32 + State uint32 + Filler [3]uint32 } const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 966798a..1f82f2b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -70,7 +70,6 @@ type Stat_t struct { Uid uint32 Gid uint32 Rdev int32 - _ [4]byte Atim Timespec Mtim Timespec Ctim Timespec @@ -97,10 +96,11 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 + Fstypename [16]byte + Mntonname [1024]byte + Mntfromname [1024]byte + Flags_ext uint32 + Reserved [7]uint32 } type Flock_t struct { @@ -133,8 +133,7 @@ type Fbootstraptransfer_t struct { type Log2phys_t struct { Flags uint32 - _ [8]byte - _ [8]byte + _ [16]byte } type Fsid struct { @@ -151,6 +150,10 @@ type Dirent struct { _ [3]byte } +const ( + PathMax = 0x400 +) + type RawSockaddrInet4 struct { Len uint8 Family uint8 @@ -221,10 +224,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -309,7 +310,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -352,7 +352,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -373,7 +372,6 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Refcount int32 } @@ -382,7 +380,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -404,7 +401,8 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - Filler [4]uint32 + State uint32 + Filler [3]uint32 } const ( @@ -427,7 +425,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -452,7 +449,6 @@ type Termios struct { Cflag uint64 Lflag uint64 Cc [20]uint8 - _ [4]byte Ispeed uint64 Ospeed uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go index 4fe4c9c..3af01a4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go @@ -1,6 +1,5 @@ -// NOTE: cgo can't generate struct Stat_t and struct Statfs_t yet -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_darwin.go +// cgo -godefs types_darwin.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,darwin @@ -31,7 +30,7 @@ type Timeval struct { Usec int32 } -type Timeval32 [0]byte +type Timeval32 struct{} type Rusage struct { Utime Timeval @@ -93,9 +92,9 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 + Fstypename [16]byte + Mntonname [1024]byte + Mntfromname [1024]byte Reserved [8]uint32 } @@ -146,6 +145,10 @@ type Dirent struct { _ [3]byte } +const ( + PathMax = 0x400 +) + type RawSockaddrInet4 struct { Len uint8 Family uint8 @@ -302,7 +305,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -345,7 +347,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -366,7 +367,6 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Refcount int32 } @@ -375,7 +375,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -397,7 +396,8 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - Filler [4]uint32 + State uint32 + Filler [3]uint32 } const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 21999e4..ff43738 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -70,7 +70,6 @@ type Stat_t struct { Uid uint32 Gid uint32 Rdev int32 - _ [4]byte Atim Timespec Mtim Timespec Ctim Timespec @@ -97,10 +96,11 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 + Fstypename [16]byte + Mntonname [1024]byte + Mntfromname [1024]byte + Flags_ext uint32 + Reserved [7]uint32 } type Flock_t struct { @@ -133,8 +133,7 @@ type Fbootstraptransfer_t struct { type Log2phys_t struct { Flags uint32 - _ [8]byte - _ [8]byte + _ [16]byte } type Fsid struct { @@ -151,6 +150,10 @@ type Dirent struct { _ [3]byte } +const ( + PathMax = 0x400 +) + type RawSockaddrInet4 struct { Len uint8 Family uint8 @@ -221,10 +224,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -309,7 +310,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -352,7 +352,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -373,7 +372,6 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Refcount int32 } @@ -382,7 +380,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -404,7 +401,8 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - Filler [4]uint32 + State uint32 + Filler [3]uint32 } const ( @@ -427,7 +425,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -452,7 +449,6 @@ type Termios struct { Cflag uint64 Lflag uint64 Cc [20]uint8 - _ [4]byte Ispeed uint64 Ospeed uint64 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index 71ea1d6..c4772df 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -70,11 +70,11 @@ type Stat_t struct { Ctim Timespec Size int64 Blocks int64 - Blksize uint32 + _ uint32 Flags uint32 Gen uint32 Lspare int32 - Qspare1 int64 + Blksize int64 Qspare2 int64 } @@ -91,17 +91,15 @@ type Statfs_t struct { Owner uint32 Type int32 Flags int32 - _ [4]byte Syncwrites int64 Asyncwrites int64 - Fstypename [16]int8 - Mntonname [80]int8 + Fstypename [16]byte + Mntonname [80]byte Syncreads int64 Asyncreads int64 Spares1 int16 - Mntfromname [80]int8 + Mntfromname [80]byte Spares2 int16 - _ [4]byte Spare [2]int64 } @@ -202,10 +200,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -269,7 +265,7 @@ type FdSet struct { const ( SizeofIfMsghdr = 0xb0 SizeofIfData = 0xa0 - SizeofIfaMsghdr = 0x14 + SizeofIfaMsghdr = 0x18 SizeofIfmaMsghdr = 0x10 SizeofIfAnnounceMsghdr = 0x18 SizeofRtMsghdr = 0x98 @@ -280,10 +276,9 @@ type IfMsghdr struct { Msglen uint16 Version uint8 Type uint8 - Addrs int32 - Flags int32 Index uint16 - _ [2]byte + Flags int32 + Addrs int32 Data IfData } @@ -294,7 +289,6 @@ type IfData struct { Hdrlen uint8 Recvquota uint8 Xmitquota uint8 - _ [2]byte Mtu uint64 Metric uint64 Link_state uint64 @@ -316,24 +310,23 @@ type IfData struct { } type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Flags int32 + Addrs int32 + Addrflags int32 + Metric int32 } type IfmaMsghdr struct { Msglen uint16 Version uint8 Type uint8 - Addrs int32 - Flags int32 Index uint16 - _ [2]byte + Flags int32 + Addrs int32 } type IfAnnounceMsghdr struct { @@ -350,7 +343,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -374,7 +366,6 @@ type RtMetrics struct { Hopcount uint64 Mssopt uint16 Pad uint16 - _ [4]byte Msl uint64 Iwmaxsegs uint64 Iwcapsegs uint64 @@ -400,7 +391,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 77449a9..8d1429a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -76,6 +76,21 @@ type Fsid struct { Val [2]int32 } +type FileCloneRange struct { + Src_fd int64 + Src_offset uint64 + Src_length uint64 + Dest_offset uint64 +} + +type FileDedupeRange struct { + Src_offset uint64 + Src_length uint64 + Dest_count uint16 + Reserved1 uint16 + Reserved2 uint32 +} + type FscryptPolicy struct { Version uint8 Contents_encryption_mode uint8 @@ -752,6 +767,22 @@ const ( AT_EACCESS = 0x200 ) +type OpenHow struct { + Flags uint64 + Mode uint64 + Resolve uint64 +} + +const SizeofOpenHow = 0x18 + +const ( + RESOLVE_BENEATH = 0x8 + RESOLVE_IN_ROOT = 0x10 + RESOLVE_NO_MAGICLINKS = 0x2 + RESOLVE_NO_SYMLINKS = 0x4 + RESOLVE_NO_XDEV = 0x1 +) + type PollFd struct { Fd int32 Events int16 @@ -792,8 +823,6 @@ type SignalfdSiginfo struct { _ [28]uint8 } -const PERF_IOC_FLAG_GROUP = 0x1 - type Winsize struct { Row uint16 Col uint16 @@ -959,13 +988,13 @@ const ( ) const ( - PERF_TYPE_HARDWARE = 0x0 - PERF_TYPE_SOFTWARE = 0x1 - PERF_TYPE_TRACEPOINT = 0x2 - PERF_TYPE_HW_CACHE = 0x3 - PERF_TYPE_RAW = 0x4 - PERF_TYPE_BREAKPOINT = 0x5 - + PERF_TYPE_HARDWARE = 0x0 + PERF_TYPE_SOFTWARE = 0x1 + PERF_TYPE_TRACEPOINT = 0x2 + PERF_TYPE_HW_CACHE = 0x3 + PERF_TYPE_RAW = 0x4 + PERF_TYPE_BREAKPOINT = 0x5 + PERF_TYPE_MAX = 0x6 PERF_COUNT_HW_CPU_CYCLES = 0x0 PERF_COUNT_HW_INSTRUCTIONS = 0x1 PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -976,99 +1005,161 @@ const ( PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - - PERF_COUNT_HW_CACHE_L1D = 0x0 - PERF_COUNT_HW_CACHE_L1I = 0x1 - PERF_COUNT_HW_CACHE_LL = 0x2 - PERF_COUNT_HW_CACHE_DTLB = 0x3 - PERF_COUNT_HW_CACHE_ITLB = 0x4 - PERF_COUNT_HW_CACHE_BPU = 0x5 - PERF_COUNT_HW_CACHE_NODE = 0x6 - - PERF_COUNT_HW_CACHE_OP_READ = 0x0 - PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 - PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - - PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 - PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - - PERF_COUNT_SW_CPU_CLOCK = 0x0 - PERF_COUNT_SW_TASK_CLOCK = 0x1 - PERF_COUNT_SW_PAGE_FAULTS = 0x2 - PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 - PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 - PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 - PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 - PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 - PERF_COUNT_SW_EMULATION_FAULTS = 0x8 - PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa - - PERF_SAMPLE_IP = 0x1 - PERF_SAMPLE_TID = 0x2 - PERF_SAMPLE_TIME = 0x4 - PERF_SAMPLE_ADDR = 0x8 - PERF_SAMPLE_READ = 0x10 - PERF_SAMPLE_CALLCHAIN = 0x20 - PERF_SAMPLE_ID = 0x40 - PERF_SAMPLE_CPU = 0x80 - PERF_SAMPLE_PERIOD = 0x100 - PERF_SAMPLE_STREAM_ID = 0x200 - PERF_SAMPLE_RAW = 0x400 - PERF_SAMPLE_BRANCH_STACK = 0x800 - - PERF_SAMPLE_BRANCH_USER = 0x1 - PERF_SAMPLE_BRANCH_KERNEL = 0x2 - PERF_SAMPLE_BRANCH_HV = 0x4 - PERF_SAMPLE_BRANCH_ANY = 0x8 - PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 - PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 - PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - - PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 - PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 - PERF_FORMAT_ID = 0x4 - PERF_FORMAT_GROUP = 0x8 - - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 - - PERF_CONTEXT_HV = -0x20 - PERF_CONTEXT_KERNEL = -0x80 - PERF_CONTEXT_USER = -0x200 - - PERF_CONTEXT_GUEST = -0x800 - PERF_CONTEXT_GUEST_KERNEL = -0x880 - PERF_CONTEXT_GUEST_USER = -0xa00 - - PERF_FLAG_FD_NO_GROUP = 0x1 - PERF_FLAG_FD_OUTPUT = 0x2 - PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 + PERF_COUNT_HW_MAX = 0xa + PERF_COUNT_HW_CACHE_L1D = 0x0 + PERF_COUNT_HW_CACHE_L1I = 0x1 + PERF_COUNT_HW_CACHE_LL = 0x2 + PERF_COUNT_HW_CACHE_DTLB = 0x3 + PERF_COUNT_HW_CACHE_ITLB = 0x4 + PERF_COUNT_HW_CACHE_BPU = 0x5 + PERF_COUNT_HW_CACHE_NODE = 0x6 + PERF_COUNT_HW_CACHE_MAX = 0x7 + PERF_COUNT_HW_CACHE_OP_READ = 0x0 + PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + PERF_COUNT_HW_CACHE_OP_MAX = 0x3 + PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + PERF_COUNT_HW_CACHE_RESULT_MAX = 0x2 + PERF_COUNT_SW_CPU_CLOCK = 0x0 + PERF_COUNT_SW_TASK_CLOCK = 0x1 + PERF_COUNT_SW_PAGE_FAULTS = 0x2 + PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + PERF_COUNT_SW_DUMMY = 0x9 + PERF_COUNT_SW_BPF_OUTPUT = 0xa + PERF_COUNT_SW_MAX = 0xb + PERF_SAMPLE_IP = 0x1 + PERF_SAMPLE_TID = 0x2 + PERF_SAMPLE_TIME = 0x4 + PERF_SAMPLE_ADDR = 0x8 + PERF_SAMPLE_READ = 0x10 + PERF_SAMPLE_CALLCHAIN = 0x20 + PERF_SAMPLE_ID = 0x40 + PERF_SAMPLE_CPU = 0x80 + PERF_SAMPLE_PERIOD = 0x100 + PERF_SAMPLE_STREAM_ID = 0x200 + PERF_SAMPLE_RAW = 0x400 + PERF_SAMPLE_BRANCH_STACK = 0x800 + PERF_SAMPLE_REGS_USER = 0x1000 + PERF_SAMPLE_STACK_USER = 0x2000 + PERF_SAMPLE_WEIGHT = 0x4000 + PERF_SAMPLE_DATA_SRC = 0x8000 + PERF_SAMPLE_IDENTIFIER = 0x10000 + PERF_SAMPLE_TRANSACTION = 0x20000 + PERF_SAMPLE_REGS_INTR = 0x40000 + PERF_SAMPLE_PHYS_ADDR = 0x80000 + PERF_SAMPLE_AUX = 0x100000 + PERF_SAMPLE_CGROUP = 0x200000 + PERF_SAMPLE_MAX = 0x400000 + PERF_SAMPLE_BRANCH_USER_SHIFT = 0x0 + PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 0x1 + PERF_SAMPLE_BRANCH_HV_SHIFT = 0x2 + PERF_SAMPLE_BRANCH_ANY_SHIFT = 0x3 + PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 0x4 + PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 0x5 + PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 0x6 + PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 0x7 + PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 0x8 + PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 0x9 + PERF_SAMPLE_BRANCH_COND_SHIFT = 0xa + PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 0xb + PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 0xc + PERF_SAMPLE_BRANCH_CALL_SHIFT = 0xd + PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 0xe + PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 0xf + PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 0x10 + PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 0x11 + PERF_SAMPLE_BRANCH_MAX_SHIFT = 0x12 + PERF_SAMPLE_BRANCH_USER = 0x1 + PERF_SAMPLE_BRANCH_KERNEL = 0x2 + PERF_SAMPLE_BRANCH_HV = 0x4 + PERF_SAMPLE_BRANCH_ANY = 0x8 + PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + PERF_SAMPLE_BRANCH_IN_TX = 0x100 + PERF_SAMPLE_BRANCH_NO_TX = 0x200 + PERF_SAMPLE_BRANCH_COND = 0x400 + PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + PERF_SAMPLE_BRANCH_CALL = 0x2000 + PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + PERF_SAMPLE_BRANCH_HW_INDEX = 0x20000 + PERF_SAMPLE_BRANCH_MAX = 0x40000 + PERF_BR_UNKNOWN = 0x0 + PERF_BR_COND = 0x1 + PERF_BR_UNCOND = 0x2 + PERF_BR_IND = 0x3 + PERF_BR_CALL = 0x4 + PERF_BR_IND_CALL = 0x5 + PERF_BR_RET = 0x6 + PERF_BR_SYSCALL = 0x7 + PERF_BR_SYSRET = 0x8 + PERF_BR_COND_CALL = 0x9 + PERF_BR_COND_RET = 0xa + PERF_BR_MAX = 0xb + PERF_SAMPLE_REGS_ABI_NONE = 0x0 + PERF_SAMPLE_REGS_ABI_32 = 0x1 + PERF_SAMPLE_REGS_ABI_64 = 0x2 + PERF_TXN_ELISION = 0x1 + PERF_TXN_TRANSACTION = 0x2 + PERF_TXN_SYNC = 0x4 + PERF_TXN_ASYNC = 0x8 + PERF_TXN_RETRY = 0x10 + PERF_TXN_CONFLICT = 0x20 + PERF_TXN_CAPACITY_WRITE = 0x40 + PERF_TXN_CAPACITY_READ = 0x80 + PERF_TXN_MAX = 0x100 + PERF_TXN_ABORT_MASK = -0x100000000 + PERF_TXN_ABORT_SHIFT = 0x20 + PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + PERF_FORMAT_ID = 0x4 + PERF_FORMAT_GROUP = 0x8 + PERF_FORMAT_MAX = 0x10 + PERF_IOC_FLAG_GROUP = 0x1 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 + PERF_RECORD_MMAP2 = 0xa + PERF_RECORD_AUX = 0xb + PERF_RECORD_ITRACE_START = 0xc + PERF_RECORD_LOST_SAMPLES = 0xd + PERF_RECORD_SWITCH = 0xe + PERF_RECORD_SWITCH_CPU_WIDE = 0xf + PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_KSYMBOL = 0x11 + PERF_RECORD_BPF_EVENT = 0x12 + PERF_RECORD_CGROUP = 0x13 + PERF_RECORD_MAX = 0x14 + PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0x0 + PERF_RECORD_KSYMBOL_TYPE_BPF = 0x1 + PERF_RECORD_KSYMBOL_TYPE_MAX = 0x2 + PERF_BPF_EVENT_UNKNOWN = 0x0 + PERF_BPF_EVENT_PROG_LOAD = 0x1 + PERF_BPF_EVENT_PROG_UNLOAD = 0x2 + PERF_BPF_EVENT_MAX = 0x3 + PERF_CONTEXT_HV = -0x20 + PERF_CONTEXT_KERNEL = -0x80 + PERF_CONTEXT_USER = -0x200 + PERF_CONTEXT_GUEST = -0x800 + PERF_CONTEXT_GUEST_KERNEL = -0x880 + PERF_CONTEXT_GUEST_USER = -0xa00 + PERF_CONTEXT_MAX = -0xfff ) type TCPMD5Sig struct { @@ -1745,6 +1836,21 @@ const ( NFT_NG_RANDOM = 0x1 ) +const ( + NFTA_TARGET_UNSPEC = 0x0 + NFTA_TARGET_NAME = 0x1 + NFTA_TARGET_REV = 0x2 + NFTA_TARGET_INFO = 0x3 + NFTA_MATCH_UNSPEC = 0x0 + NFTA_MATCH_NAME = 0x1 + NFTA_MATCH_REV = 0x2 + NFTA_MATCH_INFO = 0x3 + NFTA_COMPAT_UNSPEC = 0x0 + NFTA_COMPAT_NAME = 0x1 + NFTA_COMPAT_REV = 0x2 + NFTA_COMPAT_TYPE = 0x3 +) + type RTCTime struct { Sec int32 Min int32 @@ -2505,3 +2611,18 @@ const ( NHA_GROUPS = 0x9 NHA_MASTER = 0xa ) + +const ( + CAN_RAW_FILTER = 0x1 + CAN_RAW_ERR_FILTER = 0x2 + CAN_RAW_LOOPBACK = 0x3 + CAN_RAW_RECV_OWN_MSGS = 0x4 + CAN_RAW_FD_FRAMES = 0x5 + CAN_RAW_JOIN_FILTERS = 0x6 +) + +type WatchdogInfo struct { + Options uint32 + Version uint32 + Identity [32]uint8 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go new file mode 100644 index 0000000..992a1f8 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -0,0 +1,565 @@ +// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build mips64,openbsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ Timespec +} + +type Statfs_t struct { + F_flags uint32 + F_bsize uint32 + F_iosize uint32 + F_blocks uint64 + F_bfree uint64 + F_bavail int64 + F_files uint64 + F_ffree uint64 + F_favail int64 + F_syncwrites uint64 + F_syncreads uint64 + F_asyncwrites uint64 + F_asyncreads uint64 + F_fsid Fsid + F_namemax uint32 + F_owner uint32 + F_ctime uint64 + F_fstypename [16]int8 + F_mntonname [90]int8 + F_mntfromname [90]int8 + F_mntfromspec [90]int8 + _ [2]byte + Mount_info [160]byte +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + PathMax = 0x400 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [24]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x20 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte +} + +type FdSet struct { + Bits [32]uint32 +} + +const ( + SizeofIfMsghdr = 0xa8 + SizeofIfData = 0x90 + SizeofIfaMsghdr = 0x18 + SizeofIfAnnounceMsghdr = 0x1a + SizeofRtMsghdr = 0x60 + SizeofRtMetrics = 0x38 +) + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Xflags int32 + Data IfData +} + +type IfData struct { + Type uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Mtu uint32 + Metric uint32 + Rdomain uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Capabilities uint32 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Metric int32 +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + What uint16 + Name [16]int8 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Priority uint8 + Mpls uint8 + Addrs int32 + Flags int32 + Fmask int32 + Pid int32 + Seq int32 + Errno int32 + Inits uint32 + Rmx RtMetrics +} + +type RtMetrics struct { + Pksent uint64 + Expire int64 + Locks uint32 + Mtu uint32 + Refcnt uint32 + Hopcount uint32 + Recvpipe uint32 + Sendpipe uint32 + Ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Pad uint32 +} + +type Mclpool struct{} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x14 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfProgram struct { + Len uint32 + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + _ [2]byte +} + +type BpfTimeval struct { + Sec uint32 + Usec uint32 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +const ( + AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x4 + AT_SYMLINK_NOFOLLOW = 0x2 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type Sigset_t uint32 + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofUvmexp = 0x158 + +type Uvmexp struct { + Pagesize int32 + Pagemask int32 + Pageshift int32 + Npages int32 + Free int32 + Active int32 + Inactive int32 + Paging int32 + Wired int32 + Zeropages int32 + Reserve_pagedaemon int32 + Reserve_kernel int32 + Unused01 int32 + Vnodepages int32 + Vtextpages int32 + Freemin int32 + Freetarg int32 + Inactarg int32 + Wiredmax int32 + Anonmin int32 + Vtextmin int32 + Vnodemin int32 + Anonminpct int32 + Vtextminpct int32 + Vnodeminpct int32 + Nswapdev int32 + Swpages int32 + Swpginuse int32 + Swpgonly int32 + Nswget int32 + Nanon int32 + Unused05 int32 + Unused06 int32 + Faults int32 + Traps int32 + Intrs int32 + Swtch int32 + Softs int32 + Syscalls int32 + Pageins int32 + Unused07 int32 + Unused08 int32 + Pgswapin int32 + Pgswapout int32 + Forks int32 + Forks_ppwait int32 + Forks_sharevm int32 + Pga_zerohit int32 + Pga_zeromiss int32 + Unused09 int32 + Fltnoram int32 + Fltnoanon int32 + Fltnoamap int32 + Fltpgwait int32 + Fltpgrele int32 + Fltrelck int32 + Fltrelckok int32 + Fltanget int32 + Fltanretry int32 + Fltamcopy int32 + Fltnamap int32 + Fltnomap int32 + Fltlget int32 + Fltget int32 + Flt_anon int32 + Flt_acow int32 + Flt_obj int32 + Flt_prcopy int32 + Flt_przero int32 + Pdwoke int32 + Pdrevs int32 + Pdswout int32 + Pdfreed int32 + Pdscans int32 + Pdanscan int32 + Pdobscan int32 + Pdreact int32 + Pdbusy int32 + Pdpageouts int32 + Pdpending int32 + Pddeact int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 + Fpswtch int32 + Kmapent int32 +} + +const SizeofClockinfo = 0x14 + +type Clockinfo struct { + Hz int32 + Tick int32 + Tickadj int32 + Stathz int32 + Profhz int32 +} diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go index 1f7e87e..d2c2308 100644 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ b/vendor/gopkg.in/yaml.v2/apic.go @@ -86,6 +86,7 @@ func yaml_emitter_initialize(emitter *yaml_emitter_t) { raw_buffer: make([]byte, 0, output_raw_buffer_size), states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), + best_width: -1, } } diff --git a/vendor/modules.txt b/vendor/modules.txt index 91251af..fa3e69d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -15,7 +15,8 @@ github.com/go-playground/locales github.com/go-playground/locales/currency # github.com/go-playground/universal-translator v0.17.0 github.com/go-playground/universal-translator -# github.com/go-playground/validator/v10 v10.2.0 +# github.com/go-playground/validator/v10 v10.4.0 +## explicit github.com/go-playground/validator/v10 # github.com/golang-migrate/migrate/v4 v4.13.0 ## explicit @@ -28,7 +29,8 @@ github.com/golang-migrate/migrate/v4/source/file github.com/golang-migrate/migrate/v4/source/httpfs # github.com/golang/protobuf v1.4.2 github.com/golang/protobuf/proto -# github.com/hashicorp/errwrap v1.0.0 +# github.com/hashicorp/errwrap v1.1.0 +## explicit github.com/hashicorp/errwrap # github.com/hashicorp/go-multierror v1.1.0 github.com/hashicorp/go-multierror @@ -55,25 +57,35 @@ github.com/jackc/pgx/v4/internal/sanitize github.com/jackc/pgx/v4/pgxpool # github.com/jackc/puddle v1.1.2 github.com/jackc/puddle -# github.com/json-iterator/go v1.1.9 +# github.com/json-iterator/go v1.1.10 +## explicit github.com/json-iterator/go # github.com/leodido/go-urn v1.2.0 github.com/leodido/go-urn -# github.com/lib/pq v1.3.0 +# github.com/lib/pq v1.8.0 +## explicit github.com/lib/pq github.com/lib/pq/oid github.com/lib/pq/scram # github.com/mattn/go-isatty v0.0.12 github.com/mattn/go-isatty -# github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 +# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd +## explicit github.com/modern-go/concurrent -# github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 +# github.com/modern-go/reflect2 v1.0.1 +## explicit github.com/modern-go/reflect2 -# github.com/ugorji/go/codec v1.1.7 +# github.com/ugorji/go v1.1.10 +## explicit +# github.com/ugorji/go/codec v1.1.10 github.com/ugorji/go/codec -# golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 +# golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 +## explicit golang.org/x/crypto/pbkdf2 -# golang.org/x/sys v0.0.0-20200817155316-9781c653f443 +golang.org/x/crypto/sha3 +# golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 +## explicit +golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix # golang.org/x/text v0.3.3 @@ -120,5 +132,6 @@ google.golang.org/protobuf/reflect/protoreflect google.golang.org/protobuf/reflect/protoregistry google.golang.org/protobuf/runtime/protoiface google.golang.org/protobuf/runtime/protoimpl -# gopkg.in/yaml.v2 v2.2.8 +# gopkg.in/yaml.v2 v2.3.0 +## explicit gopkg.in/yaml.v2