9.77 setgids

int setgids(gid_t gid, gid_t egid);

This syscall sets the GID and effective GID of the calling process. If the calling process has the MAC_CAP_SETGID capability, it will set both the EGID and GID, else, it will only try to set EGID to values matching the process’s GID. If any of them is -1, it will not be modified.

The syscall returns 0 on success or -1 on failure, with the following errno:

EPERM

MAC did not allow this.