xref: /plan9-contrib/sys/src/ape/lib/ap/plan9/getgid.c (revision 3e12c5d1bb89fc02707907988834ef147769ddaf)
1 #include <sys/types.h>
2 #include <grp.h>
3 #include <unistd.h>
4 
5 /*
6  * BUG: assumes group that is same as user name
7  * is the one wanted (plan 9 has no "current group")
8  */
9 gid_t
getgid(void)10 getgid(void)
11 {
12 	struct group *g;
13 	g = getgrnam(getlogin());
14 	return g? g->gr_gid : 1;
15 }
16 
17 gid_t
getegid(void)18 getegid(void)
19 {
20 	return getgid();
21 }
22