Re: PATCH: report NGROUPS_MAX via a sysctl (read-only)

Glen Turner
2004-02-25T01:00:41Z

On Fri, 2004-02-20 at 17:40, Tim Hockin wrote:

> Well, really I don't see how apps would want to use it in any way that was
> correct.

The mere existence of the value means it can be used correctly
in application code for sanity checking.

eg:
assert(list_length(group_list) < ngroups_max());
list_append(&group_list, group);

An application might also use it to automatically
size data structure details, such as the parameters of
a hash function.

h = hash_create(ngroups_max());

Returning INT_MAX for NGROUPS_MAX isn't wrong, but you
then can't blame user space for making inefficient choices
if the kernel limit is actually smaller.

Cheers,
Glen