9.76 getgid/getegid

gid_t getgid(void);
gid_t getegid(void);

These syscalls fetch the GID and the effective GID of the calling process. They never fail.