Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Dec 2008 16:20:41 +0100
From:      "Ivan Voras" <ivoras@freebsd.org>
To:        "Giorgos Keramidas" <keramida@ceid.upatras.gr>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: MAXFILES in subr_param.c
Message-ID:  <9bbcef730812100720h5b3aab6ek46c4f36c67a37d58@mail.gmail.com>
In-Reply-To: <87bpvkdqex.fsf@kobe.laptop>
References:  <ghjt9l$hg3$1@ger.gmane.org> <863agws2bv.fsf@ds4.des.no> <ghog9e$r4e$1@ger.gmane.org> <87bpvkdqex.fsf@kobe.laptop>

next in thread | previous in thread | raw e-mail | index | archive | help
2008/12/10 Giorgos Keramidas <keramida@ceid.upatras.gr>:
> On Wed, 10 Dec 2008 14:30:24 +0100, Ivan Voras <ivoras@freebsd.org> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9bbcef730812100720h5b3aab6ek46c4f36c67a37d58>