diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-03-16 08:37:52 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2016-03-16 08:37:52 +0000 |
commit | a435d46fdfb40466f876aa7b3865a046bc2168fc (patch) | |
tree | 55757d948c119239c5f08c93e3f0d24d5ac38bec /share | |
parent | 0d8c93313e49f8c033a545b5480a7724fad4f922 (diff) | |
download | src-a435d46fdfb40466f876aa7b3865a046bc2168fc.tar.gz src-a435d46fdfb40466f876aa7b3865a046bc2168fc.zip |
Improve the implementation and documentation of the
SYSCTL_COUNTER_U64_ARRAY() macro.
- Add proper asserts to the SYSCTL_COUNTER_U64_ARRAY() macro that checks
the size of the first element of the array.
- Add an example to the counter(9) manual page how to use the
SYSCTL_COUNTER_U64_ARRAY() macro.
- Add some missing symbolic links for counter(9) while at it.
Notes
Notes:
svn path=/head/; revision=296933
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/Makefile | 6 | ||||
-rw-r--r-- | share/man/man9/counter.9 | 10 |
2 files changed, 15 insertions, 1 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 66c16d726ef4..26f230c2018c 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -639,7 +639,11 @@ MLINKS+=counter.9 counter_u64_alloc.9 \ counter.9 counter_exit.9 \ counter.9 counter_u64_add_protected.9 \ counter.9 counter_u64_fetch.9 \ - counter.9 counter_u64_zero.9 + counter.9 counter_u64_zero.9 \ + counter.9 SYSCTL_COUNTER_U64.9 \ + counter.9 SYSCTL_ADD_COUNTER_U64.9 \ + counter.9 SYSCTL_COUNTER_U64_ARRAY.9 \ + counter.9 SYSCTL_ADD_COUNTER_U64_ARRAY.9 MLINKS+=cpuset.9 CPUSET_T_INITIALIZER.9 \ cpuset.9 CPUSET_FSET.9 \ cpuset.9 CPU_CLR.9 \ diff --git a/share/man/man9/counter.9 b/share/man/man9/counter.9 index 85bc9fe15d68..0fcf2ad97ba8 100644 --- a/share/man/man9/counter.9 +++ b/share/man/man9/counter.9 @@ -215,6 +215,16 @@ amd64 single-instruction implementation. On some architectures updating a counter require a .Xr critical 9 section. +.Sh EXAMPLES +The following example creates a static counter array exported to +userspace through a sysctl: +.Bd -literal -offset indent +#define MY_SIZE 8 +static counter_u64_t array[MY_SIZE]; +SYSCTL_COUNTER_U64_ARRAY(_debug, OID_AUTO, counter_array, CTLFLAG_RW, + &array[0], MY_SIZE, "Test counter array"); +.Ed +.Pp .Sh SEE ALSO .Xr atomic 9 , .Xr critical 9 , |