setregid(2)setregid(2)Namesetregid - set real and effective group ID
Syntax
setregid(rgid, egid)
int rgid, egid;
Description
The real and effective group ID's of the current process are set to the
arguments.
Supplying a value of -1 for either the real or effective group ID
forces the system to substitute the current ID for the -1 parameter.
Environment
BSD
If the process is superuser, or and matches with the real group ID, the
effective group ID, or the saved set-group-id (as described in ), then
the real, effective, and saved set-group-id are set to and respec‐
tively.
POSIX
SYSTEM-FIVE
When your program is compiled in POSIX or SYSTEM-FIVE mode, the follow‐
ing semantics apply when using the function.
If the process is the superuser, the real, effective, and saved set-
group-id (as described in ) are set to and respectively.
If the process is not the superuser, but the and matches the real group
ID, the effective group ID (only in SYSTEM-FIVE and BSD environment),
or the saved set-group-id, then the effective ID is set to The real
group ID and the saved set-group-id are left unchanged.
Return Values
Upon successful completion, a value of zero (0) is returned. Other‐
wise, a value of -1 is returned, and errno is set to indicate the
error.
Diagnostics
[EPERM] The current process is not the superuser and the and
specified does not match with the real group ID or the
effective group ID (only in SYSTEM-FIVE and BSD environ‐
ment) or the saved set-group-id.
See Alsogetgid(2), setreuid(2), setgid(3)setregid(2)