Skip to main content

peer_groups

Function peer_groups 

Source
pub fn peer_groups(sock: impl AsFd, max: usize) -> Result<Vec<u32>>
Expand description

Returns the raw ids of the supplementary groups of the peer of the Unix socket sock. The peer must have at most max groups.

The kernel records the groups when the peer connects, or when it creates the socket pair. The list is in the order of the kernel.

ยงErrors

  • ERANGE if the peer has more than max groups.
  • ENODATA if the socket has no peer credentials, for example a listening socket.
  • ENOTSOCK if sock is not a socket, and ENOPROTOOPT if it is not a Unix socket.
  • Another Errno from getsockopt(SO_PEERGROUPS).