[][src]Function simple_libc::process::getgroups_raw

pub fn getgroups_raw(groups: &mut Vec<GidT>) -> Result<Int>

Low-level interface to the C getgroups() function.

This attempts to store the current list of supplementary group IDs in the provided vector. It is a very thin wrapper around C's getgroups() function, so the semantics are almost exactly the same.

Namely:

  1. If the vector is empty (length 0), it will not be modified; instead, the number of current supplementary group IDs will be returned.
  2. If the vector is long enough to hold all the current supplementary group IDs, it will be filled with the current supplementary group IDs, and the number of supplementary group IDs will be returned.
  3. If the vector is not empty and it is also not long enough to hold all the current supplementary group IDs, an error will be returned.

In most cases, the getgroups() wrapper should be preferred.