This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Tim Hockin <thockin@sun.com> writes: > Replying to my own mail. > > On Thu, Feb 19, 2004 at 01:20:25PM -0800, Tim Hockin wrote: >> 1. Linux does not have a way to report these "constants" to libc. It is a >> constant for a given kernel, but not necessarily across kernels. I am going >> to try to find a good way to do that. Watch for a patch, unless Linus tells >> me to buzz off. > > Patch is here. Linux will now expose a sysctl to read it's idea of > NGROUPS_MAX. > > Can I get an ACK or NACK on this please, so I can rework it or mark it as > done? Let me reply to libc-alpha so that it has a chance to be seen. 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, Andreas
Index: sysdeps/unix/sysv/linux/sysconf.c =================================================================== RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sysconf.c,v retrieving revision 1.9 diff -u -u -r1.9 sysconf.c --- sysdeps/unix/sysv/linux/sysconf.c 27 Mar 2003 17:55:08 -0000 1.9 +++ sysdeps/unix/sysv/linux/sysconf.c 24 Feb 2004 00:11:08 -0000 @@ -20,6 +20,7 @@ #include <sysdep.h> #include <time.h> #include <unistd.h> +#include <sys/sysctl.h> static long int posix_sysconf (int name); @@ -43,6 +44,20 @@ int r; r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts); return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : 1; + } +#endif + +#ifdef KERN_NGROUPS_MAX + case _SC_NGROUPS_MAX: + { + int name[] = { CTL_KERN, KERN_NGROUPS_MAX }; + int ngroups_max; + int ngroups_max_len = sizeof (ngroups_max); + + if (__sysctl (name, sizeof (name) / sizeof (*name), + &ngroups_max, &ngroups_max_len, 0, 0) < 0) + return -1; + return ngroups_max; } #endif
-- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |