From 9257eb538f4c7907f49d25bb43b90107ffa1f8ab Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 24 Feb 2004 04:03:00 -0800 Subject: [PATCH] [PATCH] Report NGROUPS_MAX via a sysctl (read-only) From: Tim Hockin Attached is a simple patch to expose NGROUPS_MAX via sysctl. Nothing fancy, just a read-only variable. glibc can use this to sysconf() the value properly, so apps will stop relying on NGROUPS_MAX as a real constant. --- include/linux/sysctl.h | 1 + kernel/sysctl.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 6819132d40d4c..9afd45c3670a2 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -130,6 +130,7 @@ enum KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */ KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */ KERN_PTY=62, /* dir: pty driver */ + KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */ }; diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 612ebb35af267..cd7f0b6df89a8 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #ifdef CONFIG_ROOT_NFS @@ -68,6 +69,8 @@ extern int printk_ratelimit_burst; static int maxolduid = 65535; static int minolduid; +static int ngroups_max = NGROUPS_MAX; + #ifdef CONFIG_KMOD extern char modprobe_path[]; #endif @@ -604,6 +607,14 @@ static ctl_table kern_table[] = { .mode = 0644, .proc_handler = &proc_dointvec, }, + { + .ctl_name = KERN_NGROUPS_MAX, + .procname = "ngroups_max", + .data = &ngroups_max, + .maxlen = sizeof (int), + .mode = 0444, + .proc_handler = &proc_dointvec, + }, { .ctl_name = 0 } }; -- 2.53.0