Set real and effective group IDs
#include <unistd.h> int setregid( gid_t rgid, gid_t egid );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The setregid() function lets the calling process set its real and effective group to its real or effective group ID, its saved set-group ID, or one of the group IDs identified by the PROCMGR_AID_SETGID ability (see procmgr_ability()). If rgid or egid is -1, the corresponding real or effective group ID is left unchanged.
In either case, if you're changing the real group ID (i.e., rgid isn't -1), or you're changing the effective group ID to a value that isn't equal to the real group ID, the saved set-group ID is set to the new effective group ID.
Or:
The calling process doesn't have the PROCMGR_AID_SETGID ability enabled, and you tried to change the real group ID to a value other than the effective group ID.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |