MAXFILES in subr_param.c

Giorgos Keramidas keramida at ceid.upatras.gr
Wed Dec 10 07:02:41 PST 2008


On Wed, 10 Dec 2008 14:30:24 +0100, Ivan Voras <ivoras at 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.



More information about the freebsd-hackers mailing list