Please check the manual page getgroups(2).