unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



getgroups(2)							 getgroups(2)



NAME
  getgroups - Gets the supplementary group IDs of the current process

SYNOPSIS

  #include <&lt;unistd.h>&gt;

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

  Application developers may want to specify an	#include statement for
  <&lt;sys/types.h>&gt;	before the one for <&lt;unistd.h>&gt; if programs are being developed
  for multiple platforms. The additional #include statement is not required
  on Tru64 UNIX	systems	or by ISO or X/Open standards, but may be required on
  other	vendors' systems that conform to these standards.

STANDARDS

  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  getgroups(): XSH4.2

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.

PARAMETERS

  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 process' supplementary group IDs
	    are	stored.	The effective groups ID	of the process is not
	    returned by	the getgroups()	function if it is not also a supple-
	    mentary groups ID of the calling process.

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 than the value indicated by the
  sysconf() parameter _SC_NGROUPS_MAX.	If the gidsetsize parameter is 0
  (zero), the getgroups() function returns the number of supplementary group
  IDs associated with the calling process without modifying the	array pointed
  to by	grouplist.



RETURN VALUES

  Upon successful completion, the getgroups() function returns the number of
  elements stored in the array pointed to by the grouplist parameter. Other-
  wise,	the function returns a value of	-1 and sets errno to indicate the
  error.

ERRORS

  If the getgroups() function fails, errno might be set	to one of the follow-
  ing values:

  [EFAULT]  [Tru64 UNIX]  The gidsetsize and grouplist parameters specify an
	    array that is partially or completely outside of the allocated
	    address space of the process.

  [EINVAL]  The	gidsetsize parameter is	nonzero	and smaller than the number
	    of supplementary group IDs.

RELATED	INFORMATION

  Commands: groups(1)

  Functions: setgroups(2), getgid(2), setsid(2), sysconf(2), initgroups(3)

  Standards: standards(5)