From aa4d71922f2d29faa2034f75d654f2f30572eef2 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 19 Mar 2020 19:30:50 +0100 Subject: WIP fix iovec uint types on arm64 --- pkg/tcpip/link/rawfile/rawfile_unsafe.go | 6 +++--- pkg/tcpip/link/rawfile/types_amd64.go | 7 +++++++ pkg/tcpip/link/rawfile/types_arm64.go | 7 +++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 pkg/tcpip/link/rawfile/types_amd64.go create mode 100644 pkg/tcpip/link/rawfile/types_arm64.go diff --git a/pkg/tcpip/link/rawfile/rawfile_unsafe.go b/pkg/tcpip/link/rawfile/rawfile_unsafe.go index cf49ce572..ba171f9f0 100644 --- a/pkg/tcpip/link/rawfile/rawfile_unsafe.go +++ b/pkg/tcpip/link/rawfile/rawfile_unsafe.go @@ -82,11 +82,11 @@ func NonBlockingWrite3(fd int, b1, b2, b3 []byte) *tcpip.Error { iovec := [3]syscall.Iovec{ { Base: &b1[0], - Len: uint64(len(b1)), + Len: IntToSizeT(len(b1)), }, { Base: &b2[0], - Len: uint64(len(b2)), + Len: IntToSizeT(len(b2)), }, } iovecLen := uintptr(2) @@ -94,7 +94,7 @@ func NonBlockingWrite3(fd int, b1, b2, b3 []byte) *tcpip.Error { if len(b3) > 0 { iovecLen++ iovec[2].Base = &b3[0] - iovec[2].Len = uint64(len(b3)) + iovec[2].Len = IntToSizeT(len(b3)) } _, _, e := syscall.RawSyscall(syscall.SYS_WRITEV, uintptr(fd), uintptr(unsafe.Pointer(&iovec[0])), iovecLen) diff --git a/pkg/tcpip/link/rawfile/types_amd64.go b/pkg/tcpip/link/rawfile/types_amd64.go new file mode 100644 index 000000000..57ec39732 --- /dev/null +++ b/pkg/tcpip/link/rawfile/types_amd64.go @@ -0,0 +1,7 @@ +// +build amd64 + +package rawfile + +func IntToSizeT(v int) uint64 { + return uint64(v) +} diff --git a/pkg/tcpip/link/rawfile/types_arm64.go b/pkg/tcpip/link/rawfile/types_arm64.go new file mode 100644 index 000000000..54609d35f --- /dev/null +++ b/pkg/tcpip/link/rawfile/types_arm64.go @@ -0,0 +1,7 @@ +// +build arm64 + +package rawfile + +func IntToSizeT(v int) uint32 { + return uint32(v) +} -- cgit v1.2.3