HELPLIB.HLB  —  CRTL  getgroups
    Gets the current supplementary group IDs of the calling process.

    Format

      #include  <unistd.h>

      int getgroups  (int gidsetsize, gid_t grouplist[]);

1  –  Arguments

 gidsetsize

    Indicates the number of entries that can be stored in the array
    pointed to by the grouplist parameter.

 grouplist

    Points to the array in which the supplementary group IDs of
    the process are stored. The effective group ID of the process
    is not returned by the getgroups function if it is not also a
    supplementary group ID of the calling process.

2  –  Description

    The getgroups function gets the current supplementary group IDs
    of the calling process. The list is stored in the array pointed
    to by the grouplist parameter. The gidsetsize parameter indicates
    the number of entries that can be stored in this array.

    The getgroups function never returns more IDs than the value
    indicated by the sysconf parameter _SC_NGROUPS_MAX.

    See also getgid and setsid.

3  –  Return Value

    n                  The number of elements stored in the array
                       pointed to by the grouplist parameter.
    -1                 Indicates failure. errno might be set to one
                       of the following values:

                       o  EFAULT - The gidsetsize and grouplist
                          parameters specify an array that is
                          partially or completely outside of the
                          allocated address space of the process.

                       o  EINVAL - The gidsetsize parameter is
                          nonzero and smaller than the number of
                          supplementary group IDs.
Close Help