NGROUPS_MAX in linux 2.6.3+

Ulrich Drepper drepper@redhat.com
Wed Feb 25 08:15:00 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jaeger wrote:

> The problem I see with your patch, is that there seems to be no
> fallback for the case where you compile this with kernel headers that
> define KERN_NGROUPS_MAX but do run it on an older kernel.  Check how
> we do this with kernel-features.h,

That's not the only problem.

More critical is that, according to Arjan, numeric sysctl() calls are
deprecated.  There isn't yet a replacement which takes strings so you'll
have to use /proc/sys/kernel/....

So, rewrite the code to use open+read+strtol (don't even thing about
fopen+fscanf).  Replace the default case with a simple break, move the
posix_sysconf call to the end of the function, and return from the
special NGROUPS handling only if reading the file was successful.
Otherwise fall through to the posix_sysconf call.  Oh, and since you'll
use /proc there is no need for any #ifdef.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAPFl/2ijCOnn/RHQRApK6AJ0dR9opUQtxk5A7uDCFT27nTHWgGACfYx2z
7vDTbAGM4Tdtke34v/LPWzs=
=vqDu
-----END PGP SIGNATURE-----



More information about the Libc-alpha mailing list