The id(1) command must determine the gid it is operating under. The getgid(2) and getegid(2) functions are shown in the synopsis for this purpose:
#include <sys/types.h> #include <unistd.h> gid_t getgid(void); gid_t getegid(void);
The getgid(2) function returns the real group ID number, and the getegid(2) function returns the effective group ID. There are no errors to check; these functions always succeed.
3.141.47.221