Commit 9257eb53 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Report NGROUPS_MAX via a sysctl (read-only)

From: Tim Hockin <thockin@sun.com>

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.
parent cd4b9380
...@@ -130,6 +130,7 @@ enum ...@@ -130,6 +130,7 @@ enum
KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */ KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */
KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */ KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */
KERN_PTY=62, /* dir: pty driver */ KERN_PTY=62, /* dir: pty driver */
KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */
}; };
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/security.h> #include <linux/security.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/limits.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS
...@@ -68,6 +69,8 @@ extern int printk_ratelimit_burst; ...@@ -68,6 +69,8 @@ extern int printk_ratelimit_burst;
static int maxolduid = 65535; static int maxolduid = 65535;
static int minolduid; static int minolduid;
static int ngroups_max = NGROUPS_MAX;
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
extern char modprobe_path[]; extern char modprobe_path[];
#endif #endif
...@@ -604,6 +607,14 @@ static ctl_table kern_table[] = { ...@@ -604,6 +607,14 @@ static ctl_table kern_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec, .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 } { .ctl_name = 0 }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment