lkml.org 
[lkml]   [2004]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.046 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site