Why is TUNABLE_INT discouraged?
Ivan Voras
ivoras at freebsd.org
Sat Aug 7 19:19:03 UTC 2010
On 7.8.2010 15:40, Dag-Erling Smørgrav wrote:
> Garrett Cooper <gcooper at FreeBSD.org> writes:
>> I found the commit where it was made (by des@ -- cvs revision
>> 1.120), but unfortunately I lack the context as to why that suggestion
>> is made; the commit isn't very explicit as to why integers tunables
>> should be discouraged
>
> You're supposed to use TUNABLE_LONG or TUNABLE_ULONG instead. From
> digging in the -current archives, it seems that the motivation was a bug
> that resulted from using a TUNABLE_INT for a value that was actually an
> address. It was doubly broken: first because it was too small on 64-bit
> systems, and second because it was signed.
Ok, but still - if the underlying value really is declared as "int",
doesn't it make perfect sense to have something like TUNABLE_INT for it?
Forcing "long" is a bit weird in this context, as C long is 32-bit on
i386 and 64-bit on amd64.
More information about the freebsd-hackers
mailing list