MAXFILES in subr_param.c
Ivan Voras
ivoras at freebsd.org
Wed Dec 10 05:30:40 PST 2008
Dag-Erling Smørgrav wrote:
> Ivan Voras <ivoras at freebsd.org> writes:
>> I'm looking at kern/subr_param.c:
>>
>> 72 #ifndef MAXFILES
>> 73 #define MAXFILES (maxproc * 2)
>> 74 #endif
>>
>> Shouldn't this be at least maxproc*3, for stdin,out,err for every proc?
>
> Even maxproc * 3 won't be enough, unless none of your processes actually
> do anything.
> It's just an arbitrary value, based on the assumption that
> you will never have maxproc concurrent processes anyway.
Ok.
>
>> 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.
>> Historical reasons?
>
> To a certain degree, yes; MAXFILES used to be a static limit which you
> could only change in your kernel config. It is now a loader tunable
> (though you can still change the default in your kernel config), so the
> MAXFILES macro was replaced with a maxfiles variable wherever it is
> used, and the former is now only used to initialize the latter.
Ok.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20081210/d8dd283d/signature.pgp
More information about the freebsd-hackers
mailing list