Why is TUNABLE_INT discouraged?

Dag-Erling Smørgrav des at des.no
Mon Aug 9 08:02:14 UTC 2010

Ivan Voras <ivoras at freebsd.org> writes:
> Dag-Erling Smørgrav <des at des.no> writes:
> > Not sure what you mean.  The original issue was that someone had used
> > TUNABLE_INT() for something that was actually a memory address.  I
> > changed it to TUNABLE_ULONG().  Of course, if your tunable is a boolean
> > value or something like maxprocs, an int is fine - but so is a long.
> Semantically valid but using TUNABLE_INT to hold pointers is a
> developer bug, not the fault of the API, and there's nothing wrong
> with "int" as a data type in this context.

That's the point.  There was no TUNABLE_ULONG() at the time.  I added it
to fix the bug.

Dag-Erling Smørgrav - des at des.no

More information about the freebsd-hackers mailing list