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.diff -r1.18.2.1 -r1.18.2.2 src/external/cddl/osnet/dev/fbt/fbt.c
(pgoyette)
--- 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 | |||
141 | static void fbt_provide_module(void *, dtrace_modctl_t *); | 142 | static void fbt_provide_module(void *, dtrace_modctl_t *); | |
142 | static void fbt_destroy(void *, dtrace_id_t, void *); | 143 | static void fbt_destroy(void *, dtrace_id_t, void *); | |
143 | static int fbt_enable(void *, dtrace_id_t, void *); | 144 | static int fbt_enable(void *, dtrace_id_t, void *); | |
144 | static void fbt_disable(void *, dtrace_id_t, void *); | 145 | static void fbt_disable(void *, dtrace_id_t, void *); | |
145 | static void fbt_load(void); | 146 | static void fbt_load(void); | |
146 | static void fbt_suspend(void *, dtrace_id_t, void *); | 147 | static void fbt_suspend(void *, dtrace_id_t, void *); | |
147 | static void fbt_resume(void *, dtrace_id_t, void *); | 148 | static 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 | |||
155 | struct localcount fbt_localcount; | |||
156 | ||||
154 | static const struct cdevsw fbt_cdevsw = { | 157 | static 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 | |||
160 | static dtrace_pattr_t fbt_attr = { | 173 | static 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 | |||
168 | static dtrace_pops_t fbt_pops = { | 181 | static dtrace_pops_t fbt_pops = { | |
169 | NULL, | 182 | NULL, | |
170 | fbt_provide_module, | 183 | fbt_provide_module, |
--- 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. */ | |
74 | static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); | 75 | static void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); | |
75 | static void sdt_provide_probes(void *, const dtrace_probedesc_t *); | 76 | static void sdt_provide_probes(void *, const dtrace_probedesc_t *); | |
76 | static void sdt_destroy(void *, dtrace_id_t, void *); | 77 | static void sdt_destroy(void *, dtrace_id_t, void *); | |
77 | static int sdt_enable(void *, dtrace_id_t, void *); | 78 | static int sdt_enable(void *, dtrace_id_t, void *); | |
78 | static void sdt_disable(void *, dtrace_id_t, void *); | 79 | static 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__ | |
115 | static int | 116 | static int | |
116 | sdt_open(dev_t dev, int flags, int mode, struct lwp *l) | 117 | sdt_open(dev_t dev, int flags, int mode, struct lwp *l) | |
117 | { | 118 | { | |
118 | return (0); | 119 | return (0); | |
119 | } | 120 | } | |
120 | 121 | |||
122 | struct localcount sdt_localcount; | |||
123 | ||||
121 | static const struct cdevsw sdt_cdevsw = { | 124 | static 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 | |||
128 | static TAILQ_HEAD(, sdt_provider) sdt_prov_list; | 141 | static TAILQ_HEAD(, sdt_provider) sdt_prov_list; | |
129 | 142 | |||
130 | #ifdef __FreeBSD__ | 143 | #ifdef __FreeBSD__ | |
131 | eventhandler_tag sdt_kld_load_tag; | 144 | eventhandler_tag sdt_kld_load_tag; | |
132 | eventhandler_tag sdt_kld_unload_try_tag; | 145 | eventhandler_tag sdt_kld_unload_try_tag; | |
133 | #endif | 146 | #endif | |
134 | 147 | |||
135 | #ifdef __NetBSD__ | 148 | #ifdef __NetBSD__ | |
136 | static char * | 149 | static char * | |
137 | strdup(const char *s, const struct malloc_type *m) | 150 | strdup(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); |
--- 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 */ | |
144 | module_t *mod_nbsd = NULL; | 145 | module_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 | |
15328 | static void | 15329 | static void | |
15329 | dtrace_dtr(void *data __unused) | 15330 | dtrace_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) | |
15336 | static dev_type_open(dtrace_open); | 15337 | static 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 | ||||
15342 | struct localcount dtrace_localcount; | |||
15343 | ||||
15340 | const struct cdevsw dtrace_cdevsw = { | 15344 | const 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 | |||
15346 | static int dtrace_ioctl(struct file *fp, u_long cmd, void *data); | 15360 | static int dtrace_ioctl(struct file *fp, u_long cmd, void *data); | |
15347 | static int dtrace_close(struct file *fp); | 15361 | static int dtrace_close(struct file *fp); | |
15348 | 15362 | |||
15349 | static const struct fileops dtrace_fileops = { | 15363 | static 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, |