New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/sys/unix: UnixCredentials etc. missing on FreeBSD #51711
Comments
cc @golang/runtime |
Can you write down what the API would look like on FreeBSD? Thanks. |
Something like: // generated by godefs, example for amd64
type Cmsgcred struct {
Pid int32
Uid uint32
Euid uint32
Gid uint32
Ngroups int16
Groups [16]uint32
}
const SizeofCmsgcred = // ...
func ParseUnixCredentials(scm *SocketControlMessage) (*Cmsgcred, error) Typing it out now, I'd actually omit an equivalent of |
Can we use the name And if we do that it might be worth having |
It might be slightly misleading since on FreeBSD, the |
On Linux, the definitions to pass Unix credentials over sockets via
SCM_CREDENTIALS
like Ucred are exposed and there are helper functions like UnixCredentials to convert between raw and structured representations. FreeBSD has a similar capability viaSCM_CREDS
(see its unix manpage), which is not part ofx/sys
right now. This is not POSIX-standardized as far as I can tell.At the minimum, we could include
struct cmsgcred
as part of the Go types (I'm happy to contribute here). Ideally we'd also add matching FreeBSD-implementations forUnixCredentials
andParseUnixCredentials
, though signature and semantics would be slightly different (on FreeBSD, it's recommended to pass a zeroed buffer since the kernel apparently fills the fields, while on Linux the sender can explicitly set the fields as long as it has appropriate privileges).The text was updated successfully, but these errors were encountered: