Sets the process group IDs.
Standard C Library (libc.a)
int setgid (GID)
int setrgid (RGID)
int setegid (EGID)
int setregid (RGID, EGID) gid_t RGID; gid_t EGID;
setrgid, setegid, and setregid subroutines
set the process group IDs of the calling process. The following
semantics are supported:
|setgid||If the effective user ID of the process is the root user, the process's real, effective, and saved group IDs are set to the value of the GID parameter. Otherwise, the process effective group ID is reset if the GID parameter is equal to either the current real or saved group IDs, or one of its supplementary group IDs. Supplementary group IDs of the calling process are not changed.|
|setegid||The process effective group ID is reset if one of the following conditions is met:|
|setrgid||The EPERM error code is always returned.|
|setregid||The RGID and EGID parameters can have one of the
The setegid, setrgid, and setregid subroutines are thread-safe.
|GID||Specifies the value of the group ID to set.|
|RGID||Specifies the value of the real group ID to set.|
|EGID||Specifies the value of the effective group ID to set.|
|0||Indicates that the subroutine was successful.|
|-1||Indicates the subroutine failed. The errno global variable is set to indicate the error.|
If either the setgid
or setegid subroutine fails, one or more of the following are
|EPERM||Indicates the process does not have appropriate privileges and the GID or EGID parameter is not equal to either the real or saved group IDs of the process.|
|EINVAL||Indicates the value of the GID or EGID parameter is invalid.|
These subroutines are part of Base Operating System (BOS) Runtime.
The operating system does not support setuid (setuid, setruid, seteuid, or setreuid Subroutine) or setgid shell scripts.
The getgid subroutine, getgroups subroutine, setgroups (setgroups Subroutine) subroutine, setuid (setuid, setruid, seteuid, or setreuid Subroutine) subroutine.
The setgroups command.
List of Security and Auditing Subroutines, Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.