- Timestamp:
- Jan 2, 2015 12:19:17 PM (10 years ago)
- Location:
- trunk/src/VBox/ExtPacks/VBoxDTrace
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/Config.kmk
r53646 r53652 36 36 VBOXDT_PATH_UTS = $(VBOXDT_PATH_ONNV)/uts 37 37 VBOXDT_PATH_CMD = $(VBOXDT_PATH_ONNV)/cmd 38 VBOXDT_PATH_LIBCTF = $(VBOXDT_PATH_ONNV)/lib/libctf 38 39 VBOXDT_PATH_LIBDTRACE = $(VBOXDT_PATH_ONNV)/lib/libdtrace -
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTrace/Makefile.kmk
r53647 r53652 37 37 ../include \ 38 38 $(VBOXDT_PATH_UTS)/common \ 39 $(VBOXDT_PATH_LIBCTF)/common \ 39 40 $(VBOXDT_PATH_LIBDTRACE)/common 40 41 VBoxDTrace_SOURCES = \ 41 $(VBOXDT_PATH_CMD)/dtrace/dtrace.c 42 $(VBOXDT_PATH_CMD)/dtrace/dtrace.c \ 43 \ 44 $(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \ 45 $(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \ 46 $(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \ 47 $(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \ 48 $(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \ 42 49 43 50 VBoxDTrace_VBOX_TODO = \ 44 $(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \45 51 $(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \ 46 52 $(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \ … … 51 57 $(VBOXDT_PATH_LIBDTRACE)/common/dt_dis.c \ 52 58 $(VBOXDT_PATH_LIBDTRACE)/common/dt_dof.c \ 53 $(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \54 59 $(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.c \ 55 60 $(VBOXDT_PATH_LIBDTRACE)/common/dt_handle.c \ … … 58 63 $(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c \ 59 64 $(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \ 60 $(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \61 65 $(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \ 62 66 $(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \ … … 69 73 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \ 70 74 $(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \ 71 $(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \72 75 $(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \ 73 76 $(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \ … … 75 78 $(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \ 76 79 $(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \ 77 $(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \78 80 $(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c 79 81 -
trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
r53648 r53652 34 34 #include <iprt/types.h> 35 35 #include <iprt/stdarg.h> 36 #include <iprt/param.h> 37 #ifdef IN_RING3 38 # include <sys/types.h> 39 #endif 36 40 37 41 RT_C_DECLS_BEGIN … … 40 44 41 45 typedef unsigned char uchar_t; 46 typedef unsigned short ushort_t; 42 47 typedef unsigned int uint_t; 43 48 typedef uintptr_t ulong_t; 49 typedef uint64_t hrtime_t; 50 typedef RTCCUINTREG greg_t; 44 51 typedef uintptr_t pc_t; 52 typedef uintptr_t id_t; 45 53 typedef unsigned int model_t; 46 54 typedef uint32_t zoneid_t; … … 54 62 #define NANOSEC RT_NS_1SEC 55 63 #define MILLISEC RT_MS_1SEC 64 #define MAXPATHLEN RTPATH_MAX 65 #define PATH_MAX RTPATH_MAX 66 #define NBBY 8 67 #define NCPU RTCPUSET_MAX_CPUS 56 68 57 69 #if defined(RT_ARCH_X86) 58 70 # ifndef __i386 59 # define __i386 1 71 # define __i386 1 72 # endif 73 # ifndef __x86 74 # define __x86 1 60 75 # endif 61 76 62 77 #elif defined(RT_ARCH_AMD64) 63 78 # ifndef __x86_64 64 # define __x86_64 1 79 # define __x86_64 1 80 # endif 81 # ifndef __x86 82 # define __x86 1 65 83 # endif 66 84 … … 94 112 95 113 /* 96 * CTF - probably needs to be ported wholesale or smth. 97 */ 98 #define CTF_MODEL_NATIVE 1 99 typedef struct VBoxDtCtfFile ctf_file_t; 100 typedef intptr_t ctf_id_t; 101 102 114 * Errno defines compatible with the CRT of the given host... 115 */ 103 116 #ifdef IN_RING0 117 # define EINVAL (22) 118 # define EBUSY (16) 119 # define EFBIG (27) 120 # define ENOMEM (12) 121 # define ENOSPC (28) 122 # define ENOENT (2) 123 # define EFAULT (14) 124 # define E2BIG (7) 125 # define EACCES (13) 126 # define ENXIO (6) 127 # define EAGAIN (11) 128 # define ENOTTY (25) 129 # define ESRCH (3) 130 #endif 131 #if defined(_MSC_VER) || defined(IN_RING0) 132 # define EALREADY (114) 133 #endif 134 135 136 #ifdef IN_RING0 104 137 105 138 /* 106 139 * Kernel stuff... 107 140 */ 108 typedef uint64_t hrtime_t;109 typedef RTCCUINTREG greg_t;110 111 141 #define P2ROUNDUP(uWhat, uAlign) ( ((uWhat) + (uAlign) - 1) & ~(uAlign - 1) ) 112 142 #define IS_P2ALIGNED(uWhat, uAlign) ( !((uWhat) & ((uAlign) - 1)) ) … … 114 144 #define MIN(a1, a2) RT_MIN(a1, a2) 115 145 116 #define NBBY 8117 #define NCPU RTCPUSET_MAX_CPUS118 146 #define B_FALSE (0) 119 147 #define B_TRUE (1) … … 235 263 void VBoxDtUPrintfV(const char *pszFormat, va_list va); 236 264 237 238 /*239 * Errno defines compatible with the CRT of the given host...240 */241 #define EINVAL (22)242 #define EBUSY (16)243 #define EFBIG (27)244 #define ENOMEM (12)245 #define ENOSPC (28)246 #define ENOENT (2)247 #define EFAULT (14)248 #define E2BIG (7)249 #define EACCES (13)250 #define EALREADY (114)251 #define ENXIO (6)252 #define EAGAIN (11)253 #define ENOTTY (25)254 #define ESRCH (3)255 256 265 /* 257 266 * Memory allocation wrappers. … … 344 353 #endif /* IN_RING0 */ 345 354 355 356 #ifdef IN_RING3 357 /* 358 * Make life a little easier in ring-3. 359 */ 360 # include <iprt/alloca.h> 361 # include <iprt/mem.h> 362 # include <iprt/string.h> 363 # include <iprt/time.h> 364 # define gethrtime() RTTimeNanoTS() 365 366 /* This isn't necessarily making things easier at first, but allows EF and 367 such later on when things doesn't work right. */ 368 # include <stdlib.h> 369 # include <string.h> 370 # define malloc(a_cbMem) RTMemAlloc(a_cbMem) 371 # define realloc(a_pvOld, a_cbMem) RTMemRealloc(a_pvOld, a_cbMem) 372 # define calloc(a_cbItem, a_cItems) RTMemAllocZ((size_t)(a_cbItem) * (a_cItems)) 373 # define free(a_pvMem) RTMemFree(a_pvMem) 374 # define strdup(a_psz) RTStrDup(a_psz) 375 376 #endif 377 346 378 RT_C_DECLS_END 347 379 #endif -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c
r53647 r53652 597 597 598 598 for (i = 0; i < p->dtp_argc; i++) { 599 #ifndef VBOX /* no ctf for now */600 599 if (ctf_type_name(p->dtp_argv[i].dtt_ctfp, 601 600 p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL) 602 #endif603 601 (void) strlcpy(buf, "(unknown)", sizeof (buf)); 604 602 oprintf("\t\targs[%d]: %s\n", i, buf); … … 1271 1269 if (RT_FAILURE(err)) 1272 1270 return RTMsgInitFailure(err); 1271 dtrace_init(); 1273 1272 1274 1273 g_ofp = stdout; … … 1359 1358 break; 1360 1359 1360 #ifndef VBOX 1361 1361 case 'G': 1362 #ifndef VBOX1363 1362 g_mode = DMODE_LINK; 1364 1363 g_oflags |= DTRACE_O_NODEV; … … 1367 1366 mode++; 1368 1367 break; 1369 #else1370 fprintf(stderr, "%s: -G is not supported\n", g_pname);1371 return (E_USAGE);1372 1368 #endif 1373 1369 … … 1388 1384 return (usage(stderr)); 1389 1385 #else 1386 case 'c': 1387 case 'p': 1388 case 'G': 1389 fprintf(stderr, "%s: -%c is not supported\n", g_pname, c); 1390 return (E_USAGE); 1391 1390 1392 case VINF_GETOPT_NOT_OPTION: 1391 1393 g_argv[g_argc++] = (char *)ValueUnion.psz; … … 1687 1689 } 1688 1690 1691 #ifndef VBOX 1689 1692 /* 1690 1693 * In our third pass we handle any command-line options related to … … 1730 1733 } 1731 1734 } 1735 #endif /* !VBOX */ 1732 1736 1733 1737 /* … … 1968 1972 * using the /proc control mechanism inside of libdtrace. 1969 1973 */ 1974 #ifndef VBOX 1970 1975 for (i = 0; i < g_psc; i++) 1971 1976 dtrace_proc_continue(g_dtp, g_psv[i]); 1977 #endif 1972 1978 1973 1979 g_pslive = g_psc; /* count for prochandler() */ -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/libctf.h
r53650 r53652 41 41 #define _LIBCTF_H 42 42 43 #pragma ident "%Z%%M% %I% %E% SMI" 43 #ifndef VBOX 44 # pragma ident "%Z%%M% %I% %E% SMI" 45 #endif 44 46 45 47 #include <sys/ctf_api.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_aggregate.c
r53634 r53652 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 … … 35 36 #include <alloca.h> 36 37 #include <limits.h> 38 #else /* VBOX */ 39 # include "dt_impl.h" 40 # ifdef _MSC_VER 41 # pragma warning(disable:4018) /* signed/unsigned comparsion mismatch warning */ 42 # endif 43 # include <iprt/mp.h> 44 #endif /* VBOX */ 37 45 38 46 #define DTRACE_AHASHSIZE 32779 /* big 'ol prime */ … … 43 51 * they are protected by a global static lock, dt_qsort_lock. 44 52 */ 53 #ifndef VBOX 45 54 static pthread_mutex_t dt_qsort_lock = PTHREAD_MUTEX_INITIALIZER; 55 #else 56 RTCRITSECT dt_qsort_lock; 57 #endif 46 58 47 59 static int dt_revsort; … … 247 259 dt_aggregate_usym(dtrace_hdl_t *dtp, uint64_t *data) 248 260 { 261 #ifndef VBOX 249 262 uint64_t pid = data[0]; 250 263 uint64_t *pc = &data[1]; … … 265 278 dt_proc_unlock(dtp, P); 266 279 dt_proc_release(dtp, P); 280 #endif 267 281 } 268 282 … … 270 284 dt_aggregate_umod(dtrace_hdl_t *dtp, uint64_t *data) 271 285 { 286 #ifndef VBOX 272 287 uint64_t pid = data[0]; 273 288 uint64_t *pc = &data[1]; … … 288 303 dt_proc_unlock(dtp, P); 289 304 dt_proc_release(dtp, P); 305 #endif 290 306 } 291 307 … … 293 309 dt_aggregate_sym(dtrace_hdl_t *dtp, uint64_t *data) 294 310 { 311 #ifndef VBOX 295 312 GElf_Sym sym; 296 313 uint64_t *pc = data; … … 298 315 if (dtrace_lookup_by_addr(dtp, *pc, &sym, NULL) == 0) 299 316 *pc = sym.st_value; 317 #endif 300 318 } 301 319 … … 303 321 dt_aggregate_mod(dtrace_hdl_t *dtp, uint64_t *data) 304 322 { 323 #ifndef VBOX 305 324 uint64_t *pc = data; 306 325 dt_module_t *dmp; … … 325 344 } 326 345 } 346 #endif 327 347 } 328 348 … … 1008 1028 assert(agp->dtat_cpus == NULL); 1009 1029 1030 #ifndef VBOX 1010 1031 agp->dtat_maxcpu = dt_sysconf(dtp, _SC_CPUID_MAX) + 1; 1011 1032 agp->dtat_ncpu = dt_sysconf(dtp, _SC_NPROCESSORS_MAX); 1033 #else 1034 agp->dtat_maxcpu = RTMpGetMaxCpuId() + 1; 1035 agp->dtat_ncpu = RTMpGetCount(); 1036 #endif 1012 1037 agp->dtat_cpus = malloc(agp->dtat_ncpu * sizeof (processorid_t)); 1013 1038 … … 1243 1268 sorted[i++] = h; 1244 1269 1270 #ifndef VBOX 1245 1271 (void) pthread_mutex_lock(&dt_qsort_lock); 1272 #else 1273 RTCritSectEnter(&dt_qsort_lock); 1274 #endif 1246 1275 1247 1276 if (sfunc == NULL) { … … 1257 1286 } 1258 1287 1288 #ifndef VBOX 1259 1289 (void) pthread_mutex_unlock(&dt_qsort_lock); 1290 #else 1291 RTCritSectLeave(&dt_qsort_lock); 1292 #endif 1260 1293 1261 1294 for (i = 0; i < nentries; i++) { … … 1652 1685 * comparison and sorting. 1653 1686 */ 1687 #ifndef VBOX 1654 1688 (void) pthread_mutex_lock(&dt_qsort_lock); 1689 #else 1690 RTCritSectEnter(&dt_qsort_lock); 1691 #endif 1655 1692 1656 1693 qsort(sorted, nentries, sizeof (dt_ahashent_t *), … … 1681 1718 1682 1719 if ((nbundle = dt_zalloc(dtp, bundlesize)) == NULL) { 1720 #ifndef VBOX 1683 1721 (void) pthread_mutex_unlock(&dt_qsort_lock); 1722 #else 1723 RTCritSectLeave(&dt_qsort_lock); 1724 #endif 1684 1725 goto out; 1685 1726 } 1686 1727 1687 for (j = start; j < i; j++) {1728 for (j = VBDTCAST(int)start; j < i; j++) { 1688 1729 dtrace_aggvarid_t id = dt_aggregate_aggvarid(sorted[j]); 1689 1730 … … 1731 1772 dt_aggregate_bundlecmp); 1732 1773 1774 #ifndef VBOX 1733 1775 (void) pthread_mutex_unlock(&dt_qsort_lock); 1776 #else 1777 RTCritSectLeave(&dt_qsort_lock); 1778 #endif 1734 1779 1735 1780 /* -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.h
r53634 r53652 28 28 #define _DT_AS_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 32 33 #include <sys/types.h> 34 #endif 33 35 #include <sys/dtrace.h> 34 36 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.h
r53634 r53652 28 28 #define _DT_BUF_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.h
r53634 r53652 28 28 #define _DT_DECL_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 32 33 #include <sys/types.h> 34 #endif 33 35 #include <libctf.h> 34 36 #include <dtrace.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.h
r53634 r53652 28 28 #define _DT_DOF_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <dtrace.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_error.c
r53634 r53652 24 24 */ 25 25 26 #ifndef VBOX 26 27 #include <strings.h> 28 #endif 27 29 #include <dt_impl.h> 28 30 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_errtags.h
r53634 r53652 28 28 #define _DT_ERRTAGS_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.h
r53634 r53652 28 28 #define _DT_IDENT_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <libctf.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_impl.h
r53634 r53652 28 28 #define _DT_IMPL_H 29 29 30 #ifndef VBOX 30 31 #include <sys/param.h> 31 32 #include <sys/objfs.h> … … 35 36 #include <gelf.h> 36 37 #include <synch.h> 38 #else /* VBOX */ 39 # include <setjmp.h> 40 # include <libctf.h> 41 # include <dtrace.h> 42 # include <errno.h> 43 # include <iprt/assert.h> 44 # define assert(expr) Assert(expr) 45 #endif /* VBOX*/ 46 37 47 38 48 #ifdef __cplusplus … … 79 89 uint_t (*do_syminit)(struct dt_module *); 80 90 void (*do_symsort)(struct dt_module *); 91 #ifndef VBOX 81 92 GElf_Sym *(*do_symname)(struct dt_module *, 82 93 const char *, GElf_Sym *, uint_t *); 83 94 GElf_Sym *(*do_symaddr)(struct dt_module *, 84 95 GElf_Addr, GElf_Sym *, uint_t *); 96 #endif 85 97 } dt_modops_t; 86 98 … … 105 117 struct dt_module *dm_next; /* pointer to next module in hash chain */ 106 118 const dt_modops_t *dm_ops; /* pointer to data model's ops vector */ 119 #ifndef VBOX 107 120 Elf *dm_elf; /* libelf handle for module object */ 108 121 objfs_info_t dm_info; /* object filesystem private info */ 122 #endif 109 123 ctf_sect_t dm_symtab; /* symbol table for module */ 110 124 ctf_sect_t dm_strtab; /* string table for module */ … … 121 135 uint_t dm_flags; /* module flags (see below) */ 122 136 int dm_modid; /* modinfo(1M) module identifier */ 137 #ifndef VBOX 123 138 GElf_Addr dm_text_va; /* virtual address of text section */ 124 139 GElf_Xword dm_text_size; /* size in bytes of text section */ … … 127 142 GElf_Addr dm_bss_va; /* virtual address of BSS */ 128 143 GElf_Xword dm_bss_size; /* size in bytes of BSS */ 144 #endif 129 145 dt_idhash_t *dm_extern; /* external symbol definitions */ 130 146 } dt_module_t; … … 296 312 void *dt_bufarg; /* buffered handler argument */ 297 313 dt_dof_t dt_dof; /* DOF generation buffers (see dt_dof.c) */ 314 #ifndef VBOX 298 315 struct utsname dt_uts; /* uname(2) information for system */ 316 #endif 299 317 dt_list_t dt_lib_dep; /* scratch linked-list of lib dependencies */ 300 318 dt_list_t dt_lib_dep_sorted; /* dependency sorted library list */ … … 651 669 652 670 #endif /* _DT_IMPL_H */ 671 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.h
r53634 r53652 28 28 #define _DT_INTTAB_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <dtrace.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.h
r53634 r53652 28 28 #define _DT_LIST_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.h
r53634 r53652 28 28 #define _DT_MODULE_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <dt_impl.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_open.c
r53634 r53652 24 24 */ 25 25 26 #ifndef VBOX 26 27 #include <sys/types.h> 27 28 #include <sys/modctl.h> 28 29 #include <sys/systeminfo.h> 29 #include <sys/resource.h>30 30 31 31 #include <libelf.h> … … 40 40 #include <assert.h> 41 41 42 #define _POSIX_PTHREAD_SEMANTICS 43 #include <dirent.h> 44 #undef _POSIX_PTHREAD_SEMANTICS 42 #ifndef _MSC_VER 43 # define _POSIX_PTHREAD_SEMANTICS 44 # include <dirent.h> 45 # undef _POSIX_PTHREAD_SEMANTICS 46 #endif 47 48 #else /* VBOX */ 49 # ifndef _MSC_VER 50 # include <sys/resource.h> 51 # include <unistd.h> 52 # else 53 # include <io.h> 54 # endif 55 #endif /* VBOX */ 45 56 46 57 #include <dt_impl.h> … … 662 673 int _dtrace_debug = 0; /* debug messages enabled (off) */ 663 674 const char *const _dtrace_version = DT_VERS_STRING; /* API version string */ 675 #ifndef VBOX 664 676 int _dtrace_rdvers = RD_VERSION; /* rtld_db feature version */ 677 #endif 665 678 666 679 typedef struct dt_fdlist { … … 670 683 } dt_fdlist_t; 671 684 685 686 #ifdef VBOX 687 # include <iprt/critsect.h> 688 extern RTCRITSECT dt_qsort_lock; /* dt_aggregate.c */ 689 690 void dtrace_init(void) 691 #else /* !VBOX */ 672 692 #pragma init(_dtrace_init) 673 693 void 674 694 _dtrace_init(void) 695 #endif /* !VBOX */ 675 696 { 676 697 _dtrace_debug = getenv("DTRACE_DEBUG") != NULL; 677 698 699 #ifndef VBOX 678 700 for (; _dtrace_rdvers > 0; _dtrace_rdvers--) { 679 701 if (rd_init(_dtrace_rdvers) == RD_OK) 680 702 break; 681 703 } 704 #else 705 RTCritSectInit(&dt_qsort_lock); 706 #endif 682 707 } 683 708 … … 692 717 } 693 718 719 #ifndef VBOX 694 720 static void 695 721 dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp) … … 745 771 (void) closedir(dirp); 746 772 } 773 #endif /* !VBOX */ 747 774 748 775 static void … … 763 790 dt_get_sysinfo(int cmd, char *buf, size_t len) 764 791 { 792 #ifndef VBOX 765 793 ssize_t rv = sysinfo(cmd, buf, len); 766 794 char *p = buf; … … 771 799 while ((p = strchr(p, '.')) != NULL) 772 800 *p++ = '_'; 773 801 #else 802 snprintf(buf, len, "%s", "Unknown"); 803 #endif 774 804 return (buf); 775 805 } … … 785 815 dt_provmod_t *provmod = NULL; 786 816 int i, err; 817 #ifndef _MSC_VER 787 818 struct rlimit rl; 819 #endif 788 820 789 821 const dt_intrinsic_t *dinp; … … 795 827 ctf_arinfo_t ctr; 796 828 829 #ifndef VBOX 797 830 dt_fdlist_t df = { NULL, 0, 0 }; 831 #endif 798 832 799 833 char isadef[32], utsdef[32]; 834 #ifndef VBOX 800 835 char s1[64], s2[64]; 836 #endif 801 837 802 838 if (version <= 0) … … 830 866 return (set_open_errno(dtp, errp, EINVAL)); 831 867 868 #ifndef VBOX 832 869 if (elf_version(EV_CURRENT) == EV_NONE) 833 870 return (set_open_errno(dtp, errp, EDT_ELFVERSION)); 871 #endif 834 872 835 873 if (vector != NULL || (flags & DTRACE_O_NODEV)) 836 874 goto alloc; /* do not attempt to open dtrace device */ 837 875 876 #ifndef _MSC_VER 838 877 /* 839 878 * Before we get going, crank our limit on file descriptors up to the … … 848 887 (void) setrlimit(RLIMIT_NOFILE, &rl); 849 888 } 850 889 #endif 890 891 #ifndef VBOX 851 892 /* 852 893 * Get the device path of each of the providers. We hold them open … … 892 933 (void) fcntl(dtfd, F_SETFD, FD_CLOEXEC); 893 934 (void) fcntl(ftfd, F_SETFD, FD_CLOEXEC); 935 #else /* VBOX */ 936 /** @todo open ring-0 dtrace module. */ 937 #endif /* VBOX */ 894 938 895 939 alloc: … … 926 970 dtp->dt_varg = arg; 927 971 dt_dof_init(dtp); 972 #ifndef VBOX 928 973 (void) uname(&dtp->dt_uts); 974 #endif 929 975 930 976 if (dtp->dt_mods == NULL || dtp->dt_provs == NULL || … … 941 987 (uint_t)(sizeof (void *) * NBBY)); 942 988 989 #ifndef VBOX 943 990 (void) snprintf(utsdef, sizeof (utsdef), "-D__%s_%s", 944 991 dt_get_sysinfo(SI_SYSNAME, s1, sizeof (s1)), 945 992 dt_get_sysinfo(SI_RELEASE, s2, sizeof (s2))); 993 #endif 946 994 947 995 if (dt_cpp_add_arg(dtp, "-D__sun") == NULL || -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.h
r53634 r53652 27 27 #define _DT_PARSER_H 28 28 29 #ifndef VBOX 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 … … 35 36 #include <stdarg.h> 36 37 #include <stdio.h> 38 #else /* VBOX */ 39 # include <sys/dtrace.h> 40 # include <stdio.h> 41 #endif /* VBOX */ 37 42 38 43 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.h
r53634 r53652 28 28 #define _DT_PCB_H 29 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 30 #ifndef VBOX 31 # pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <dtrace.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.h
r53634 r53652 28 28 #ifndef _DT_PID_H 29 29 #define _DT_PID_H 30 #ifndef VBOX 30 31 31 32 #pragma ident "%Z%%M% %I% %E% SMI" … … 58 59 dtrace_hdl_t *, fasttrap_probe_spec_t *, const GElf_Sym *, const char *); 59 60 61 #endif /* !VBOX */ 60 62 #ifdef __cplusplus 61 63 } -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.h
r53634 r53652 28 28 #define _DT_PRINTF_H 29 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 30 #ifndef VBOX 31 # pragma ident "%Z%%M% %I% %E% SMI" 31 32 32 33 #include <sys/types.h> 34 #endif 33 35 #include <libctf.h> 34 36 #include <dtrace.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.c
r53634 r53652 77 77 */ 78 78 79 #ifndef VBOX 79 80 #include <sys/wait.h> 80 81 #include <sys/lwp.h> … … 83 84 #include <assert.h> 84 85 #include <errno.h> 86 #endif 85 87 86 88 #include <dt_proc.h> 87 89 #include <dt_pid.h> 88 90 #include <dt_impl.h> 91 92 #ifndef VBOX 89 93 90 94 #define IS_SYS_EXEC(w) (w == SYS_execve) … … 1033 1037 assert(err == 0); /* check for unheld lock */ 1034 1038 } 1039 #endif /* !VBOX */ 1035 1040 1036 1041 void … … 1040 1045 sizeof (dt_proc_t *) * _dtrace_pidbuckets - 1)) != NULL) { 1041 1046 1047 #ifndef VBOX /** @todo This needs more work... */ 1042 1048 (void) pthread_mutex_init(&dtp->dt_procs->dph_lock, NULL); 1043 1049 (void) pthread_cond_init(&dtp->dt_procs->dph_cv, NULL); 1050 #else 1051 1052 #endif 1044 1053 1045 1054 dtp->dt_procs->dph_hashlen = _dtrace_pidbuckets; … … 1052 1061 { 1053 1062 dt_proc_hash_t *dph = dtp->dt_procs; 1063 #ifndef VBOX 1054 1064 dt_proc_t *dpr; 1055 1065 1056 1066 while ((dpr = dt_list_next(&dph->dph_lrulist)) != NULL) 1057 1067 dt_proc_destroy(dtp, dpr->dpr_proc); 1068 #endif 1058 1069 1059 1070 dtp->dt_procs = NULL; … … 1061 1072 } 1062 1073 1074 #ifndef VBOX 1075 1063 1076 struct ps_prochandle * 1064 1077 dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv) … … 1096 1109 dt_proc_continue(dtp, P); 1097 1110 } 1111 #endif /* !VBOX */ -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.h
r53634 r53652 28 28 #define _DT_PROC_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 … … 34 35 #include <pthread.h> 35 36 #include <dt_list.h> 37 #else /* VBOX */ 38 # include <dtrace.h> 39 # include <dt_list.h> 40 # include <iprt/critsect.h> 41 #endif /* VBOX */ 42 36 43 37 44 #ifdef __cplusplus … … 45 52 struct ps_prochandle *dpr_proc; /* proc handle for libproc calls */ 46 53 char dpr_errmsg[BUFSIZ]; /* error message */ 54 #ifndef VBOX 47 55 rd_agent_t *dpr_rtld; /* rtld handle for librtld_db calls */ 48 56 pthread_mutex_t dpr_lock; /* lock for manipulating dpr_hdl */ 49 57 pthread_cond_t dpr_cv; /* cond for dpr_stop/quit/done */ 58 #else 59 RTCRITSECT dpr_lock; 60 RTSEMEVENT dpr_cv; 61 #endif 50 62 pid_t dpr_pid; /* pid of process */ 51 63 uint_t dpr_refs; /* reference count */ … … 57 69 uint8_t dpr_stale; /* proc flag: been deprecated */ 58 70 uint8_t dpr_rdonly; /* proc flag: opened read-only */ 71 #ifndef VBOX 59 72 pthread_t dpr_tid; /* control thread (or zero if none) */ 73 #else 74 RTTHREAD dpr_tid; 75 #endif 60 76 dt_list_t dpr_bps; /* list of dt_bkpt_t structures */ 61 77 } dt_proc_t; … … 87 103 88 104 typedef struct dt_proc_hash { 105 #ifndef VBOX 89 106 pthread_mutex_t dph_lock; /* lock protecting dph_notify list */ 90 107 pthread_cond_t dph_cv; /* cond for waiting for dph_notify */ 108 #else 109 RTSEMEVENT dph_event; 110 #endif 91 111 dt_proc_notify_t *dph_notify; /* list of pending proc notifications */ 92 112 dt_list_t dph_lrulist; /* list of dt_proc_t's in lru order */ -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.h
r53634 r53652 28 28 #define _DT_PROGRAM_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.h
r53634 r53652 28 28 #define _DT_PROVIDER_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <dt_impl.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.h
r53634 r53652 28 28 #define _DT_REGSET_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 32 33 #include <sys/types.h> 34 #endif 33 35 34 36 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.h
r53634 r53652 27 27 #define _DT_STRING_H 28 28 29 #ifndef VBOX 29 30 #include <sys/types.h> 30 31 #include <strings.h> 32 #else /* VBOX */ 33 # include <iprt/string.h> 34 #endif /* VBOX */ 31 35 32 36 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.h
r53634 r53652 28 28 #define _DT_STRTAB_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 32 33 #include <sys/types.h> 34 #endif 33 35 34 36 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_work.c
r53634 r53652 26 26 */ 27 27 28 #ifndef VBOX 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 29 30 … … 33 34 #include <assert.h> 34 35 #include <time.h> 36 #else /* VBOX */ 37 # include <dt_impl.h> 38 //# include <stddef.h> 39 //# include <time.h> 40 # include <iprt/semaphore.h> 41 #endif /* VBOX */ 35 42 36 43 static const struct { … … 52 59 53 60 hrtime_t earliest = INT64_MAX; 61 #ifndef VBOX 54 62 struct timespec tv; 63 #endif 55 64 hrtime_t now; 56 65 int i; … … 74 83 } 75 84 85 #ifndef VBOX 76 86 (void) pthread_mutex_lock(&dph->dph_lock); 87 #endif 77 88 78 89 now = gethrtime(); 79 90 80 91 if (earliest < now) { 92 #ifndef VBOX 81 93 (void) pthread_mutex_unlock(&dph->dph_lock); 94 #endif 82 95 return; /* sleep duration has already past */ 83 96 } 84 97 98 #ifndef VBOX 85 99 tv.tv_sec = (earliest - now) / NANOSEC; 86 100 tv.tv_nsec = (earliest - now) % NANOSEC; 101 #endif 87 102 88 103 /* … … 91 106 * awaken, iterate over any pending notifications and process them. 92 107 */ 108 #ifndef VBOX 93 109 (void) pthread_cond_reltimedwait_np(&dph->dph_cv, &dph->dph_lock, &tv); 110 #else 111 RTSemEventWait(dph->dph_event, (earliest - now) / RT_NS_1MS); 112 #endif 94 113 95 114 while ((dprn = dph->dph_notify) != NULL) { … … 107 126 } 108 127 128 #ifndef VBOX 109 129 (void) pthread_mutex_unlock(&dph->dph_lock); 130 #endif 110 131 } 111 132 … … 124 145 125 146 if (dtp->dt_laststatus != 0) { 126 if (now - dtp->dt_laststatus < interval)147 if (now - dtp->dt_laststatus < VBDTCAST(hrtime_t)interval) 127 148 return (DTRACE_STATUS_NONE); 128 149 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.h
r53634 r53652 28 28 #define _DT_XLATOR_H 29 29 30 #ifndef VBOX 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 31 33 32 34 #include <libctf.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h
r53646 r53652 30 30 #ifndef VBOX 31 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #endif33 32 34 33 #include <sys/dtrace.h> 35 34 #include <stdarg.h> 36 35 #include <stdio.h> 37 #ifndef VBOX38 36 #include <gelf.h> 39 #endif 37 #else /* VBOX */ 38 # include <sys/dtrace.h> 39 # include <stdio.h> 40 #endif /* VBOX */ 40 41 41 42 #ifdef __cplusplus … … 435 436 * be flushed and not used subsequently by the client program. 436 437 */ 437 #ifndef VBOX438 438 439 439 #define DTRACE_OBJ_EXEC ((const char *)0L) /* primary executable file */ … … 451 451 uint_t dto_flags; /* object flags (see below) */ 452 452 453 #ifndef VBOX 453 454 GElf_Addr dto_text_va; /* address of text section */ 454 455 GElf_Xword dto_text_size; /* size of text section */ … … 457 458 GElf_Addr dto_bss_va; /* address of BSS */ 458 459 GElf_Xword dto_bss_size; /* size of BSS */ 460 #endif 459 461 } dtrace_objinfo_t; 460 462 … … 473 475 } dtrace_syminfo_t; 474 476 477 #ifndef VBOX 475 478 extern int dtrace_lookup_by_name(dtrace_hdl_t *, const char *, const char *, 476 479 GElf_Sym *, dtrace_syminfo_t *); … … 576 579 extern int _dtrace_debug; 577 580 581 #ifdef VBOX 582 extern void dtrace_init(void); 583 #endif 584 578 585 #ifdef __cplusplus 579 586 } -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf.h
r53649 r53652 28 28 #define _CTF_H 29 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/types.h> 30 #ifndef VBOX 31 # pragma ident "%Z%%M% %I% %E% SMI" 32 #endif 33 34 #ifndef VBOX 35 # include <sys/types.h> 36 #else 37 # include "VBoxDTraceTypes.h" 38 #endif 33 39 34 40 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf_api.h
r53649 r53652 41 41 #define _CTF_API_H 42 42 43 #pragma ident "%Z%%M% %I% %E% SMI" 44 45 #include <sys/types.h> 46 #include <sys/param.h> 47 #include <sys/elf.h> 43 #ifndef VBOX 44 # pragma ident "%Z%%M% %I% %E% SMI" 45 #endif 46 47 #ifndef VBOX 48 # include <sys/types.h> 49 # include <sys/param.h> 50 # include <sys/elf.h> 51 #else 52 # include "VBoxDTraceTypes.h" 53 #endif 48 54 #include <sys/ctf.h> 49 55 … … 72 78 size_t cts_size; /* size of data in bytes */ 73 79 size_t cts_entsize; /* size of each section entry (symtab only) */ 80 #ifndef VBOX 74 81 off64_t cts_offset; /* file offset of this section (if any) */ 82 #else 83 RTFOFF cts_offset; /* file offset of this section (if any) */ 84 #endif 75 85 } ctf_sect_t; 76 86 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h
r53642 r53652 50 50 #include <sys/processor.h> 51 51 #include <sys/systm.h> 52 #include <sys/ctf_api.h>53 52 #include <sys/cyclic.h> 54 53 #include <sys/int_limits.h> 55 54 #else 56 55 # include <VBoxDTraceTypes.h> 56 # include <sys/ctf_api.h> 57 57 #endif 58 58
Note:
See TracChangeset
for help on using the changeset viewer.