Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src DTrace: fix a few problems introduced by the recent ZFS upda...
details: https://anonhg.NetBSD.org/src/rev/d8fb3eeacfae
branches: trunk
changeset: 752554:d8fb3eeacfae
user: darran <darran%NetBSD.org@localhost>
date: Mon Mar 01 11:19:39 2010 +0000
description:
DTrace: fix a few problems introduced by the recent ZFS update (expected
problems from the OpenSolaris merge).
diffstat:
external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h | 14 +-
external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c | 12 +-
external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c | 2 +-
external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c | 16 +-
external/cddl/osnet/dist/uts/common/sys/sdt.h | 371 --------------
external/cddl/osnet/sys/sys/cpuvar.h | 3 +-
external/cddl/osnet/sys/sys/elf.h | 89 +---
external/cddl/osnet/sys/sys/modctl.h | 4 +-
external/cddl/osnet/sys/sys/policy.h | 6 +-
external/cddl/osnet/sys/sys/sdt.h | 22 +-
external/cddl/osnet/sys/sys/types.h | 3 +-
sys/sys/Makefile | 6 +-
sys/sys/exec_elf.h | 6 +-
13 files changed, 76 insertions(+), 478 deletions(-)
diffs (truncated from 813 to 300 lines):
diff -r d60c24ec6987 -r d8fb3eeacfae external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h Mon Mar 01 11:02:31 2010 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h Mon Mar 01 11:19:39 2010 +0000
@@ -40,7 +40,6 @@
#include <libctf.h>
#include <dtrace.h>
#include <gelf.h>
-#include <synch.h>
#ifdef __cplusplus
extern "C" {
@@ -600,6 +599,19 @@
extern uint64_t dt_stddev(uint64_t *, uint64_t);
+#define DT_MUTEX_HELD(x) dt_mutex_held(x)
+
+static inline int
+dt_mutex_held(pthread_mutex_t *lock)
+{
+#if defined(sun)
+ extern int _mutex_held(struct _lwp_mutex *);
+ return (_mutex_held((struct _lwp_mutex *)lock));
+#else
+ return (1);
+#endif
+}
+
extern int dt_options_load(dtrace_hdl_t *);
extern void dt_dprintf(const char *, ...);
diff -r d60c24ec6987 -r d8fb3eeacfae external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Mon Mar 01 11:02:31 2010 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Mon Mar 01 11:19:39 2010 +0000
@@ -23,6 +23,10 @@
* Use is subject to license terms.
*/
+#ifndef ELFSIZE
+#define ELFSIZE ARCH_ELFSIZE
+#endif
+
#include <sys/types.h>
#if defined(sun)
#include <sys/modctl.h>
@@ -79,7 +83,7 @@
#if STT_NUM != (STT_TLS + 1)
#error "STT_NUM has grown. update dt_module_syminit32()"
#endif
- const Elf32_Sym *sym = dmp->dm_symtab.cts_data;
+ Elf32_Sym *sym = dmp->dm_symtab.cts_data;
const char *base = dmp->dm_strtab.cts_data;
size_t ss_size = dmp->dm_strtab.cts_size;
uint_t i, n = dmp->dm_nsymelems;
@@ -116,7 +120,7 @@
#if STT_NUM != (STT_TLS + 1)
#error "STT_NUM has grown. update dt_module_syminit64()"
#endif
- const Elf64_Sym *sym = dmp->dm_symtab.cts_data;
+ Elf64_Sym *sym = dmp->dm_symtab.cts_data;
const char *base = dmp->dm_strtab.cts_data;
size_t ss_size = dmp->dm_strtab.cts_size;
uint_t i, n = dmp->dm_nsymelems;
@@ -494,7 +498,7 @@
Elf_Data *dp;
Elf_Scn *sp;
- if (elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1)
+ if (elf_getshstrndx(dmp->dm_elf, &shstrs) == 0)
return (dt_set_errno(dtp, EDT_NOTLOADED));
for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) {
@@ -900,7 +904,7 @@
(void) close(fd);
if (dmp->dm_elf == NULL || err == -1 ||
- elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) {
+ elf_getshstrndx(dmp->dm_elf, &shstrs) == 0) {
dt_dprintf("failed to load %s: %s\n",
fname, elf_errmsg(elf_errno()));
dt_module_destroy(dtp, dmp);
diff -r d60c24ec6987 -r d8fb3eeacfae external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c Mon Mar 01 11:02:31 2010 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c Mon Mar 01 11:19:39 2010 +0000
@@ -694,7 +694,7 @@
struct ps_prochandle *P = dpr->dpr_proc;
int ret = 0;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
#ifdef DOODAD
(void) Pupdate_maps(P);
diff -r d60c24ec6987 -r d8fb3eeacfae external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c Mon Mar 01 11:02:31 2010 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c Mon Mar 01 11:19:39 2010 +0000
@@ -183,7 +183,7 @@
struct ps_prochandle *P = dpr->dpr_proc;
dt_bkpt_t *dbp;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
if ((dbp = dt_zalloc(dpr->dpr_hdl, sizeof (dt_bkpt_t))) != NULL) {
dbp->dbp_func = func;
@@ -210,7 +210,7 @@
#endif
dt_bkpt_t *dbp, *nbp;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps); dbp != NULL; dbp = nbp) {
printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
@@ -234,7 +234,7 @@
const lwpstatus_t *psp = &Pstatus(dpr->dpr_proc)->pr_lwp;
dt_bkpt_t *dbp;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
@@ -261,7 +261,7 @@
{
dt_bkpt_t *dbp;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
@@ -281,7 +281,7 @@
{
dt_bkpt_t *dbp;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
@@ -332,7 +332,7 @@
static void
dt_proc_stop(dt_proc_t *dpr, uint8_t why)
{
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
assert(why != DT_PROC_STOP_IDLE);
if (dpr->dpr_stop & why) {
@@ -434,7 +434,7 @@
rd_err_e err;
GElf_Sym sym;
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
if (exec) {
if (psp->pr_lwp.pr_errno != 0)
@@ -500,7 +500,7 @@
const long wstop = PCWSTOP;
int pfd = Pctlfd(P);
- assert(MUTEX_HELD(&dpr->dpr_lock));
+ assert(DT_MUTEX_HELD(&dpr->dpr_lock));
assert(psp->pr_flags & PR_STOPPED);
assert(Pstate(P) == PS_STOP);
diff -r d60c24ec6987 -r d8fb3eeacfae external/cddl/osnet/dist/uts/common/sys/sdt.h
--- a/external/cddl/osnet/dist/uts/common/sys/sdt.h Mon Mar 01 11:02:31 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _SYS_SDT_H
-#define _SYS_SDT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _KERNEL
-
-#define DTRACE_PROBE(provider, name) { \
- extern void __dtrace_##provider##___##name(void); \
- __dtrace_##provider##___##name(); \
-}
-
-#define DTRACE_PROBE1(provider, name, arg1) { \
- extern void __dtrace_##provider##___##name(unsigned long); \
- __dtrace_##provider##___##name((unsigned long)arg1); \
-}
-
-#define DTRACE_PROBE2(provider, name, arg1, arg2) { \
- extern void __dtrace_##provider##___##name(unsigned long, \
- unsigned long); \
- __dtrace_##provider##___##name((unsigned long)arg1, \
- (unsigned long)arg2); \
-}
-
-#define DTRACE_PROBE3(provider, name, arg1, arg2, arg3) { \
- extern void __dtrace_##provider##___##name(unsigned long, \
- unsigned long, unsigned long); \
- __dtrace_##provider##___##name((unsigned long)arg1, \
- (unsigned long)arg2, (unsigned long)arg3); \
-}
-
-#define DTRACE_PROBE4(provider, name, arg1, arg2, arg3, arg4) { \
- extern void __dtrace_##provider##___##name(unsigned long, \
- unsigned long, unsigned long, unsigned long); \
- __dtrace_##provider##___##name((unsigned long)arg1, \
- (unsigned long)arg2, (unsigned long)arg3, \
- (unsigned long)arg4); \
-}
-
-#define DTRACE_PROBE5(provider, name, arg1, arg2, arg3, arg4, arg5) { \
- extern void __dtrace_##provider##___##name(unsigned long, \
- unsigned long, unsigned long, unsigned long, unsigned long);\
- __dtrace_##provider##___##name((unsigned long)arg1, \
- (unsigned long)arg2, (unsigned long)arg3, \
- (unsigned long)arg4, (unsigned long)arg5); \
-}
-
-#else /* _KERNEL */
-
-#define DTRACE_PROBE(name) { \
- extern void __dtrace_probe_##name(void); \
- __dtrace_probe_##name(); \
-}
-
-#define DTRACE_PROBE1(name, type1, arg1) { \
- extern void __dtrace_probe_##name(uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1)); \
-}
-
-#define DTRACE_PROBE2(name, type1, arg1, type2, arg2) { \
- extern void __dtrace_probe_##name(uintptr_t, uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2)); \
-}
-
-#define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) { \
- extern void __dtrace_probe_##name(uintptr_t, uintptr_t, uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3)); \
-}
-
-#define DTRACE_PROBE4(name, type1, arg1, type2, arg2, \
- type3, arg3, type4, arg4) { \
- extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \
- uintptr_t, uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3), (uintptr_t)(arg4)); \
-}
-
-#define DTRACE_PROBE5(name, type1, arg1, type2, arg2, \
- type3, arg3, type4, arg4, type5, arg5) { \
- extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \
- uintptr_t, uintptr_t, uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5)); \
-}
-
-#define DTRACE_PROBE6(name, type1, arg1, type2, arg2, \
- type3, arg3, type4, arg4, type5, arg5, type6, arg6) { \
- extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \
- uintptr_t, uintptr_t, uintptr_t, uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5), \
- (uintptr_t)(arg6)); \
-}
-
-#define DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3, \
- type4, arg4, type5, arg5, type6, arg6, type7, arg7) { \
- extern void __dtrace_probe_##name(uintptr_t, uintptr_t, \
- uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); \
- __dtrace_probe_##name((uintptr_t)(arg1), (uintptr_t)(arg2), \
- (uintptr_t)(arg3), (uintptr_t)(arg4), (uintptr_t)(arg5), \
Home |
Main Index |
Thread Index |
Old Index