1
0

udp_linux_64.go 884 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //go:build linux && (amd64 || arm64 || ppc64 || ppc64le || mips64 || mips64le || s390x || riscv64 || loong64) && !android && !e2e_testing
  2. // +build linux
  3. // +build amd64 arm64 ppc64 ppc64le mips64 mips64le s390x riscv64 loong64
  4. // +build !android
  5. // +build !e2e_testing
  6. package udp
  7. import (
  8. "golang.org/x/sys/unix"
  9. )
  10. type iovec struct {
  11. Base *byte
  12. Len uint64
  13. }
  14. type msghdr struct {
  15. Name *byte
  16. Namelen uint32
  17. Pad0 [4]byte
  18. Iov *iovec
  19. Iovlen uint64
  20. Control *byte
  21. Controllen uint64
  22. Flags int32
  23. Pad1 [4]byte
  24. }
  25. type rawMessage struct {
  26. Hdr msghdr
  27. Len uint32
  28. Pad0 [4]byte
  29. }
  30. func setIovLen(v *iovec, n int) {
  31. v.Len = uint64(n)
  32. }
  33. func setMsgIovlen(m *msghdr, n int) {
  34. m.Iovlen = uint64(n)
  35. }
  36. func setMsgControllen(m *msghdr, n int) {
  37. m.Controllen = uint64(n)
  38. }
  39. func setCmsgLen(h *unix.Cmsghdr, n int) {
  40. h.Len = uint64(n)
  41. }