Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2011 14:09:42 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        mdf@freebsd.org
Subject:   Re: SYSCTL type safety
Message-ID:  <201101101409.42157.jhb@freebsd.org>
In-Reply-To: <AANLkTimv%2Br8o9_U7dxvO1o7mpNSM4VdYH7ex=uT_4WwO@mail.gmail.com>
References:  <AANLkTimv%2Br8o9_U7dxvO1o7mpNSM4VdYH7ex=uT_4WwO@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, January 07, 2011 6:13:36 pm mdf@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
> 
> http://people.freebsd.org/~mdf/bsd-sysctl-type-safety.diff

You can't use time_t for INT and size_t for LONG.  If we have sysctl's 
exporting raw time_t and size_t types then we likely need to add some 
SYSCTL_TIME and SYSCTL_SIZE wrappers?

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101101409.42157.jhb>