pxfgetgroups

Date:

10-20-2011

NAME

PXFGETGROUPS - Gets supplementary group IDs

SYNOPSIS

SUBROUTINE PXFGETGROUPS(igidsetsize, igrouplist, ngroups, ierror)

INTEGER igidsetsize, igrouplist(igidsetsize), ngroups, ierror

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

IEEE standard interface for FORTRAN 77

DESCRIPTION

The PXFGETGROUPS subroutine uses the getgroups(2) system call to fill igrouplist with a supplemental group list for the calling process.

As a special case, when igidsetsize is zero, PXFGETGROUPS will return the number of supplemental group IDs for the calling process in the ngroups variable, leaving the igrouplist variable unchanged.

When using the Cray Fortran compiler, all arguments must be of default kind unless documented otherwise. The default kind is KIND=8 for integer, real, complex, and logical arguments.

The following is a list of valid arguments for this routine:

igidsetsize

An input integer variable containing the size of the igrouplist integer array.

igrouplist

An output integer variable or array element that will contain a set of supplemental group IDs for the calling process. NGROUPS_MAX, found in <sys/param.h> for the UNICOS operating system, defines the maximum number of supplemental group IDs for a process.

ngroups

An output integer variable that will contain the number of supplemental group IDs for the calling process.

ierror

An output integer variable that contains zero if the variable was changed or nonzero if PXFGETGROUPS was not successful.

The PXFGETGROUPS routine may return the EINVAL error value if igidsetsize is not equal to zero and is less than the number of supplementary group IDs.

EXAMPLES

This example finds the number of supplemental group IDs for its process, prints out the number, and then retrieves the supplemental group IDs and prints each group ID.

      program pxftest
      integer igidgrouplist, igrouplist(64), ngroups, ierror, i
c     find out the number of groups
      igidgrouplist = 0
      CALL PXFGETGROUPS(igidgrouplist, igrouplist, ngroups, ierror)
      print *,'groups for process = ',ngroups,' error = ',ierror
c     call pxfgetgroups
      igidgrouplist = 64
      CALL PXFGETGROUPS(igidgrouplist, igrouplist, ngroups, ierror)
      print *,'groups for process = ',ngroups,' error = ',ierror
c     print out all groups for the process
      do i=1,ngroups
         print *,' gid = ', igrouplist(i)
      enddo
      end

This example may return the following results:

groups for process =  2  error =  0
groups for process =  2  error =  0
gid =  1013
gid =  10533

SEE ALSO

getgroups(2)

getgrnam(3c)