Skip to content

proposal: net: ReadMsgUnix without source address #72068

Open
@pboyd04

Description

@pboyd04

Proposal Details

Problem
Currently, (*UnixConn) ReadMsgUnix() reads a message from a unix socket, and returns a *UnixAddress even when the calling code doesn't care about the source address. This allocation isn't optimized out by the compiler even when the calling code specifies _ for the return because it is referenced in some intermediate layers.

Proposed Solution
Create (*UnixConn) ReadMsgUnixIgnoreSource() that returns (n, oobn, flags int, err error) and the required underlying functions to support this so that programs that do not care about the source address don't allocate unused data on each call.

Usecase
I'm trying to optimize dbus calls which require multiple calls to ReadMsgUnix per dbus message and I am trying to support this on a limited memory (embedded) system. So any time I can save not allocating and GC'ing is an improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions