Sun Jul 17 05:18:12 2016 UTC ()
Add the d_localcount member to the various {b,c}devsw structures.

No need for these to be conditional on _MODULE as dtrace is always
a module.


(pgoyette)
diff -r1.18.2.1 -r1.18.2.2 src/external/cddl/osnet/dev/fbt/fbt.c
diff -r1.16.2.1 -r1.16.2.2 src/external/cddl/osnet/dev/sdt/sdt.c
diff -r1.32.2.1 -r1.32.2.2 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c

cvs diff -r1.18.2.1 -r1.18.2.2 src/external/cddl/osnet/dev/fbt/fbt.c (expand / switch to unified diff)

--- src/external/cddl/osnet/dev/fbt/fbt.c 2016/07/16 11:27:12 1.18.2.1
+++ src/external/cddl/osnet/dev/fbt/fbt.c 2016/07/17 05:18:11 1.18.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fbt.c,v 1.18.2.1 2016/07/16 11:27:12 pgoyette Exp $ */ 1/* $NetBSD: fbt.c,v 1.18.2.2 2016/07/17 05:18:11 pgoyette Exp $ */
2 2
3/* 3/*
4 * CDDL HEADER START 4 * CDDL HEADER START
5 * 5 *
6 * The contents of this file are subject to the terms of the 6 * The contents of this file are subject to the terms of the
7 * Common Development and Distribution License (the "License"). 7 * Common Development and Distribution License (the "License").
8 * You may not use this file except in compliance with the License. 8 * You may not use this file except in compliance with the License.
9 * 9 *
10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 * or http://www.opensolaris.org/os/licensing. 11 * or http://www.opensolaris.org/os/licensing.
12 * See the License for the specific language governing permissions 12 * See the License for the specific language governing permissions
13 * and limitations under the License. 13 * and limitations under the License.
14 * 14 *
@@ -46,26 +46,27 @@ @@ -46,26 +46,27 @@
46#include <sys/kthread.h> 46#include <sys/kthread.h>
47#include <sys/limits.h> 47#include <sys/limits.h>
48#include <sys/linker.h> 48#include <sys/linker.h>
49#include <sys/lock.h> 49#include <sys/lock.h>
50#include <sys/malloc.h> 50#include <sys/malloc.h>
51#include <sys/module.h> 51#include <sys/module.h>
52#include <sys/mutex.h> 52#include <sys/mutex.h>
53#include <sys/poll.h> 53#include <sys/poll.h>
54#include <sys/proc.h> 54#include <sys/proc.h>
55#include <sys/selinfo.h> 55#include <sys/selinfo.h>
56#include <sys/syscall.h> 56#include <sys/syscall.h>
57#include <sys/uio.h> 57#include <sys/uio.h>
58#include <sys/unistd.h> 58#include <sys/unistd.h>
 59#include <sys/localcount.h>
59 60
60#include <machine/cpu.h> 61#include <machine/cpu.h>
61#if defined(__i386__) || defined(__amd64__) 62#if defined(__i386__) || defined(__amd64__)
62#include <machine/cpufunc.h> 63#include <machine/cpufunc.h>
63#include <machine/specialreg.h> 64#include <machine/specialreg.h>
64#if 0 65#if 0
65#include <x86/cpuvar.h> 66#include <x86/cpuvar.h>
66#endif 67#endif
67#include <x86/cputypes.h> 68#include <x86/cputypes.h>
68#elif __arm__ 69#elif __arm__
69#include <machine/trap.h> 70#include <machine/trap.h>
70#include <arm/cpufunc.h> 71#include <arm/cpufunc.h>
71#include <arm/armreg.h> 72#include <arm/armreg.h>
@@ -141,30 +142,42 @@ static void fbt_getargdesc(void *, dtrac @@ -141,30 +142,42 @@ static void fbt_getargdesc(void *, dtrac
141static void fbt_provide_module(void *, dtrace_modctl_t *); 142static void fbt_provide_module(void *, dtrace_modctl_t *);
142static void fbt_destroy(void *, dtrace_id_t, void *); 143static void fbt_destroy(void *, dtrace_id_t, void *);
143static int fbt_enable(void *, dtrace_id_t, void *); 144static int fbt_enable(void *, dtrace_id_t, void *);
144static void fbt_disable(void *, dtrace_id_t, void *); 145static void fbt_disable(void *, dtrace_id_t, void *);
145static void fbt_load(void); 146static void fbt_load(void);
146static void fbt_suspend(void *, dtrace_id_t, void *); 147static void fbt_suspend(void *, dtrace_id_t, void *);
147static void fbt_resume(void *, dtrace_id_t, void *); 148static void fbt_resume(void *, dtrace_id_t, void *);
148 149
149#define FBT_ENTRY "entry" 150#define FBT_ENTRY "entry"
150#define FBT_RETURN "return" 151#define FBT_RETURN "return"
151#define FBT_ADDR2NDX(addr) ((((uintptr_t)(addr)) >> 4) & fbt_probetab_mask) 152#define FBT_ADDR2NDX(addr) ((((uintptr_t)(addr)) >> 4) & fbt_probetab_mask)
152#define FBT_PROBETAB_SIZE 0x8000 /* 32k entries -- 128K total */ 153#define FBT_PROBETAB_SIZE 0x8000 /* 32k entries -- 128K total */
153 154
 155struct localcount fbt_localcount;
 156
