int setgid(gid_t id);
Sets the real group ID of the current process to id. Returns zero on success, or the negation of the error code on error.
getegid, getgid, setegid, setregid