public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Hockin <thockin@sun.com>
To: Linux Kernel mailing list <linux-kernel@vger.kernel.org>,
	akpm@osdl.org, torvalds@osdl.org
Subject: PATCH: report NGROUPS_MAX via a sysctl (read-only)
Date: Thu, 19 Feb 2004 18:39:28 -0800	[thread overview]
Message-ID: <20040220023927.GN9155@sun.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

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.

Is this the right path?  Or should there be a sysconf-specific mechanism?
-- 
Tim Hockin
Sun Microsystems, Linux Software Engineering
thockin@sun.com
All opinions are my own, not Sun's

[-- Attachment #2: ngroups-sysctl-1.diff --]
[-- Type: text/plain, Size: 1277 bytes --]

===== include/linux/sysctl.h 1.64 vs edited =====
--- 1.64/include/linux/sysctl.h	Wed Feb 18 19:43:21 2004
+++ edited/include/linux/sysctl.h	Thu Feb 19 17:00:34 2004
@@ -129,6 +129,7 @@
 	KERN_HPPA_UNALIGNED=59,	/* int: hppa unaligned-trap enable */
 	KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */
 	KERN_PRINTK_RATELIMIT_BURST=61,	/* int: tune printk ratelimiting */
+	KERN_NGROUPS_MAX=62,	/* int: NGROUPS_MAX */
 };
 
 
===== kernel/sysctl.c 1.61 vs edited =====
--- 1.61/kernel/sysctl.c	Wed Feb 18 19:43:21 2004
+++ edited/kernel/sysctl.c	Thu Feb 19 17:05:47 2004
@@ -38,6 +38,7 @@
 #include <linux/security.h>
 #include <linux/initrd.h>
 #include <linux/times.h>
+#include <linux/limits.h>
 #include <asm/uaccess.h>
 
 #ifdef CONFIG_ROOT_NFS
@@ -68,6 +69,8 @@
 static int maxolduid = 65535;
 static int minolduid;
 
+static int ngroups_max = NGROUPS_MAX;
+
 #ifdef CONFIG_KMOD
 extern char modprobe_path[];
 #endif
@@ -591,6 +594,14 @@
 		.data		= &printk_ratelimit_burst,
 		.maxlen		= sizeof(int),
 		.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 }

             reply	other threads:[~2004-02-20  2:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-20  2:39 Tim Hockin [this message]
2004-02-20  5:30 ` PATCH: report NGROUPS_MAX via a sysctl (read-only) Andrew Morton
2004-02-20  6:35   ` Tim Hockin
2004-02-20  6:47     ` Andrew Morton
2004-02-20  7:10       ` Tim Hockin
2004-02-25  0:59         ` Glen Turner
2004-02-25  1:14           ` Tim Hockin
2004-02-25  7:32             ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040220023927.GN9155@sun.com \
    --to=thockin@sun.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox