The getgroups() system call returns a list of supplementary group IDs
associated with the calling process. The setgroups() system call associates a set of supplementary group
IDs with the calling process.
Summary
of Change |
 |
What’s
New for Customers Migrating from HP-UX 11i v1 September 2005?
The number of groups that may be returned by the getgroups()system call or passed to the setgroups()system call is no longer limited by the NGROUPS_MAX compile
time constant. Programs should use sysconf (_SC_NGROUPS_MAX) to determine
the maximum number of groups that may be returned. (This can also
be used on prior versions of HP-UX.) The actual limit will be returned
by sysconf (_SC_NGROUPS_MAX). This value will
never be smaller than the current value of NGROUPS_MAX (20).
This change is recommended to prepare applications for future versions
of HP-UX which may be optionally configured to support more groups.
Impact |
 |
Applications calling getgroups()may no longer rely on the NGROUPS_MAX compile
time constant to size an array big enough to hold all the groups
a process may belong to. They must first call sysconf (_SC_NGROUPS_MAX) to determine
the maximum number of groups supported by the system they’re
running on and dynamically allocate a suitable sized array of gid_t. Applications must be prepared for getgroups()to return a list of arbitrary length. Applications calling setgroups()with an ngroups value greater than NGROUPS_MAX may
succeed. Applications which depend on such a call to fail should
be changed. The sysconf (_SC_NGROUPS_MAX) call will
return the maximum number of groups supported on the current system.
This value will never be smaller than the current value of NGROUPS_MAX (20)
and may be arbitrarily larger on a future release of HP-UX.
Compatibility |
 |
A future release of HP-UX may permit system administrators
to raise the maximum number of groups above the current value of NGROUPS_MAX (20).
In such a system: Applications passing NGROUPS_MAX to getgroups()will get a return value of -1 with errno
set to EINVAL when called from a process
that belongs to more than 20 groups. Applications passing more than NGROUPS_MAX (but
no more than sysconf (_SC_NGROUPS_MAX) groups to setgroups()will succeed where they previously would have failed
with -1 and errno set to EINVAL.
Performance |
 |
There is no impact on performance.
Obsolescence |
 |
The limitation on the maximum number of groups returned by getgroups()being determined by NGROUPS_MAX at
compile time is deprecated. The limitation on the maximum number
of groups which may be passed to setgroups()being determined by NGROUPS_MAX at
compile time is deprecated.