From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 23 04:57:27 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16761106564A for ; Mon, 23 Mar 2009 04:57:27 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id BE8B68FC19 for ; Mon, 23 Mar 2009 04:57:26 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n2N4dbow061938; Mon, 23 Mar 2009 00:39:37 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n2N4dbYa061937; Mon, 23 Mar 2009 00:39:37 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Mon, 23 Mar 2009 00:39:37 -0400 From: David Schultz To: Boris Kochergin Message-ID: <20090323043937.GA61818@zim.MIT.EDU> Mail-Followup-To: Boris Kochergin , freebsd-hackers@FreeBSD.ORG References: <49C6F4F4.5030609@acm.poly.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49C6F4F4.5030609@acm.poly.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Doing away with NGROUPS_MAX in src/sys/sys/syslimits.h? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2009 04:57:27 -0000 On Sun, Mar 22, 2009, Boris Kochergin wrote: > Ahoy. I got bitten by this today--a system I administer for someone had > users in more than 16 groups, so I had to bump the value, recompile the > kernel, and reboot. It seems desirable to (at the very least) make this > a read-only tunable that can be set using /boot/loader.conf, so as to > avoid source modification and kernel recompilation. I had a look around, > and noticed that NGROUPS_MAX is used to construct static arrays in a > couple of locations ("ibcs2_gid_t iset[NGROUPS_MAX];"). It seems that > malloc(9)/MALLOC(9) can be used to allocate memory for the array > instead, and panic() (or something) can be called if the allocation > fails, no? Is that about the gist of it? If I'm not overlooking > something major, I'd like to take a stab at it. There's already a kern.ngroups sysctl, but there are many places where `ngroups' needs to be used in preference to NGROUPS in the kernel. In userland, sysconf(_SC_NGROUPS_MAX) needs to be used in preference to NGROUPS_MAX.