1//go:build darwin || freebsd23package cowork45import "golang.org/x/sys/unix"67// peerUID is the user of the process at the other end of a Unix8// socket, as the kernel says (LOCAL_PEERCRED).9func peerUID(fd uintptr) (int, error) {10 c, err := unix.GetsockoptXucred(int(fd), unix.SOL_LOCAL, unix.LOCAL_PEERCRED)11 if err != nil {12 return 0, err13 }14 return int(c.Uid), nil15}