From f0475bbcdd15fa10075990caa6821ca6e23b88b6 Mon Sep 17 00:00:00 2001 From: Patrick Boyd Date: Tue, 1 Jul 2025 17:24:16 -0500 Subject: [PATCH] unix: Implement RecvmsgAnon to not return Sockaddr --- unix/syscall_unix.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/unix/syscall_unix.go b/unix/syscall_unix.go index 4e92e5aa40..4c16ebe424 100644 --- a/unix/syscall_unix.go +++ b/unix/syscall_unix.go @@ -375,6 +375,17 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from return } +// RecvmsgAnon is like Recvmsg but does not return the sender address. +func RecvmsgAnon(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, err error) { + var iov [1]Iovec + if len(p) > 0 { + iov[0].Base = &p[0] + iov[0].SetLen(len(p)) + } + n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, nil) + return +} + // RecvmsgBuffers receives a message from a socket using the recvmsg system // call. This function is equivalent to Recvmsg, but non-control data read is // scattered into the buffers slices.