1package cowork23import "golang.org/x/sys/unix"45// peerUID is the user of the process at the other end of a Unix6// socket, as the kernel says (SO_PEERCRED).7func peerUID(fd uintptr) (int, error) {8 c, err := unix.GetsockoptUcred(int(fd), unix.SOL_SOCKET, unix.SO_PEERCRED)9 if err != nil {10 return 0, err11 }12 return int(c.Uid), nil13}