From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 10 15:21:07 2008 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 9BEBF106564A for ; Wed, 10 Dec 2008 15:21:07 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-bw0-f14.google.com (mail-bw0-f14.google.com [209.85.218.14]) by mx1.freebsd.org (Postfix) with ESMTP id D412D8FC08 for ; Wed, 10 Dec 2008 15:21:06 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by bwz7 with SMTP id 7so804347bwz.19 for ; Wed, 10 Dec 2008 07:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=o9sm7E3yj6a1Z5mzZhJi9mIWa5v2KauZN4fOv8/uWcw=; b=SyW/TMszuM5d1MotFMSZ6+BhygvVvPj8wbBuW54lKrUmNoZZiGZMuKQKLh05I3U8kz fe7M4mMLRYujALRh9zi1/eAMsHdTp4wKV2iZfKseYsiTVrbm+V7qPqYtF8YHwJZtPiOk muznO64z8ShkED/wedmjc9OlNTMyGVEQJ9jAU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=ThY0UwVU0RNVuGzMd2OB0FFoBafJV56tRC6nm6jY1CIoyEcrWiff5n/UNfpduMJvZV YAuAWqQmGxMcu6d7WZoYqE/1QyHxt74J0JZgng8N+XZ3imGJnUhN0sVBkaofVZAaEIfX 1Al0A5bGNSoipRIAlzB1dce02ATgfO+AF7WPg= Received: by 10.181.141.7 with SMTP id t7mr495079bkn.10.1228922441693; Wed, 10 Dec 2008 07:20:41 -0800 (PST) Received: by 10.180.238.15 with HTTP; Wed, 10 Dec 2008 07:20:41 -0800 (PST) Message-ID: <9bbcef730812100720h5b3aab6ek46c4f36c67a37d58@mail.gmail.com> Date: Wed, 10 Dec 2008 16:20:41 +0100 From: "Ivan Voras" Sender: ivoras@gmail.com To: "Giorgos Keramidas" In-Reply-To: <87bpvkdqex.fsf@kobe.laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <863agws2bv.fsf@ds4.des.no> <87bpvkdqex.fsf@kobe.laptop> X-Google-Sender-Auth: 33b7f3b14be52eaf Cc: freebsd-hackers@freebsd.org Subject: Re: MAXFILES in subr_param.c 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: Wed, 10 Dec 2008 15:21:07 -0000 2008/12/10 Giorgos Keramidas : > On Wed, 10 Dec 2008 14:30:24 +0100, Ivan Voras wrote: >>>> Also, it looks like MAXFILES is used only once, and in a bit funny way: >>>> >>>> 238 maxfiles = MAXFILES; >>>> 239 TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles); >>>> 240 maxprocperuid = (maxproc * 9) / 10; >>>> 241 maxfilesperproc = (maxfiles * 9) / 10; >>> >>> What's funny about it? >> >> MAXFILES is a macro used only once, where it resolves to (maxproc*2). >> It's not technically incorrect, but it looks like it adds noise. > > It doesn't add noise :-) > > It's arguably a code quality and `documentation' feature. It provides a > human-readable, useful name to the "magic" value (maxproc * 2). If we > decide to bump the default to (maxproc * 10) sometime later, we won't > have to grovel through the entire src/sys/tree and look for maxproc > instances that need updating. The macro is defined and used exactly once, in this file. Other files probably use maxfiles. The problem is - since it's in an #ifdef block - is it defined anywhere else? A quick grep yields only this: conf/NOTES:options MAXFILES=999 conf/options:MAXFILES opt_param.h I don't know how config interacts with the source - does it shadow the subr_param.c value? This isn't a very important question as the system demonstratively works in any case, I see it more as a style curiosity.