svn commit: r296933 - in head: share/man/man9 sys/sys

Gleb Smirnoff glebius at FreeBSD.org
Thu Mar 17 20:04:40 UTC 2016


On Thu, Mar 17, 2016 at 08:19:50AM +0100, Hans Petter Selasky wrote:
H> On 03/16/16 21:36, Gleb Smirnoff wrote:
H> > On Wed, Mar 16, 2016 at 08:37:52AM +0000, Hans Petter Selasky wrote:
H> > H> Modified: head/sys/sys/sysctl.h
H> > H> ==============================================================================
H> > H> --- head/sys/sys/sysctl.h	Wed Mar 16 06:42:15 2016	(r296932)
H> > H> +++ head/sys/sys/sysctl.h	Wed Mar 16 08:37:52 2016	(r296933)
H> > H> @@ -654,8 +654,10 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
H> > H>  	SYSCTL_OID(parent, nbr, name,					\
H> > H>  	    CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access),			\
H> > H>  	    (ptr), (len), sysctl_handle_counter_u64_array, "S", descr);	\
H> > H> -	CTASSERT(((access) & CTLTYPE) == 0 ||				\
H> > H> -	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
H> > H> +	CTASSERT((((access) & CTLTYPE) == 0 ||				\
H> > H> +	    ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) &&	\
H> > H> +	    sizeof(counter_u64_t) == sizeof(*(ptr)) &&			\
H> > H> +	    sizeof(uint64_t) == sizeof(**(ptr)))
H> >
H> > I don't agree with the last line. Does it assert that counter_u64_t is
H> > implemented using uint64_t? That is true, but that is internal detail,
H> > that might be changed in future.
H> >
H> 
H> Yes, it asserts that counter_u64_t is a 64-bit counter, as the name of 
H> the typedef hints at.
H> 
H>  From the past experience there has been several cases where someone has 
H> changed a field in structure which is exported as a sysctl, and then the 
H> sysctls were never updated.

It could be that counter_u64_t becomes a machine dependent typedef, being
different size on different machines. Unlikely, but possible.

-- 
Totus tuus, Glebius.


More information about the svn-src-all mailing list