Module Name: src Committed By: darran Date: Mon Mar 1 11:19:41 UTC 2010
Modified Files: src/external/cddl/osnet/dist/lib/libdtrace/common: dt_impl.h dt_module.c dt_pid.c dt_proc.c src/external/cddl/osnet/sys/sys: cpuvar.h elf.h modctl.h policy.h sdt.h types.h src/sys/sys: Makefile exec_elf.h Removed Files: src/external/cddl/osnet/dist/uts/common/sys: sdt.h Log Message: DTrace: fix a few problems introduced by the recent ZFS update (expected problems from the OpenSolaris merge). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h cvs rdiff -u -r1.4 -r1.5 \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c \ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c cvs rdiff -u -r1.1.1.2 -r0 src/external/cddl/osnet/dist/uts/common/sys/sdt.h cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/cpuvar.h \ src/external/cddl/osnet/sys/sys/elf.h \ src/external/cddl/osnet/sys/sys/modctl.h \ src/external/cddl/osnet/sys/sys/policy.h cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/sys/sdt.h cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/sys/types.h cvs rdiff -u -r1.123 -r1.124 src/sys/sys/Makefile cvs rdiff -u -r1.100 -r1.101 src/sys/sys/exec_elf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h:1.3 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h:1.4 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h:1.3 Sat Feb 27 23:43:52 2010 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_impl.h Mon Mar 1 11:19:40 2010 @@ -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 *, ...); Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c:1.4 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c:1.5 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c:1.4 Sat Feb 27 23:43:52 2010 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Mon Mar 1 11:19:40 2010 @@ -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); Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c:1.4 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c:1.5 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c:1.4 Sat Feb 27 23:43:52 2010 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_pid.c Mon Mar 1 11:19:41 2010 @@ -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); Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c diff -u src/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c:1.4 src/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c:1.5 --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c:1.4 Sat Feb 27 23:43:52 2010 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_proc.c Mon Mar 1 11:19:41 2010 @@ -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); Index: src/external/cddl/osnet/sys/sys/cpuvar.h diff -u src/external/cddl/osnet/sys/sys/cpuvar.h:1.4 src/external/cddl/osnet/sys/sys/cpuvar.h:1.5 --- src/external/cddl/osnet/sys/sys/cpuvar.h:1.4 Sun Feb 28 14:45:47 2010 +++ src/external/cddl/osnet/sys/sys/cpuvar.h Mon Mar 1 11:19:39 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.4 2010/02/28 14:45:47 haad Exp $ */ +/* $NetBSD: cpuvar.h,v 1.5 2010/03/01 11:19:39 darran Exp $ */ /* * CDDL HEADER START @@ -30,6 +30,7 @@ #define _COMPAT_OPENSOLARIS_SYS_CPUVAR_H #include <sys/mutex.h> +#include <sys/cpuvar_defs.h> #ifdef _KERNEL #define CPU_CACHE_COHERENCE_SIZE 64 Index: src/external/cddl/osnet/sys/sys/elf.h diff -u src/external/cddl/osnet/sys/sys/elf.h:1.4 src/external/cddl/osnet/sys/sys/elf.h:1.5 --- src/external/cddl/osnet/sys/sys/elf.h:1.4 Sun Feb 28 14:45:47 2010 +++ src/external/cddl/osnet/sys/sys/elf.h Mon Mar 1 11:19:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: elf.h,v 1.4 2010/02/28 14:45:47 haad Exp $ */ +/* $NetBSD: elf.h,v 1.5 2010/03/01 11:19:40 darran Exp $ */ /* * CDDL HEADER START @@ -29,90 +29,15 @@ #ifndef _SYS__ELF_SOLARIS_H_ #define _SYS__ELF_SOLARIS_H_ -#include_next <sys/elf.h> - -#define __sElfN(x) typedef __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) x - -__sElfN(Addr); -__sElfN(Cap); -__sElfN(Dyn); -__sElfN(Ehdr); -__sElfN(Move); -__sElfN(Off); -__sElfN(Phdr); -__sElfN(Rel); -__sElfN(Rela); -__sElfN(Shdr); -__sElfN(Sym); -__sElfN(Syminfo); -__sElfN(Verdaux); -__sElfN(Verdef); -__sElfN(Vernaux); -__sElfN(Verneed); -__sElfN(Versym); - -__sElfN(Half); -__sElfN(Sword); -__sElfN(Word); - -#if __ELF_WORD_SIZE == 32 -typedef Elf32_Word Xword; /* Xword/Sxword are 32-bits in Elf32 */ -typedef Elf32_Sword Sxword; +#if HAVE_NBTOOL_CONFIG_H +#include <nbinclude/sys/exec_elf.h> #else -typedef Elf64_Xword Xword; -typedef Elf64_Sxword Sxword; +#include <sys/exec_elf.h> #endif -#define ELF_M_INFO __ELFN(M_INFO) -#define ELF_M_SIZE __ELFN(M_SIZE) -#define ELF_M_SYM __ELFN(M_SYM) +#define SHT_SUNW_dof 0x6ffffff4 +#define EM_AMD64 EM_X86_64 -/* - * Elf `printf' type-cast macros. These force arguments to be a fixed size - * so that Elf32 and Elf64 can share common format strings. - */ -#define EC_ADDR(a) ((Elf64_Addr)(a)) /* "ull" */ -#define EC_OFF(a) ((Elf64_Off)(a)) /* "ull" */ -#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */ -#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */ -#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */ -#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */ -#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */ -#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */ - -#define elf_checksum __elfN(checksum) -#define elf_fsize __elfN(fsize) -#define elf_getehdr __elfN(getehdr) -#define elf_getphdr __elfN(getphdr) -#define elf_newehdr __elfN(newehdr) -#define elf_newphdr __elfN(newphdr) -#define elf_getshdr __elfN(getshdr) -#define elf_xlatetof __elfN(xlatetof) -#define elf_xlatetom __elfN(xlatetom) - -#define Elf_cap_entry __ElfN(cap_entry) -#define Elf_cap_title __ElfN(cap_title) -#define Elf_demangle_name __ElfN(demangle_name) -#define Elf_dyn_entry __ElfN(dyn_entry) -#define Elf_dyn_title __ElfN(dyn_title) -#define Elf_ehdr __ElfN(ehdr) -#define Elf_got_entry __ElfN(got_entry) -#define Elf_got_title __ElfN(got_title) -#define Elf_reloc_apply_reg __ElfN(reloc_apply_reg) -#define Elf_reloc_apply_val __ElfN(reloc_apply_val) -#define Elf_reloc_entry_1 __ElfN(reloc_entry_1) -#define Elf_reloc_entry_2 __ElfN(reloc_entry_2) -#define Elf_reloc_title __ElfN(reloc_title) -#define Elf_phdr __ElfN(phdr) -#define Elf_shdr __ElfN(shdr) -#define Elf_syms_table_entry __ElfN(syms_table_entry) -#define Elf_syms_table_title __ElfN(syms_table_title) -#define Elf_ver_def_title __ElfN(ver_def_title) -#define Elf_ver_line_1 __ElfN(ver_line_1) -#define Elf_ver_line_2 __ElfN(ver_line_2) -#define Elf_ver_line_3 __ElfN(ver_line_3) -#define Elf_ver_line_4 __ElfN(ver_line_4) -#define Elf_ver_line_5 __ElfN(ver_line_5) -#define Elf_ver_need_title __ElfN(ver_need_title) +#define __ELF_WORD_SIZE ELFSIZE #endif /* !_SYS__ELF_SOLARIS_H_ */ Index: src/external/cddl/osnet/sys/sys/modctl.h diff -u src/external/cddl/osnet/sys/sys/modctl.h:1.4 src/external/cddl/osnet/sys/sys/modctl.h:1.5 --- src/external/cddl/osnet/sys/sys/modctl.h:1.4 Sun Feb 28 14:45:47 2010 +++ src/external/cddl/osnet/sys/sys/modctl.h Mon Mar 1 11:19:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: modctl.h,v 1.4 2010/02/28 14:45:47 haad Exp $ */ +/* $NetBSD: modctl.h,v 1.5 2010/03/01 11:19:40 darran Exp $ */ /* * Copyright (C) 2007 John Birrell <j...@freebsd.org> @@ -35,4 +35,6 @@ #include <sys/param.h> #include <sys/linker.h> +typedef struct module dtrace_modctl_t; + #endif /* _COMPAT_OPENSOLARIS_SYS_MODCTL_H */ Index: src/external/cddl/osnet/sys/sys/policy.h diff -u src/external/cddl/osnet/sys/sys/policy.h:1.4 src/external/cddl/osnet/sys/sys/policy.h:1.5 --- src/external/cddl/osnet/sys/sys/policy.h:1.4 Sun Feb 28 14:45:47 2010 +++ src/external/cddl/osnet/sys/sys/policy.h Mon Mar 1 11:19:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: policy.h,v 1.4 2010/02/28 14:45:47 haad Exp $ */ +/* $NetBSD: policy.h,v 1.5 2010/03/01 11:19:40 darran Exp $ */ /*- * Copyright (c) 2007 Pawel Jakub Dawidek <p...@freebsd.org> @@ -35,6 +35,8 @@ #ifdef _KERNEL +#include <sys/vnode.h> + struct mount; struct ucred; struct vattr; @@ -43,7 +45,7 @@ int secpolicy_zfs(struct kauth_cred *cred); int secpolicy_sys_config(struct kauth_cred *cred, int checkonly); int secpolicy_zinject(struct kauth_cred *cred); -int secpolicy_fs_mount(struct kauth_cred *cred, vnode_t *mvp, struct mount *vfsp); +int secpolicy_fs_mount(struct kauth_cred *cred, struct vnode *mvp, struct mount *vfsp); int secpolicy_fs_unmount(struct kauth_cred *cred, struct mount *vfsp); int secpolicy_basic_link(struct kauth_cred *cred); int secpolicy_vnode_stky_modify(struct kauth_cred *cred); Index: src/external/cddl/osnet/sys/sys/sdt.h diff -u src/external/cddl/osnet/sys/sys/sdt.h:1.3 src/external/cddl/osnet/sys/sys/sdt.h:1.4 --- src/external/cddl/osnet/sys/sys/sdt.h:1.3 Sun Feb 21 01:46:36 2010 +++ src/external/cddl/osnet/sys/sys/sdt.h Mon Mar 1 11:19:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sdt.h,v 1.3 2010/02/21 01:46:36 darran Exp $ */ +/* $NetBSD: sdt.h,v 1.4 2010/03/01 11:19:40 darran Exp $ */ /*- * Copyright (c) 2007 Pawel Jakub Dawidek <p...@freebsd.org> @@ -32,17 +32,37 @@ #define _OPENSOLARIS_SYS_SDT_H_ #include_next <sys/sdt.h> +#include <sys/dtrace.h> + +typedef struct { + char name[SDT_MAX_NAME_SIZE]; + dtrace_provider_id_t id; + dtrace_pattr_t attr; + sdt_probe_t *probes[]; +} sdt_provider_t; + +int sdt_register(sdt_provider_t *); +int sdt_unregister(sdt_provider_t *); #undef DTRACE_PROBE #undef DTRACE_PROBE1 #undef DTRACE_PROBE2 #undef DTRACE_PROBE3 #undef DTRACE_PROBE4 +#undef DTRACE_PROBE5 +#undef DTRACE_PROBE6 +#undef DTRACE_PROBE7 #define DTRACE_PROBE(name) #define DTRACE_PROBE1(name, type1, arg1) #define DTRACE_PROBE2(name, type1, arg1, type2, arg2) #define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) #define DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) +#define DTRACE_PROBE5(name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4, type5, arg5) +#define DTRACE_PROBE6(name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4, type5, arg5, type6, arg6) +#define DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4, type5, arg5, type6, arg6, type7, arg7) #endif /* _OPENSOLARIS_SYS_SDT_H_ */ Index: src/external/cddl/osnet/sys/sys/types.h diff -u src/external/cddl/osnet/sys/sys/types.h:1.6 src/external/cddl/osnet/sys/sys/types.h:1.7 --- src/external/cddl/osnet/sys/sys/types.h:1.6 Sun Feb 28 14:45:47 2010 +++ src/external/cddl/osnet/sys/sys/types.h Mon Mar 1 11:19:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.6 2010/02/28 14:45:47 haad Exp $ */ +/* $NetBSD: types.h,v 1.7 2010/03/01 11:19:40 darran Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -125,6 +125,7 @@ typedef off_t offset_t; typedef long ptrdiff_t; /* pointer difference */ typedef int64_t rlim64_t; +typedef __caddr_t caddr_t; /* core address */ #else Index: src/sys/sys/Makefile diff -u src/sys/sys/Makefile:1.123 src/sys/sys/Makefile:1.124 --- src/sys/sys/Makefile:1.123 Wed Sep 16 16:34:56 2009 +++ src/sys/sys/Makefile Mon Mar 1 11:19:41 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.123 2009/09/16 16:34:56 dyoung Exp $ +# $NetBSD: Makefile,v 1.124 2010/03/01 11:19:41 darran Exp $ .include <bsd.sys.mk> @@ -29,8 +29,8 @@ queue.h \ ras.h rb.h reboot.h radioio.h resource.h resourcevar.h rmd160.h \ rnd.h rwlock.h sa.h satypes.h \ - scanio.h sched.h scsiio.h select.h selinfo.h sem.h sha1.h sha2.h \ - shm.h siginfo.h signal.h signalvar.h sigtypes.h simplelock.h \ + scanio.h sched.h scsiio.h sdt.h select.h selinfo.h sem.h sha1.h \ + sha2.h shm.h siginfo.h signal.h signalvar.h sigtypes.h simplelock.h \ sleepq.h socket.h \ socketvar.h sockio.h specificdata.h stat.h statvfs.h \ syscall.h syscallargs.h sysctl.h stdint.h swap.h \ Index: src/sys/sys/exec_elf.h diff -u src/sys/sys/exec_elf.h:1.100 src/sys/sys/exec_elf.h:1.101 --- src/sys/sys/exec_elf.h:1.100 Sun Dec 20 05:50:20 2009 +++ src/sys/sys/exec_elf.h Mon Mar 1 11:19:41 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_elf.h,v 1.100 2009/12/20 05:50:20 thorpej Exp $ */ +/* $NetBSD: exec_elf.h,v 1.101 2010/03/01 11:19:41 darran Exp $ */ /*- * Copyright (c) 1994 The NetBSD Foundation, Inc. @@ -490,7 +490,9 @@ #define STT_FUNC 2 /* Associated with a function */ #define STT_SECTION 3 /* Associated with a section */ #define STT_FILE 4 /* Associated with a file name */ -#define STT_NUM 5 +#define STT_COMMON 5 /* Uninitialised common block */ +#define STT_TLS 6 /* Thread local data object */ +#define STT_NUM 7 #define STT_LOOS 10 /* Operating system specific range */ #define STT_HIOS 12