Date: Wed, 16 Mar 2016 13:32:41 -0700 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Hans Petter Selasky <hselasky@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r296933 - in head: share/man/man9 sys/sys Message-ID: <20160316203241.GM1328@FreeBSD.org> In-Reply-To: <201603160837.u2G8bqgr087126@repo.freebsd.org> References: <201603160837.u2G8bqgr087126@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 16, 2016 at 08:37:52AM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Wed Mar 16 08:37:52 2016 H> New Revision: 296933 H> URL: https://svnweb.freebsd.org/changeset/base/296933 H> H> Log: H> Improve the implementation and documentation of the H> SYSCTL_COUNTER_U64_ARRAY() macro. H> H> - Add proper asserts to the SYSCTL_COUNTER_U64_ARRAY() macro that checks H> the size of the first element of the array. H> - Add an example to the counter(9) manual page how to use the H> SYSCTL_COUNTER_U64_ARRAY() macro. H> - Add some missing symbolic links for counter(9) while at it. ... H> +.Sh EXAMPLES H> +The following example creates a static counter array exported to H> +userspace through a sysctl: H> +.Bd -literal -offset indent H> +#define MY_SIZE 8 H> +static counter_u64_t array[MY_SIZE]; H> +SYSCTL_COUNTER_U64_ARRAY(_debug, OID_AUTO, counter_array, CTLFLAG_RW, H> + &array[0], MY_SIZE, "Test counter array"); I always wondered what is stylistically better: array or &array[0]? I usually prefer the former. -- Totus tuus, Glebius.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160316203241.GM1328>