unix: add Recvmmsg for linux#276
Conversation
|
This PR (HEAD: 5269669) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/781060. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Marten Seemann: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Nick Garlis: Patch Set 3: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
This PR (HEAD: 51adbba) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/781060. Important tips:
|
|
Message from Nick Garlis: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
This PR (HEAD: 871ed2d) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/781060. Important tips:
|
|
Message from Nick Garlis: Patch Set 5: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
This PR (HEAD: 6fd57a0) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/781060. Important tips:
|
|
Message from Nikolaos Gkarlis: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Ian Lance Taylor: Patch Set 6: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Ian Lance Taylor: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Nikolaos Gkarlis: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Nikolaos Gkarlis: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
|
Message from Ian Lance Taylor: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/781060. |
Add a Recvmmsg wrapper that exposes the recvmmsg(2) system call, allowing callers to receive multiple messages from a socket in a single syscall. ps and oobs are parallel slices of per-message payload and control buffers, with vlen derived from len(ps). Each message uses a single buffer rather than a scatter-gather vector, which should be sufficient for the typical recvmmsg use case. The return values ns, oobns, recvflags, and from are parallel slices of length n (the number of messages received). This is a first step toward golang/go#45886. The wrapper is useful as-is and lets callers experiment with batch receive patterns before a poller-integrated net package API is designed.
Replace the initial Recvmmsg signature (parallel ps/oobs slices with multiple result slices) with the struct-based API discussed in golang/go#80434. RecvmmsgData holds both caller-provided input buffers (Data [][]byte for scatter/gather, OOB []byte) and per-message results (N, OOBN, Flags) written back on return. A []RecvmmsgData can be pre-allocated and reused across calls without per-call allocation. The sender address is stored directly in From RawSockaddrAny, which is zeroed before each call so struct reuse is safe; callers check From.Addr.Family != AF_UNSPEC to determine whether an address was filled in. AnyToSockaddr is exported for callers that need a parsed Sockaddr. Updates golang/go#80434
|
This PR (HEAD: f6292b0) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/781060. Important tips:
|
Add a Recvmmsg wrapper that exposes the recvmmsg(2) system call,
allowing callers to receive multiple messages from a socket in a
single syscall.
ps and oobs are parallel slices of per-message payload and control
buffers, with vlen derived from len(ps). Each message uses a single
buffer rather than a scatter-gather vector, which should be sufficient
for the typical recvmmsg use case. The return values ns, oobns,
recvflags, and from are parallel slices of length n (the number of
messages received).
The wrapper is useful as-is and lets callers experiment with batch
receive patterns before a poller-integrated net package API is
designed.
Updates golang/go#45886