-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Package syscall on linux currently has behavior to look up a Ucred object, which contains the PID of the remote end of a Unix socket using getsockopt + SO_PEERCRED.
This feature request seeks to add similar behavior for darwin (and perhaps BSD). This can be done using getsockopt + LOCAL_PEERPID. Note that we can't use LOCAL_PEERCRED, as the behavior isn't identical to linux: we get a xucred struct, which doesn't contain a pid.
Open question: linux's type syscall.Ucred exposes UID, GID, and PID. These are all useful, however an exact darwin analog doesn't exist. Options:
- Conform to the linux golang API
- Add a custom golang
type syscall.Ucredtype for darwin that contains UID, GID, and PID. - Add
func syscall.GetsockoptUcred(...) (syscall.Ucred, error)for darwin that abstracts twogetsockoptsystem calls: (1)LOCAL_PEERPIDfor the pid, and (2)LOCAL_PEERCREDfor the user and group
or
- Conform to the darwin C API
- Expose darwin's
xucredstruct that contains UID and GID (type syscall.Xucred) - Add
func syscall.GetsockoptXucred(...) (syscall.Xucred, error)to look up UID and GID - Add
func syscall.GetsockoptPID(...) (int, error)to look up PID
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.