The setregid function is used to set the real and effective group IDs of the calling process. If rgid is -1, the real group ID is not changed; if egid is -1, the effective group ID is not changed. The real and effective group IDs can be set to different values in the same call. Only a process with the IMPERSONATE privilege can set the real group ID and the effective group ID to any valid value. A nonprivileged process can set either the real group ID to the saved set-group-ID from an exec function, or the effective group ID to the saved set-group-ID or the real group ID. Any supplementary group IDs of the calling process remain unchanged. If a set-group-ID process sets its effective group ID to its real group ID, it can still set its effective group ID back to the saved set-group-ID. This function requires that long (32-bit) UID/GID support be enabled. See 32-Bit UID and GID Macro (Integrity servers, Alpha) for more information.