setgid(2) DG/UX R4.11MU05 setgid(2)
NAME
setgid - set the real-, effective-, and saved-group-ids
SYNOPSIS
#include <sys/types.h>
int setgid (gid)
gidt gid;
where:
gid The value to which the calling process's group-ids are to be
set
DESCRIPTION
Setgid sets the real-group-id, effective-group-id, and saved-group-id
of the calling process to gid, subject to the access control
constraints described below.
The value of gid must always be non-negative and less than MAXUID.
Note that changing the real-group-id or effective-group-id does not
alter any supplementary group-ids of the calling process.
ACCESS CONTROL
If the calling process has appropriate privilege, the real-group-id,
effective-group-id, and saved_group_id values are all set to gid.
If the calling process does not have appropriate privilege, but its
real-group-id or its saved_group_id is equal to gid, the
effective-group-id is set to gid. The real-group-id and
saved_group_id are unchanged.
For systems supporting the DG/UX Capability Option, appropriate
privilege is defined as having one or more specific capabilities
enabled in the effective capability set of the calling process. See
capdefaults(5) for the default capability for this system call.
On systems without the DG/UX Capability Option, appropriate privilege
means that the process has an effective UID of root. See the
appropriateprivilege(5) man page for more information.
RETURN VALUE
0 Successful completion.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EPERM An attempt was made to set the effective-group-id to a
value not permitted by the access control restrictions
described above.
EINVAL The supplied value of gid was negative or greater than
MAXUID.
SEE ALSO
getegid(2), geteuid(2), getgid(2), getuid(2), setregid(2),
setreuid(2), setuid(2), appropriateprivilege(5).
capdefaults(5).
Licensed material--property of copyright holder(s)