Date: Tue, 15 Oct 2013 10:05:37 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256514 - in head: lib/libkvm sys/sys Message-ID: <201310151005.r9FA5bDq090573@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Tue Oct 15 10:05:37 2013 New Revision: 256514 URL: http://svnweb.freebsd.org/changeset/base/256514 Log: - While we are spreading the counter(9) across network stack, more userland tools would need to know about the counter_u64_t type. Allow to include sys/counter.h from userspace. - Utilize now defined type in kvm_counter_u64_fetch(). Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: head/lib/libkvm/kvm_pcpu.c head/sys/sys/counter.h Modified: head/lib/libkvm/kvm_pcpu.c ============================================================================== --- head/lib/libkvm/kvm_pcpu.c Tue Oct 15 10:01:15 2013 (r256513) +++ head/lib/libkvm/kvm_pcpu.c Tue Oct 15 10:05:37 2013 (r256514) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/pcpu.h> #include <sys/sysctl.h> +#include <sys/counter.h> #include <kvm.h> #include <limits.h> #include <stdlib.h> @@ -319,7 +320,8 @@ kvm_read_zpcpu(kvm_t *kd, void *buf, u_l uint64_t kvm_counter_u64_fetch(kvm_t *kd, u_long base) { - uint64_t r, c; + counter_u64_t c; + uint64_t r; if (mp_ncpus == 0) if (_kvm_pcpu_init(kd) < 0) Modified: head/sys/sys/counter.h ============================================================================== --- head/sys/sys/counter.h Tue Oct 15 10:01:15 2013 (r256513) +++ head/sys/sys/counter.h Tue Oct 15 10:05:37 2013 (r256514) @@ -31,6 +31,7 @@ typedef uint64_t *counter_u64_t; +#ifdef _KERNEL #include <machine/counter.h> counter_u64_t counter_u64_alloc(int); @@ -58,4 +59,5 @@ uint64_t counter_u64_fetch(counter_u64_t for (int i = 0; i < (n); i++) \ counter_u64_zero((a)[i]); \ } while (0) +#endif /* _KERNEL */ #endif /* ! __SYS_COUNTER_H__ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310151005.r9FA5bDq090573>