Fri Jul 29 13:10:23 2011 UTC ()
KNF.


(uebayasi)
diff -r1.6 -r1.7 src/external/cddl/osnet/dev/sdt/sdt.c

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

--- src/external/cddl/osnet/dev/sdt/sdt.c 2010/03/13 22:31:15 1.6
+++ src/external/cddl/osnet/dev/sdt/sdt.c 2011/07/29 13:10:23 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sdt.c,v 1.6 2010/03/13 22:31:15 christos Exp $ */ 1/* $NetBSD: sdt.c,v 1.7 2011/07/29 13:10:23 uebayasi Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by CoyotePoint Systems, Inc. It was developed under contract to  8 * by CoyotePoint Systems, Inc. It was developed under contract to
9 * CoyotePoint by Darran Hunt. 9 * CoyotePoint by Darran Hunt.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -97,57 +97,57 @@ SDT_PROBE_DECLARE(proc,,,create); @@ -97,57 +97,57 @@ SDT_PROBE_DECLARE(proc,,,create);
97SDT_PROBE_DECLARE(proc,,,exec); 97SDT_PROBE_DECLARE(proc,,,exec);
98SDT_PROBE_DECLARE(proc,,,exec_success); 98SDT_PROBE_DECLARE(proc,,,exec_success);
99SDT_PROBE_DECLARE(proc,,,exec_failure); 99SDT_PROBE_DECLARE(proc,,,exec_failure);
100SDT_PROBE_DECLARE(proc,,,signal_send); 100SDT_PROBE_DECLARE(proc,,,signal_send);
101SDT_PROBE_DECLARE(proc,,,signal_discard); 101SDT_PROBE_DECLARE(proc,,,signal_discard);
102SDT_PROBE_DECLARE(proc,,,signal_clear); 102SDT_PROBE_DECLARE(proc,,,signal_clear);
103SDT_PROBE_DECLARE(proc,,,signal_handle); 103SDT_PROBE_DECLARE(proc,,,signal_handle);
104SDT_PROBE_DECLARE(proc,,,lwp_create); 104SDT_PROBE_DECLARE(proc,,,lwp_create);
105SDT_PROBE_DECLARE(proc,,,lwp_start); 105SDT_PROBE_DECLARE(proc,,,lwp_start);
106SDT_PROBE_DECLARE(proc,,,lwp_exit); 106SDT_PROBE_DECLARE(proc,,,lwp_exit);
107 107
108/* define the provider */ 108/* define the provider */
109static sdt_provider_t l7_provider = { 109static sdt_provider_t l7_provider = {
110 "proc", /* provider name */ 110 "proc", /* provider name */
111 0, /* registered ID - leave as 0 */ 111 0, /* registered ID - leave as 0 */
112 { 112 {
113 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 113 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
114 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 114 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
115 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 115 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
116 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, 116 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
117 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 117 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
118 }, 118 },
119 119
120 /* list all probes belonging to the provider */ 120 /* list all probes belonging to the provider */
121 {  121 {
122 &SDT_NAME(proc,,,create), 122 &SDT_NAME(proc,,,create),
123 &SDT_NAME(proc,,,exec), 123 &SDT_NAME(proc,,,exec),
124 &SDT_NAME(proc,,,exec_success), 124 &SDT_NAME(proc,,,exec_success),
125 &SDT_NAME(proc,,,exec_failure), 125 &SDT_NAME(proc,,,exec_failure),
126 &SDT_NAME(proc,,,signal_send), 126 &SDT_NAME(proc,,,signal_send),
127 &SDT_NAME(proc,,,signal_discard), 127 &SDT_NAME(proc,,,signal_discard),
128 &SDT_NAME(proc,,,signal_clear), 128 &SDT_NAME(proc,,,signal_clear),
129 &SDT_NAME(proc,,,signal_handle), 129 &SDT_NAME(proc,,,signal_handle),
130 &SDT_NAME(proc,,,lwp_create), 130 &SDT_NAME(proc,,,lwp_create),
131 &SDT_NAME(proc,,,lwp_start), 131 &SDT_NAME(proc,,,lwp_start),
132 &SDT_NAME(proc,,,lwp_exit), 132 &SDT_NAME(proc,,,lwp_exit),
133 NULL /* NULL terminated list */ 133 NULL /* NULL terminated list */
134 } 134 }
135}; 135};
136 136
137/* list of local providers to register with DTrace */ 137/* list of local providers to register with DTrace */
138static sdt_provider_t *sdt_providers[] = { 138static sdt_provider_t *sdt_providers[] = {
139 &l7_provider, 139 &l7_provider,
140 NULL /* NULL terminated list */ 140 NULL /* NULL terminated list */
141}; 141};
142 142
143static sdt_provider_t **sdt_list = NULL; /* registered provider list */ 143static sdt_provider_t **sdt_list = NULL; /* registered provider list */
144static kmutex_t sdt_mutex; 144static kmutex_t sdt_mutex;
145static int sdt_count = 0; /* number of registered providers */ 145static int sdt_count = 0; /* number of registered providers */
146 146
147static void 147static void
148sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) 148sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc)
149{ 149{
150 sdt_probe_t *sprobe = parg; 150 sdt_probe_t *sprobe = parg;
151 151
152#ifdef SDT_DEBUG 152#ifdef SDT_DEBUG
153 printf("sdt: %s probe %d\n", __func__, id); 153 printf("sdt: %s probe %d\n", __func__, id);
@@ -157,27 +157,27 @@ sdt_getargdesc(void *arg, dtrace_id_t id @@ -157,27 +157,27 @@ sdt_getargdesc(void *arg, dtrace_id_t id
157 sprobe->module, 157 sprobe->module,
158 sprobe->function, 158 sprobe->function,
159 sprobe->name, 159 sprobe->name,
160 desc->dtargd_ndx); 160 desc->dtargd_ndx);
161#endif 161#endif
162 162
163 /* provide up to 5 arguments */ 163 /* provide up to 5 arguments */
164 if ((desc->dtargd_ndx < SDT_MAX_ARGS) && 164 if ((desc->dtargd_ndx < SDT_MAX_ARGS) &&
165 (sprobe->argv[desc->dtargd_ndx] != NULL)) { 165 (sprobe->argv[desc->dtargd_ndx] != NULL)) {
166 strncpy(desc->dtargd_native, sprobe->argv[desc->dtargd_ndx], 166 strncpy(desc->dtargd_native, sprobe->argv[desc->dtargd_ndx],
167 sizeof(desc->dtargd_native)); 167 sizeof(desc->dtargd_native));
168 desc->dtargd_mapping = desc->dtargd_ndx; 168 desc->dtargd_mapping = desc->dtargd_ndx;
169 if (sprobe->argx[desc->dtargd_ndx] != NULL) { 169 if (sprobe->argx[desc->dtargd_ndx] != NULL) {
170 strncpy(desc->dtargd_xlate, sprobe->argx[desc->dtargd_ndx], 170 strncpy(desc->dtargd_xlate, sprobe->argx[desc->dtargd_ndx],
171 sizeof(desc->dtargd_xlate)); 171 sizeof(desc->dtargd_xlate));
172 } 172 }
173#ifdef SDT_DEBUG 173#ifdef SDT_DEBUG
174 printf("%s: probe %d (%s:%s:%s:%s).%d = %s\n", 174 printf("%s: probe %d (%s:%s:%s:%s).%d = %s\n",
175 __func__, id, 175 __func__, id,
176 sprobe->provider, 176 sprobe->provider,
177 sprobe->module, 177 sprobe->module,
178 sprobe->function, 178 sprobe->function,
179 sprobe->name, 179 sprobe->name,
180 desc->dtargd_ndx, 180 desc->dtargd_ndx,
181 sprobe->argv[desc->dtargd_ndx]); 181 sprobe->argv[desc->dtargd_ndx]);
182#endif 182#endif
183 } else { 183 } else {
@@ -187,270 +187,270 @@ sdt_getargdesc(void *arg, dtrace_id_t id @@ -187,270 +187,270 @@ sdt_getargdesc(void *arg, dtrace_id_t id
187 sprobe->provider, 187 sprobe->provider,
188 sprobe->module, 188 sprobe->module,
189 sprobe->function, 189 sprobe->function,
190 sprobe->name, 190 sprobe->name,
191 desc->dtargd_ndx); 191 desc->dtargd_ndx);
192 desc->dtargd_ndx = DTRACE_ARGNONE; 192 desc->dtargd_ndx = DTRACE_ARGNONE;
193#endif 193#endif
194 } 194 }
195} 195}
196 196
197static void 197static void
198sdt_provide(void *arg, const dtrace_probedesc_t *desc) 198sdt_provide(void *arg, const dtrace_probedesc_t *desc)
199{ 199{
200 sdt_provider_t *sprov = arg; 200 sdt_provider_t *sprov = arg;
201 int res; 201 int res;
202 int ind; 202 int ind;
203 int num_probes=0; 203 int num_probes = 0;
204 204
205#ifdef SDT_DEBUG 205#ifdef SDT_DEBUG
206 if (desc == NULL) { 206 if (desc == NULL) {
207 printf("sdt: provide null\n"); 207 printf("sdt: provide null\n");
208 } else { 208 } else {
209 printf("sdt: provide %d %02x:%02x:%02x:%02x\n", 209 printf("sdt: provide %d %02x:%02x:%02x:%02x\n",
210 desc->dtpd_id, 210 desc->dtpd_id,
211 desc->dtpd_provider[0], 211 desc->dtpd_provider[0],
212 desc->dtpd_mod[0], 212 desc->dtpd_mod[0],
213 desc->dtpd_func[0], 213 desc->dtpd_func[0],
214 desc->dtpd_name[0]); 214 desc->dtpd_name[0]);
215 } 215 }
216#endif 216#endif
217 217
218 for (ind=0; sprov->probes[ind] != NULL; ind++) { 218 for (ind = 0; sprov->probes[ind] != NULL; ind++) {
219 if (sprov->probes[ind]->created == 0) { 219 if (sprov->probes[ind]->created == 0) {
220 res = dtrace_probe_create(sprov->id, 220 res = dtrace_probe_create(sprov->id,
221 sprov->probes[ind]->module, 221 sprov->probes[ind]->module,
222 sprov->probes[ind]->function, 222 sprov->probes[ind]->function,
223 sprov->probes[ind]->name, 223 sprov->probes[ind]->name,
224 0, sprov->probes[ind]); 224 0, sprov->probes[ind]);
225 sprov->probes[ind]->id = res; 225 sprov->probes[ind]->id = res;
226#ifdef SDT_DEBUG 226#ifdef SDT_DEBUG
227 printf("%s: dtrace_probe_create[%d] res=%d\n", 227 printf("%s: dtrace_probe_create[%d] res=%d\n",
228 __func__, ind, res); 228 __func__, ind, res);
229#endif 229#endif
230 sprov->probes[ind]->created = 1; 230 sprov->probes[ind]->created = 1;
231 num_probes++; 231 num_probes++;
232 } 232 }
233 } 233 }
234 234
235#ifdef SDT_DEBUG 235#ifdef SDT_DEBUG
236 printf("sdt: %s num_probes %d\n", __func__, ind); 236 printf("sdt: %s num_probes %d\n", __func__, ind);
237#endif 237#endif
238 238
239} 239}
240 240
241static void 241static void
242sdt_destroy(void *arg, dtrace_id_t id, void *parg) 242sdt_destroy(void *arg, dtrace_id_t id, void *parg)
243{ 243{
244 sdt_provider_t *sprov = arg; 244 sdt_provider_t *sprov = arg;
245 int ind; 245 int ind;
246 246
247#ifdef SDT_DEBUG 247#ifdef SDT_DEBUG
248 printf("sdt: %s\n", __func__); 248 printf("sdt: %s\n", __func__);
249#endif 249#endif
250 250
251 for (ind=0; sprov->probes[ind] != NULL; ind++) { 251 for (ind = 0; sprov->probes[ind] != NULL; ind++) {
252 if (sprov->probes[ind]->id == id) { 252 if (sprov->probes[ind]->id == id) {
253#ifdef SDT_DEBUG 253#ifdef SDT_DEBUG
254 printf("%s: destroying probe %d (%s:%s:%s:%s)\n", 254 printf("%s: destroying probe %d (%s:%s:%s:%s)\n",
255 __func__, id, 255 __func__, id,
256 sprov->probes[ind]->provider, 256 sprov->probes[ind]->provider,
257 sprov->probes[ind]->module, 257 sprov->probes[ind]->module,
258 sprov->probes[ind]->function, 258 sprov->probes[ind]->function,
259 sprov->probes[ind]->name); 259 sprov->probes[ind]->name);
260#endif 260#endif
261 sprov->probes[ind]->enabled = 0; 261 sprov->probes[ind]->enabled = 0;
262 sprov->probes[ind]->created = 0; 262 sprov->probes[ind]->created = 0;
263 sprov->probes[ind]->id = 0; 263 sprov->probes[ind]->id = 0;
264 break; 264 break;
265 } 265 }
266 } 266 }
267} 267}
268 268
269static int 269static int
270sdt_enable(void *arg, dtrace_id_t id, void *parg) 270sdt_enable(void *arg, dtrace_id_t id, void *parg)
271{ 271{
272 sdt_provider_t *sprov = arg; 272 sdt_provider_t *sprov = arg;
273 int ind; 273 int ind;
274 274
275#ifdef SDT_DEBUG 275#ifdef SDT_DEBUG
276 printf("sdt: %s\n", __func__); 276 printf("sdt: %s\n", __func__);
277#endif 277#endif
278 278
279 for (ind=0; sprov->probes[ind] != NULL; ind++) { 279 for (ind = 0; sprov->probes[ind] != NULL; ind++) {
280 if (sprov->probes[ind]->id == id) { 280 if (sprov->probes[ind]->id == id) {
281#ifdef SDT_DEBUG 281#ifdef SDT_DEBUG
282 printf("%s: enabling probe %d (%s:%s:%s:%s)\n", 282 printf("%s: enabling probe %d (%s:%s:%s:%s)\n",
283 __func__, id, 283 __func__, id,
284 sprov->probes[ind]->provider, 284 sprov->probes[ind]->provider,
285 sprov->probes[ind]->module, 285 sprov->probes[ind]->module,
286 sprov->probes[ind]->function, 286 sprov->probes[ind]->function,
287 sprov->probes[ind]->name); 287 sprov->probes[ind]->name);
288#endif 288#endif
289 sprov->probes[ind]->enabled = 1; 289 sprov->probes[ind]->enabled = 1;
290 break; 290 break;
291 } 291 }
292 } 292 }
293 293
294 return 0; 294 return 0;
295} 295}
296 296
297static void 297static void
298sdt_disable(void *arg, dtrace_id_t id, void *parg) 298sdt_disable(void *arg, dtrace_id_t id, void *parg)
299{ 299{
300 sdt_provider_t *sprov = arg; 300 sdt_provider_t *sprov = arg;
301 int ind; 301 int ind;
302 302
303#ifdef SDT_DEBUG 303#ifdef SDT_DEBUG
304 printf("sdt: %s\n", __func__); 304 printf("sdt: %s\n", __func__);
305#endif 305#endif
306 306
307 for (ind=0; sprov->probes[ind] != NULL; ind++) { 307 for (ind = 0; sprov->probes[ind] != NULL; ind++) {
308 if (sprov->probes[ind]->id == id) { 308 if (sprov->probes[ind]->id == id) {
309#ifdef SDT_DEBUG 309#ifdef SDT_DEBUG
310 printf("%s: disabling probe %d (%s:%s:%s:%s)\n", 310 printf("%s: disabling probe %d (%s:%s:%s:%s)\n",
311 __func__, id, 311 __func__, id,
312 sprov->probes[ind]->provider, 312 sprov->probes[ind]->provider,
313 sprov->probes[ind]->module, 313 sprov->probes[ind]->module,
314 sprov->probes[ind]->function, 314 sprov->probes[ind]->function,
315 sprov->probes[ind]->name); 315 sprov->probes[ind]->name);
316#endif 316#endif
317 sprov->probes[ind]->enabled = 0; 317 sprov->probes[ind]->enabled = 0;
318 break; 318 break;
319 } 319 }
320 } 320 }
321} 321}
322 322
323int 323int
324sdt_register(sdt_provider_t *prov) 324sdt_register(sdt_provider_t *prov)
325{ 325{
326 int ind; 326 int ind;
327 int res; 327 int res;
328 328
329 /* make sure the provider is not already registered */ 329 /* make sure the provider is not already registered */
330 for (ind=0; ind < sdt_count; ind++) { 330 for (ind = 0; ind < sdt_count; ind++) {
331 if (strncmp(sdt_list[ind]->name, prov->name, 331 if (strncmp(sdt_list[ind]->name, prov->name,
332 SDT_MAX_NAME_SIZE) == 0) { 332 SDT_MAX_NAME_SIZE) == 0) {
333 printf("sdt: provider %s already registered\n", prov->name); 333 printf("sdt: provider %s already registered\n", prov->name);
334 return -1; 334 return -1;
335 } 335 }
336 } 336 }
337 337
338 /* register the new provider */ 338 /* register the new provider */
339 if ((res = dtrace_register(prov->name,  339 if ((res = dtrace_register(prov->name,
340 &prov->attr, DTRACE_PRIV_USER, 340 &prov->attr, DTRACE_PRIV_USER,
341 NULL, &sdt_pops, prov, 341 NULL, &sdt_pops, prov,
342 &(prov->id))) != 0) { 342 &(prov->id))) != 0) {
343 printf("sdt: failed to register %s res = %d\n", 343 printf("sdt: failed to register %s res = %d\n",
344 prov->name, res); 344 prov->name, res);
345 return -1; 345 return -1;
346 } 346 }
347 347
348 sdt_list[sdt_count++] = prov; 348 sdt_list[sdt_count++] = prov;
349 349
350 return 0; 350 return 0;
351} 351}
352 352
353int 353int
354sdt_unregister(sdt_provider_t *prov) 354sdt_unregister(sdt_provider_t *prov)
355{ 355{
356 int ind; 356 int ind;
357 int res; 357 int res;
358 358
359 /* find the provider reference */ 359 /* find the provider reference */
360 for (ind=0; ind < sdt_count; ind++) { 360 for (ind = 0; ind < sdt_count; ind++) {
361 if (sdt_list[ind] == prov) { 361 if (sdt_list[ind] == prov) {
362 res = dtrace_unregister(sdt_list[ind]->id); 362 res = dtrace_unregister(sdt_list[ind]->id);
363 if (res != 0) { 363 if (res != 0) {
364 printf( 364 printf(
365 "sdt: failed to unregister provider %s\n", 365 "sdt: failed to unregister provider %s\n",
366 sdt_list[ind]->name); 366 sdt_list[ind]->name);
367 } 367 }
368 /* remove provider from list */ 368 /* remove provider from list */
369 sdt_list[ind] = sdt_list[--sdt_count]; 369 sdt_list[ind] = sdt_list[--sdt_count];
370 return 0;; 370 return 0;
371 } 371 }
372 } 372 }
373 373
374 /* provider not found */ 374 /* provider not found */
375 printf("sdt: provider %s not found\n", prov->name); 375 printf("sdt: provider %s not found\n", prov->name);
376 376
377 return 0; 377 return 0;
378} 378}
379 379
380static void 380static void
381sdt_load(void *dummy) 381sdt_load(void *dummy)
382{ 382{
383 int ind; 383 int ind;
384 384
385#ifdef SDT_DEBUG 385#ifdef SDT_DEBUG
386 printf("sdt: %s\n", __func__); 386 printf("sdt: %s\n", __func__);
387#endif 387#endif
388 388
389 sdt_init(dtrace_probe); 389 sdt_init(dtrace_probe);
390 390
391 sdt_list = kmem_alloc(sizeof(sdt_provider_t *) * SDT_MAX_PROVIDER, 391 sdt_list = kmem_alloc(sizeof(sdt_provider_t *) * SDT_MAX_PROVIDER,
392 KM_SLEEP); 392 KM_SLEEP);
393 393
394 mutex_init(&sdt_mutex, "sdt_mutex", MUTEX_DEFAULT, NULL); 394 mutex_init(&sdt_mutex, "sdt_mutex", MUTEX_DEFAULT, NULL);
395 395
396 sdt_count = 0; 396 sdt_count = 0;
397 397
398 if (sdt_list == NULL) { 398 if (sdt_list == NULL) {
399 printf("sdt: failed to alloc provider list\n"); 399 printf("sdt: failed to alloc provider list\n");
400 return; 400 return;
401 } 401 }
402 402
403 for (ind=0; sdt_providers[ind] != NULL; ind++) { 403 for (ind = 0; sdt_providers[ind] != NULL; ind++) {
404 if (sdt_count >= SDT_MAX_PROVIDER) { 404 if (sdt_count >= SDT_MAX_PROVIDER) {
405 printf("sdt: too many providers\n"); 405 printf("sdt: too many providers\n");
406 break; 406 break;
407 } 407 }
408 sdt_register(sdt_providers[ind]); 408 sdt_register(sdt_providers[ind]);
409 409
410#ifdef SDT_DEBUG 410#ifdef SDT_DEBUG
411 printf("sdt: registered %s id = 0x%x\n", 411 printf("sdt: registered %s id = 0x%x\n",
412 sdt_providers[ind]->name, 412 sdt_providers[ind]->name,
413 sdt_providers[ind]->id); 413 sdt_providers[ind]->id);
414#endif 414#endif
415 } 415 }
416} 416}
417 417
418 418
419static int 419static int
420sdt_unload() 420sdt_unload(void)
421{ 421{
422 int error = 0; 422 int error = 0;
423 int res = 0; 423 int res = 0;
424 int ind; 424 int ind;
425 425
426#ifdef SDT_DEBUG 426#ifdef SDT_DEBUG
427 printf("sdt: %s\n", __func__); 427 printf("sdt: %s\n", __func__);
428#endif 428#endif
429 429
430 for (ind=0; ind < sdt_count; ind++) { 430 for (ind = 0; ind < sdt_count; ind++) {
431 if ((res = dtrace_unregister(sdt_list[ind]->id)) != 0) { 431 if ((res = dtrace_unregister(sdt_list[ind]->id)) != 0) {
432#ifdef SDT_DEBUG 432#ifdef SDT_DEBUG
433 printf("%s: failed to unregister %s error = %d\n", 433 printf("%s: failed to unregister %s error = %d\n",
434 sdt_list[ind]->name, res); 434 sdt_list[ind]->name, res);
435#endif 435#endif
436 error = res; 436 error = res;
437 } else { 437 } else {
438#ifdef SDT_DEBUG 438#ifdef SDT_DEBUG
439 printf("sdt: unregistered %s id = %d\n", 439 printf("sdt: unregistered %s id = %d\n",
440 sdt_list[ind]->name, 440 sdt_list[ind]->name,
441 sdt_list[ind]->id); 441 sdt_list[ind]->id);
442#endif 442#endif
443 } 443 }
444 } 444 }
445 445
446 kmem_free(sdt_list, sizeof(sdt_provider_t *) * SDT_MAX_PROVIDER); 446 kmem_free(sdt_list, sizeof(sdt_provider_t *) * SDT_MAX_PROVIDER);
447 mutex_destroy(&sdt_mutex); 447 mutex_destroy(&sdt_mutex);
448 sdt_exit(); 448 sdt_exit();
449 return (error); 449 return (error);
450} 450}
451 451
452static int 452static int
453sdt_modcmd(modcmd_t cmd, void *data) 453sdt_modcmd(modcmd_t cmd, void *data)
454{ 454{
455 int bmajor = -1, cmajor = -1; 455 int bmajor = -1, cmajor = -1;
456 456