diff options
-rw-r--r-- | pkg/tcpip/link/rawfile/rawfile_unsafe.go | 6 | ||||
-rw-r--r-- | pkg/tcpip/link/rawfile/types_amd64.go | 7 | ||||
-rw-r--r-- | pkg/tcpip/link/rawfile/types_arm64.go | 7 |
3 files changed, 17 insertions, 3 deletions
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) +} |