getgroups(3)

DESCRIPTION

Returns the process supplementary group list. With count zero, groups is not written and the required element count is returned; otherwise count must be at least that large.

SYNOPSIS

#include <unistd.h>

int getgroups(int count, gid_t groups[]);

RETURN VALUE

  • Returns the number of supplementary groups, or -1 and sets errno.

ERRORS

  • -EFAULT
    • Groups is not writable for the returned group list.
  • -EINVAL
    • Count is negative, greater than 16, or smaller than the stored group count.
  • -ESRCH
    • The calling process does not exist.

NOTES

The native credential store permits at most 16 supplementary groups. The returned list excludes the effective GID unless it is also present in that list.