MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sys_setgroups

Function sys_setgroups

freebsd/kern/kern_prot.c:799–823  ·  view source on GitHub ↗

ARGSUSED */

Source from the content-addressed store, hash-verified

797#endif
798/* ARGSUSED */
799int
800sys_setgroups(struct thread *td, struct setgroups_args *uap)
801{
802 gid_t smallgroups[XU_NGROUPS];
803 gid_t *groups;
804 u_int gidsetsize;
805 int error;
806
807 gidsetsize = uap->gidsetsize;
808 if (gidsetsize > ngroups_max + 1)
809 return (EINVAL);
810
811 if (gidsetsize > XU_NGROUPS)
812 groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK);
813 else
814 groups = smallgroups;
815
816 error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t));
817 if (error == 0)
818 error = kern_setgroups(td, gidsetsize, groups);
819
820 if (gidsetsize > XU_NGROUPS)
821 free(groups, M_TEMP);
822 return (error);
823}
824
825int
826kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups)

Callers

nothing calls this directly

Calls 4

mallocFunction · 0.85
kern_setgroupsFunction · 0.85
freeFunction · 0.70
copyinFunction · 0.50

Tested by

no test coverage detected