udp_linux_32.go 746 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //go:build linux && (386 || amd64p32 || arm || mips || mipsle) && !android && !e2e_testing
  2. // +build linux
  3. // +build 386 amd64p32 arm mips mipsle
  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 uint32
  13. }
  14. type msghdr struct {
  15. Name *byte
  16. Namelen uint32
  17. Iov *iovec
  18. Iovlen uint32
  19. Control *byte
  20. Controllen uint32
  21. Flags int32
  22. }
  23. type rawMessage struct {
  24. Hdr msghdr
  25. Len uint32
  26. }
  27. func setIovLen(v *iovec, n int) {
  28. v.Len = uint32(n)
  29. }
  30. func setMsgIovlen(m *msghdr, n int) {
  31. m.Iovlen = uint32(n)
  32. }
  33. func setMsgControllen(m *msghdr, n int) {
  34. m.Controllen = uint32(n)
  35. }
  36. func setCmsgLen(h *unix.Cmsghdr, n int) {
  37. h.Len = uint32(n)
  38. }