154static const struct cdevsw fbt_cdevsw = { 157static const struct cdevsw fbt_cdevsw = {
155 fbt_open, noclose, noread, nowrite, noioctl, 158 .d_open = fbt_open,
156 nostop, notty, nopoll, nommap, nokqfilter, nodiscard, 159 .d_close = noclose,
157 D_OTHER, NULL 160 .d_read = noread,
 161 .d_write = nowrite,
 162 .d_ioctl = noioctl,
 163 .d_stop = nostop,
 164 .d_tty = notty,
 165 .d_poll = nopoll,
 166 .d_mmap = nommap,
 167 .d_kqfilter = nokqfilter,
 168 .d_discard = nodiscard,
 169 .d_localcount = fbt_localcount,
 170 .d_flag = D_OTHER
158}; 171};
159 172
160static dtrace_pattr_t fbt_attr = { 173static dtrace_pattr_t fbt_attr = {
161{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 174{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
162{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 175{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
163{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 176{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
164{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 177{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
165{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 178{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
166}; 179};
167 180
168static dtrace_pops_t fbt_pops = { 181static dtrace_pops_t fbt_pops = {
169 NULL, 182 NULL,
170 fbt_provide_module, 183 fbt_provide_module,

cvs diff -r1.16.2.1 -r1.16.2.2 src/external/cddl/osnet/dev/sdt/sdt.c (expand / switch to unified diff)

--- src/external/cddl/osnet/dev/sdt/sdt.c 2016/07/16 11:27:12 1.16.2.1
+++ src/external/cddl/osnet/dev/sdt/sdt.c 2016/07/17 05:18:11 1.16.2.2
@@ -29,51 +29,52 @@ @@ -29,51 +29,52 @@
29 * framework for DTrace. Probes and SDT providers are defined using the macros 29 * framework for DTrace. Probes and SDT providers are defined using the macros
30 * in sys/sdt.h, which append all the needed structures to linker sets. When 30 * in sys/sdt.h, which append all the needed structures to linker sets. When
31 * this module is loaded, it iterates over all of the loaded modules and 31 * this module is loaded, it iterates over all of the loaded modules and
32 * registers probes and providers with the DTrace framework based on the 32 * registers probes and providers with the DTrace framework based on the
33 * contents of these linker sets. 33 * contents of these linker sets.
34 * 34 *
35 * A list of SDT providers is maintained here since a provider may span multiple 35 * A list of SDT providers is maintained here since a provider may span multiple
36 * modules. When a kernel module is unloaded, a provider defined in that module 36 * modules. When a kernel module is unloaded, a provider defined in that module
37 * is unregistered only if no other modules refer to it. The DTrace framework is 37 * is unregistered only if no other modules refer to it. The DTrace framework is
38 * responsible for destroying individual probes when a kernel module is 38 * responsible for destroying individual probes when a kernel module is
39 * unloaded; in particular, probes may not span multiple kernel modules. 39 * unloaded; in particular, probes may not span multiple kernel modules.
40 */ 40 */
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.16.2.1 2016/07/16 11:27:12 pgoyette Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.16.2.2 2016/07/17 05:18:11 pgoyette Exp $");
43 43
44#include <sys/cdefs.h> 44#include <sys/cdefs.h>
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/systm.h> 46#include <sys/systm.h>
47 47
48#include <sys/conf.h> 48#include <sys/conf.h>
49#ifdef __FreeBSD__ 49#ifdef __FreeBSD__
50#include <sys/eventhandler.h> 50#include <sys/eventhandler.h>
51#endif 51#endif
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/limits.h> 53#include <sys/limits.h>
54#ifdef __FreeBSD__ 54#ifdef __FreeBSD__
55#include <sys/linker.h> 55#include <sys/linker.h>
56#include <sys/linker_set.h> 56#include <sys/linker_set.h>
57#endif 57#endif
58#include <sys/lock.h> 58#include <sys/lock.h>
59#ifdef __FreeBSD__ 59#ifdef __FreeBSD__
60#include <sys/lockstat.h> 60#include <sys/lockstat.h>
61#endif 61#endif
62#include <sys/malloc.h> 62#include <sys/malloc.h>
63#include <sys/kmem.h> 63#include <sys/kmem.h>
64#include <sys/module.h> 64#include <sys/module.h>
65#include <sys/mutex.h> 65#include <sys/mutex.h>
66#include <sys/queue.h> 66#include <sys/queue.h>
 67#include <sys/localcount.h>
67#define KDTRACE_HOOKS 68#define KDTRACE_HOOKS
68#include <sys/sdt.h> 69#include <sys/sdt.h>
69 70
70#include <sys/dtrace.h> 71#include <sys/dtrace.h>
71#include <sys/dtrace_bsd.h> 72#include <sys/dtrace_bsd.h>
72 73
73/* DTrace methods. */ 74/* DTrace methods. */
74static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); 75static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
75static void sdt_provide_probes(void *, const dtrace_probedesc_t *); 76static void sdt_provide_probes(void *, const dtrace_probedesc_t *);
76static void sdt_destroy(void *, dtrace_id_t, void *); 77static void sdt_destroy(void *, dtrace_id_t, void *);
77static int sdt_enable(void *, dtrace_id_t, void *); 78static int sdt_enable(void *, dtrace_id_t, void *);
78static void sdt_disable(void *, dtrace_id_t, void *); 79static void sdt_disable(void *, dtrace_id_t, void *);
79 80
@@ -108,33 +109,45 @@ static dtrace_pops_t sdt_pops = { @@ -108,33 +109,45 @@ static dtrace_pops_t sdt_pops = {
108 sdt_getargdesc, 109 sdt_getargdesc,
109 NULL, 110 NULL,
110 NULL, 111 NULL,
111 sdt_destroy, 112 sdt_destroy,
112}; 113};
113 114
114#ifdef __NetBSD__ 115#ifdef __NetBSD__
115static int 116static int
116sdt_open(dev_t dev, int flags, int mode, struct lwp *l) 117sdt_open(dev_t dev, int flags, int mode, struct lwp *l)
117{ 118{
118 return (0); 119 return (0);
119} 120}
120 121
 122struct localcount sdt_localcount;
 123
121static const struct cdevsw sdt_cdevsw = { 124static const struct cdevsw sdt_cdevsw = {
122 sdt_open, noclose, noread, nowrite, noioctl, 125 .d_open = sdt_open,
123 nostop, notty, nopoll, nommap, nokqfilter, nodiscard, 126 .d_close = noclose,
124 D_OTHER, NULL 127 .d_read = noread,
 128 .d_write = nowrite,
 129 .d_ioctl = noioctl,
 130 .d_stop = nostop,
 131 .d_tty = notty,
 132 .d_poll = nopoll,
 133 .d_mmap = nommap,
 134 .d_kqfilter = nokqfilter,
 135 .d_discard = nodiscard,
 136 .d_localcount = sdt_localcount,
 137 .d_flag = D_OTHER
125}; 138};
126#endif 139#endif
127 140
128static TAILQ_HEAD(, sdt_provider) sdt_prov_list; 141static TAILQ_HEAD(, sdt_provider) sdt_prov_list;
129 142
130#ifdef __FreeBSD__ 143#ifdef __FreeBSD__
131eventhandler_tag sdt_kld_load_tag; 144eventhandler_tag sdt_kld_load_tag;
132eventhandler_tag sdt_kld_unload_try_tag; 145eventhandler_tag sdt_kld_unload_try_tag;
133#endif 146#endif
134 147
135#ifdef __NetBSD__ 148#ifdef __NetBSD__
136static char * 149static char *
137strdup(const char *s, const struct malloc_type *m) 150strdup(const char *s, const struct malloc_type *m)
138{ 151{
139 size_t l = strlen(s) + 1; 152 size_t l = strlen(s) + 1;
140 char *d = malloc(l, m, M_WAITOK); 153 char *d = malloc(l, m, M_WAITOK);

cvs diff -r1.32.2.1 -r1.32.2.2 src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c (expand / switch to unified diff)

--- src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c 2016/07/16 11:27:12 1.32.2.1
+++ src/external/cddl/osnet/dist/uts/common/dtrace/dtrace.c 2016/07/17 05:18:11 1.32.2.2
@@ -124,26 +124,27 @@ @@ -124,26 +124,27 @@
124#include <sys/kernel.h> 124#include <sys/kernel.h>
125#include <sys/malloc.h> 125#include <sys/malloc.h>
126#include <sys/sysctl.h> 126#include <sys/sysctl.h>
127#include <sys/lock.h> 127#include <sys/lock.h>
128#include <sys/mutex.h> 128#include <sys/mutex.h>
129#include <sys/rwlock.h> 129#include <sys/rwlock.h>
130//#include <sys/sx.h> 130//#include <sys/sx.h>
131#include <sys/file.h> 131#include <sys/file.h>
132#include <sys/filedesc.h> 132#include <sys/filedesc.h>
133#include <sys/dtrace_bsd.h> 133#include <sys/dtrace_bsd.h>
134#include <sys/vmem.h> 134#include <sys/vmem.h>
135#include <sys/module.h> 135#include <sys/module.h>
136#include <sys/cpu.h> 136#include <sys/cpu.h>
 137#include <sys/localcount.h>
137#include <netinet/in.h> 138#include <netinet/in.h>
138#include "dtrace_cddl.h" 139#include "dtrace_cddl.h"
139#include "dtrace_debug.c" 140#include "dtrace_debug.c"
140#endif 141#endif
141 142
142#if !defined(sun) 143#if !defined(sun)
143/* fake module entry for netbsd */ 144/* fake module entry for netbsd */
144module_t *mod_nbsd = NULL; 145module_t *mod_nbsd = NULL;
145#endif 146#endif
146 147
147/* 148/*
148 * DTrace Tunable Variables 149 * DTrace Tunable Variables
149 * 150 *
@@ -15327,30 +15328,43 @@ dtrace_attach(dev_info_t *devi, ddi_atta @@ -15327,30 +15328,43 @@ dtrace_attach(dev_info_t *devi, ddi_atta
15327#if __FreeBSD_version >= 800039 15328#if __FreeBSD_version >= 800039
15328static void 15329static void
15329dtrace_dtr(void *data __unused) 15330dtrace_dtr(void *data __unused)
15330{ 15331{
15331} 15332}
15332#endif 15333#endif
15333#endif 15334#endif
15334 15335
15335#if !defined(sun) 15336#if !defined(sun)
15336static dev_type_open(dtrace_open); 15337static dev_type_open(dtrace_open);
15337 15338
15338/* Pseudo Device Entry points */ 15339/* Pseudo Device Entry points */
15339/* Just opens, clones to the fileops below */ 15340/* Just opens, clones to the fileops below */
 15341
 15342struct localcount dtrace_localcount;
 15343
15340const struct cdevsw dtrace_cdevsw = { 15344const struct cdevsw dtrace_cdevsw = {
15341 dtrace_open, noclose, noread, nowrite, noioctl, 15345 .d_open = dtrace_open,
15342 nostop, notty, nopoll, nommap, nokqfilter, nodiscard, 15346 .d_close = noclose,
15343 D_OTHER | D_MPSAFE, NULL 15347 .d_read = noread,
 15348 .d_write = nowrite,
 15349 .d_ioctl = noioctl,
 15350 .d_stop = nostop,
 15351 .d_tty = notty,
 15352 .d_poll = nopoll,
 15353 .d_mmap = nommap,
 15354 .d_kqfilter = nokqfilter,
 15355 .d_discard = nodiscard,
 15356 .d_localcount = dtrace_localcount,
 15357 .d_flag = D_OTHER | D_MPSAFE
15344}; 15358};
15345 15359
15346static int dtrace_ioctl(struct file *fp, u_long cmd, void *data); 15360static int dtrace_ioctl(struct file *fp, u_long cmd, void *data);
15347static int dtrace_close(struct file *fp); 15361static int dtrace_close(struct file *fp);
15348 15362
15349static const struct fileops dtrace_fileops = { 15363static const struct fileops dtrace_fileops = {
15350 .fo_read = fbadop_read, 15364 .fo_read = fbadop_read,
15351 .fo_write = fbadop_write, 15365 .fo_write = fbadop_write,
15352 .fo_ioctl = dtrace_ioctl, 15366 .fo_ioctl = dtrace_ioctl,
15353 .fo_fcntl = fnullop_fcntl, 15367 .fo_fcntl = fnullop_fcntl,
15354 .fo_poll = fnullop_poll, 15368 .fo_poll = fnullop_poll,
15355 .fo_stat = fbadop_stat, 15369 .fo_stat = fbadop_stat,
15356 .fo_close = dtrace_close, 15370 .fo_close = dtrace_close,