SYSCTL type safety
gnn at neville-neil.com
Sat Jan 8 03:53:40 UTC 2011
On Jan 7, 2011, at 18:13 , mdf at FreeBSD.org wrote:
> Long ago at Isilon we ran into a problem with some sysctls in the
> stock FreeBSD tree using the wrong type, like SYSCTL_ULONG on an int,
> or just mixing unsigned/signed. We have a patch that uses transparent
> unions to cause a compile-time error with a type mismatch. For a
> while I was hesitant to push this since I wasn't sure about the use of
> a gcc extension, but the SYSCTL fixes and the way to keep them sane
> came up again when we started building a new driver locally, and the
> build failed until we fixed some SYSCTL stuff.
> Anyways, the patch to sys/sysctl.h is at
> Please chime in if you think this is a bad thing to add to the tree.
> I will of course ensure a make universe passes locally before
> committing this part. The plan is to change the SYSCTL use, not the
> base type of the variable, for any conflicts found.
I have read, but not tried the patch. I definitely like the idea.
More information about the freebsd-arch