Messages in this thread | | | Date | Thu, 28 Oct 2004 11:21:09 -0700 | From | Tim Hockin <> | Subject | Re: Max groups one can be a member of linux/sched.h and NGROUPS_SMALL |
| |
On Thu, Oct 28, 2004 at 01:02:30PM -0500, Joseph Pingenot wrote: > #define NGROUPS_SMALL 32 > #define NGROUPS_PER_BLOCK ((int)(PAGE_SIZE / sizeof(gid_t))) > struct group_info { > int ngroups; > atomic_t usage; > gid_t small_block[NGROUPS_SMALL]; > int nblocks; > gid_t *blocks[0]; > };
> So, it appears to hold 32 gids, but what is this blocks bit? Is 32 the max > number of groups one can be a member of?
By default, every task has enough room for 32 gids. If you need more than 32, it uses a dynamically allocated 2-d array, stored in blocks. Always use the GROUP_AT() macro, and you can treat it like a 1-d array. I think there is a hardlimit of 64k groups, but that is simply a #define that can be changed. You can have as many groups as you need, dynamically allocated per-task, with CoW between tasks. Sorted and bsearch()ed. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |