- Timestamp:
- Jan 2, 2015 12:19:28 PM (10 years ago)
- Location:
- trunk/src/VBox/ExtPacks/VBoxDTrace
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTrace/Makefile.kmk
r53652 r53653 42 42 $(VBOXDT_PATH_CMD)/dtrace/dtrace.c \ 43 43 \ 44 $(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \ 45 $(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \ 46 $(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \ 47 $(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \ 48 $(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \ 44 49 $(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \ 45 $(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \ 46 $(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \ 50 $(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \ 51 $(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \ 52 $(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \ 53 $(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \ 54 $(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \ 55 $(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \ 56 $(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \ 47 57 $(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \ 48 $(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \49 58 50 59 VBoxDTrace_VBOX_TODO = \ 51 $(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \52 $(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \53 60 $(VBOXDT_PATH_LIBDTRACE)/common/dt_cc.c \ 54 61 $(VBOXDT_PATH_LIBDTRACE)/common/dt_cg.c \ … … 62 69 $(VBOXDT_PATH_LIBDTRACE)/common/dt_inttab.c \ 63 70 $(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c \ 64 $(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \65 $(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \66 71 $(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \ 67 72 $(VBOXDT_PATH_LIBDTRACE)/common/dt_map.c \ … … 72 77 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c \ 73 78 $(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \ 74 $(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \75 79 $(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \ 76 $(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \77 $(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \78 $(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \79 $(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \80 80 $(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c 81 81 -
trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
r53652 r53653 47 47 typedef unsigned int uint_t; 48 48 typedef uintptr_t ulong_t; 49 typedef uint64_t u_longlong_t; 49 50 typedef uint64_t hrtime_t; 50 51 typedef RTCCUINTREG greg_t; … … 61 62 62 63 #define NANOSEC RT_NS_1SEC 64 #define MICROSEC RT_US_1SEC 63 65 #define MILLISEC RT_MS_1SEC 66 #define SEC 1 64 67 #define MAXPATHLEN RTPATH_MAX 65 68 #define PATH_MAX RTPATH_MAX … … 67 70 #define NCPU RTCPUSET_MAX_CPUS 68 71 72 #define MIN(a1, a2) RT_MIN(a1, a2) 73 #define MAX(a1, a2) RT_MAX(a1, a2) 74 #define ABS(a_iValue) RT_ABS(a_iValue) 75 #define roundup(uWhat, uUnit) ( ( (uWhat) + ((uUnit) - 1)) / (uUnit) * (uUnit) ) 76 69 77 #if defined(RT_ARCH_X86) 70 78 # ifndef __i386 71 # define __i386 179 # define __i386 1 72 80 # endif 73 81 # ifndef __x86 74 # define __x86 1 82 # define __x86 1 83 # endif 84 # ifndef _IPL32 85 # define _IPL32 1 75 86 # endif 76 87 77 88 #elif defined(RT_ARCH_AMD64) 78 89 # ifndef __x86_64 79 # define __x86_64 190 # define __x86_64 1 80 91 # endif 81 92 # ifndef __x86 82 # define __x86 1 93 # define __x86 1 94 # endif 95 # ifndef _LP64 96 # define _LP64 1 83 97 # endif 84 98 … … 109 123 # define snprintf RTStrPrintf 110 124 #endif 111 112 125 113 126 /* … … 131 144 #if defined(_MSC_VER) || defined(IN_RING0) 132 145 # define EALREADY (114) 146 # define EOVERFLOW (79) 147 #endif 148 149 /* 150 * Bitmap stuff. 151 */ 152 #define BT_SIZEOFMAP(a_cBits) ( (a_cBits + 63) / 8 ) 153 #define BT_SET(a_aulBitmap, iBit) ASMBitSet(a_aulBitmap, iBit) 154 #define BT_CLEAR(a_aulBitmap, iBit) ASMBitClear(a_aulBitmap, iBit) 155 #define BT_TEST(a_aulBitmap, iBit) ASMBitTest(a_aulBitmap, iBit) 156 #if ARCH_BITS == 32 157 # define BT_NBIPUL 32 158 # define BT_ULSHIFT 5 /* log2(32) = 5 */ 159 # define BT_ULMASK 0x1f 160 # define BT_BITOUL(a_cBits) ( ((a_cBits) + 31) / 32 ) 161 #elif ARCH_BITS == 64 162 # define BT_NBIPUL 64 163 # define BT_ULSHIFT 6 /* log2(32) = 6 */ 164 # define BT_ULMASK 0x3f 165 # define BT_BITOUL(a_cBits) ( ((a_cBits) + 63) / 64 ) 166 #else 167 # error Bad ARCH_BITS... 133 168 #endif 134 169 … … 141 176 #define P2ROUNDUP(uWhat, uAlign) ( ((uWhat) + (uAlign) - 1) & ~(uAlign - 1) ) 142 177 #define IS_P2ALIGNED(uWhat, uAlign) ( !((uWhat) & ((uAlign) - 1)) ) 143 #define roundup(uWhat, uUnit) ( ( (uWhat) + ((uUnit) - 1)) / (uUnit) * (uUnit) )144 #define MIN(a1, a2) RT_MIN(a1, a2)145 178 146 179 #define B_FALSE (0) … … 359 392 */ 360 393 # include <iprt/alloca.h> 394 # include <iprt/assert.h> 361 395 # include <iprt/mem.h> 362 396 # include <iprt/string.h> 363 397 # include <iprt/time.h> 364 398 # define gethrtime() RTTimeNanoTS() 399 # define strcasecmp(a_psz1, a_psz2) RTStrICmp(a_psz1, a_psz2) 400 # define strncasecmp(a_psz1, a_psz2, a_cch) \ 401 RTStrNICmp(a_psz1, a_psz2, a_cch) 402 # define assert(expr) Assert(expr) 365 403 366 404 /* This isn't necessarily making things easier at first, but allows EF and … … 373 411 # define free(a_pvMem) RTMemFree(a_pvMem) 374 412 # define strdup(a_psz) RTStrDup(a_psz) 413 # define strlcpy(a_pszDst, a_pszSrc, a_cbDst) ((void)RTStrCopy(a_pszDst, a_cbDst, a_pszSrc)) 414 375 415 376 416 #endif -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c
r53652 r53653 73 73 74 74 # define getpid RTProcSelf 75 # define strlcpy(a_pszDst, a_pszSrc, a_cbDst) RTStrCopy(a_pszDst, a_cbDst, a_pszSrc)76 75 # define basename(a_pszPath) RTPathFilename(a_pszPath) 77 76 … … 1256 1255 #ifndef VBOX 1257 1256 char c, *p, **v; 1257 struct ps_prochandle *P; 1258 pid_t pid; 1258 1259 #else 1259 1260 int c; 1260 char *p, **v; 1261 #endif 1262 struct ps_prochandle *P; 1263 pid_t pid; 1264 #ifdef VBOX 1261 char *p; 1265 1262 RTGETOPTUNION ValueUnion; 1266 1263 RTGETOPTSTATE GetState; -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 … … 31 32 #include <stdlib.h> 32 33 #include <assert.h> 34 #else /* VBOX */ 35 # include <iprt/asm.h> 36 #endif /* VBOX */ 33 37 34 38 #include <dt_impl.h> … … 237 241 case DT_LINK_KERNEL: 238 242 kmask = 0; 239 kbits = -1u;243 kbits = ~0u; 240 244 umask = DT_IDFLG_USER; 241 245 ubits = DT_IDFLG_USER; … … 255 259 case DT_LINK_STATIC: 256 260 kmask = umask = 0; 257 kbits = ubits = -1u;261 kbits = ubits = ~0u; 258 262 break; 259 263 default: -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 29 #endif 28 30 29 31 /* … … 40 42 */ 41 43 44 #ifndef VBOX 42 45 #include <sys/sysmacros.h> 43 46 #include <strings.h> 47 #endif 44 48 45 49 #include <dt_impl.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cg.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 … … 36 37 #include <assert.h> 37 38 #include <errno.h> 39 #else /* VBOX */ 40 #endif /* VBOX */ 38 41 39 42 #include <dt_impl.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_impl.h
r53652 r53653 41 41 # include <dtrace.h> 42 42 # include <errno.h> 43 # include <iprt/assert.h>44 # define assert(expr) Assert(expr)45 43 #endif /* VBOX*/ 46 44 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 29 #endif 28 30 29 31 /* … … 36 38 */ 37 39 40 #ifndef VBOX 38 41 #include <unistd.h> 39 42 #include <assert.h> 43 #endif 40 44 #include <dt_list.h> 41 45 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.h
r53652 r53653 30 30 #ifndef VBOX 31 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 #else 33 # include "VBoxDTraceTypes.h" 32 34 #endif 33 35 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_options.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 … … 40 41 #include <fcntl.h> 41 42 43 #else /* VBOX */ 44 # ifndef _MSC_VER 45 # include <sys/resource.h> 46 # include <unistd.h> 47 # include <signal.h> 48 # else 49 # include <io.h> 50 # define STDERR_FILENO 2 51 # define open64 open 52 # endif 53 # include <fcntl.h> 54 # include <stdlib.h> 55 56 #endif /* VBOX */ 57 42 58 #include <dt_impl.h> 43 59 #include <dt_string.h> … … 84 100 const char msg[] = "libdtrace DEBUG: [ forcing coredump ]\n"; 85 101 102 #ifndef _MSC_VER 86 103 struct sigaction act; 87 104 struct rlimit lim; 105 #endif 88 106 89 107 (void) write(STDERR_FILENO, msg, sizeof (msg) - 1); 90 108 109 #ifndef _MSC_VER 91 110 act.sa_handler = SIG_DFL; 92 111 act.sa_flags = 0; … … 99 118 100 119 (void) setrlimit(RLIMIT_CORE, &lim); 120 #endif /* !_MSC_VER */ 101 121 abort(); 102 122 } … … 514 534 dt_opt_runtime(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) 515 535 { 536 #ifndef VBOX 516 537 char *end; 538 #endif 517 539 dtrace_optval_t val = 0; 518 540 int i; … … 549 571 } 550 572 573 #ifndef VBOX 551 574 errno = 0; 552 575 val = strtoull(arg, &end, 0); … … 554 577 if (*end != '\0' || errno != 0 || val < 0) 555 578 return (dt_set_errno(dtp, EDT_BADOPTVAL)); 579 #else 580 i = RTStrToInt64Full(arg, 0, &val); 581 if (i != VINF_SUCCESS) 582 return (dt_set_errno(dtp, EDT_BADOPTVAL)); 583 #endif 556 584 } 557 585 … … 567 595 size_t len; 568 596 char *end; 597 #ifdef VBOX 598 int rc; 599 #endif 569 600 570 601 len = strlen(arg); 602 #ifndef VBOX 571 603 errno = 0; 604 #endif 572 605 573 606 switch (arg[len - 1]) { … … 592 625 } 593 626 627 #ifndef VBOX 594 628 errno = 0; 595 629 *rval = strtoull(arg, &end, 0) * mul; … … 598 632 *rval < 0 || errno != 0) 599 633 return (-1); 634 #else 635 *rval = -1; 636 if (mul == 1) { 637 rc = RTStrToInt64Full(arg, 0, rval); 638 if (rc != VINF_SUCCESS || *rval < 0) 639 return (-1); 640 } else { 641 rc = RTStrToInt64Ex(arg, &end, 0, rval); 642 if ( rc != VWRN_TRAILING_CHARS 643 || end != &arg[len - 1] 644 || *rval < 0) 645 return (-1); 646 *rval *= mul; 647 if (*rval < 0) 648 return (-1); 649 } 650 #endif 600 651 601 652 return (0); … … 644 695 645 696 if (arg != NULL) { 697 #ifndef VBOX 646 698 errno = 0; 647 699 val = strtoull(arg, &end, 0); 700 #else 701 int rc = RTStrToInt64Ex(arg, &end, 0, &val); 702 if (rc != VWRN_TRAILING_CHARS) 703 return (dt_set_errno(dtp, EDT_BADOPTVAL)); 704 #endif 648 705 649 706 for (i = 0; suffix[i].name != NULL; i++) { … … 787 844 dof_sec_t *sec; 788 845 size_t offs; 789 inti;846 VBDTTYPE(uint32_t,int) i; 790 847 791 848 /* -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.c
r53634 r53653 24 24 */ 25 25 26 #ifndef VBOX 26 27 #include <sys/sysmacros.h> 27 28 #include <strings.h> … … 37 38 #include <arpa/inet.h> 38 39 #include <arpa/nameser.h> 40 #else /* VBOX */ 41 # include <iprt/asm.h> 42 # include <ctype.h> 43 #endif /* VBOX */ 39 44 40 45 #include <dt_printf.h> 41 46 #include <dt_string.h> 42 47 #include <dt_impl.h> 48 49 #ifdef VBOX 50 static const char g_aszMonth[12][4] = 51 { "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 52 static const char g_aszDay[7][4] = 53 { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; 54 #endif 43 55 44 56 /*ARGSUSED*/ … … 302 314 return (dt_printf(dtp, fp, format, 303 315 *((double *)addr) / n)); 316 #ifndef _MSC_VER 304 317 case sizeof (long double): 305 318 return (dt_printf(dtp, fp, format, 306 319 *((long double *)addr) / ldn)); 320 #endif 307 321 default: 308 322 return (dt_set_errno(dtp, EDT_DMISMATCH)); … … 447 461 const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal) 448 462 { 463 #ifndef VBOX 449 464 char src[32], buf[32], *dst = buf; 450 465 hrtime_t time = *((uint64_t *)addr); … … 472 487 473 488 *dst = '\0'; 489 #else 490 RTTIMESPEC TimeSpec; 491 RTTIME Time; 492 char buf[32]; 493 494 RTTimeLocalExplode(&Time, RTTimeSpecSetNano(&TimeSpec, *(uint64_t *)addr)); 495 RTStrPrintf(buf, sizeof(buf), "%u %s %2u %02u:%02u:%02u", 496 Time.i32Year, g_aszMonth[Time.u8Month - 1], 497 Time.u8MonthDay, Time.u8Hour, Time.u8Minute, Time.u8Second); 498 #endif 474 499 return (dt_printf(dtp, fp, format, buf)); 475 500 } … … 485 510 const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal) 486 511 { 512 #ifndef VBOX 487 513 hrtime_t time = *((uint64_t *)addr); 488 514 time_t sec = (time_t)(time / NANOSEC); … … 492 518 (void) localtime_r(&sec, &tm); 493 519 (void) strftime(buf, sizeof (buf), "%a, %d %b %G %T %Z", &tm); 520 #else 521 RTTIMESPEC TimeSpec; 522 RTTIME Time; 523 char buf[64]; 524 525 RTTimeLocalExplode(&Time, RTTimeSpecSetNano(&TimeSpec, *(uint64_t *)addr)); 526 RTStrPrintf(buf, sizeof(buf), "%s, %u %s %u %02u:%02u:%02u %s%u%s", 527 g_aszDay[Time.u8WeekDay], Time.u8MonthDay, g_aszMonth[Time.u8Month - 1], 528 Time.u8Hour, Time.u8Minute, Time.u8Second, 529 Time.offUTC >= 0 ? "UTC+" : "UTC", Time.offUTC / 60, 530 Time.offUTC % 60 == 30 ? ".5" : ""); 531 #endif 494 532 return (dt_printf(dtp, fp, format, buf)); 495 533 } … … 500 538 const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal) 501 539 { 540 #ifndef VBOX 502 541 uint16_t port = htons(*((uint16_t *)addr)); 503 542 char buf[256]; … … 508 547 509 548 (void) snprintf(buf, sizeof (buf), "%d", *((uint16_t *)addr)); 549 #else 550 uint16_t uPortNet = *(uint16_t *)addr; 551 char buf[32]; 552 553 RTStrPrintf(buf, sizeof(buf), "%d", RT_N2H_U16(uPortNet)); 554 #endif 510 555 return (dt_printf(dtp, fp, format, buf)); 511 556 } … … 517 562 { 518 563 char *s = alloca(size + 1); 564 #ifndef VBOX 519 565 struct hostent *host, res; 520 566 char inetaddr[NS_IN6ADDRSZ]; 521 567 char buf[1024]; 522 568 int e; 569 #endif 523 570 524 571 bcopy(addr, s, size); 525 572 s[size] = '\0'; 526 573 574 #ifndef VBOX 527 575 if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) { 528 576 if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ, … … 534 582 return (dt_printf(dtp, fp, format, host->h_name)); 535 583 } 584 #endif 536 585 537 586 return (dt_printf(dtp, fp, format, s)); … … 1024 1073 const char *aggtype; 1025 1074 dt_node_t aggnode; 1026 inti, j;1075 VBDTTYPE(uint_t,int) i, j; 1027 1076 1028 1077 if (pfv->pfv_format[0] == '\0') { … … 1337 1386 } 1338 1387 1339 for (i = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {1388 for (i = 0; VBDTCAST(uint_t)i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) { 1340 1389 const dt_pfconv_t *pfc = pfd->pfd_conv; 1341 1390 int width = pfd->pfd_width; … … 1607 1656 uint_t nrecs, const void *buf, size_t len) 1608 1657 { 1658 #ifndef VBOX 1609 1659 char selfbuf[40], restorebuf[40], *filename; 1610 1660 FILE *nfp; 1611 int rval, errval;1612 1661 dt_pfargv_t *pfv = fmtdata; 1613 1662 dt_pfargd_t *pfd = pfv->pfv_argv; 1663 #else 1664 int rval, errval; 1665 #endif 1614 1666 1615 1667 rval = dtrace_sprintf(dtp, fp, fmtdata, recp, nrecs, buf, len); … … 1618 1670 return (rval); 1619 1671 1672 #ifndef VBOX 1620 1673 if (pfd->pfd_preflen != 0 && 1621 1674 strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 0) { … … 1700 1753 1701 1754 return (rval); 1755 1756 #else /* VBOX - the above is not easily portable because of /dev/fd/xxx. */ 1757 if ((errval = dt_handle_liberr(dtp, data, "reopening stdout is not implemented")) == 0) 1758 return (rval); 1759 return (errval); 1760 #endif 1702 1761 } 1703 1762 … … 1717 1776 dt_pfargv_t *pfv = dt_printf_create(dtp, s); 1718 1777 dt_pfargd_t *pfd; 1719 inti;1778 VBDTTYPE(uint_t,int) i; 1720 1779 1721 1780 if (pfv == NULL) … … 1776 1835 char *format = alloca(formatlen); 1777 1836 char *f = format; 1837 #ifndef VBOX 1778 1838 int i, j; 1839 #else 1840 uint_t i; 1841 size_t j; 1842 #endif 1779 1843 1780 1844 for (i = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) { … … 1916 1980 * a different statement. 1917 1981 */ 1918 for (i = 0; i < nrecs; i++) {1982 for (i = 0; VBDTCAST(uint_t)i < nrecs; i++) { 1919 1983 const dtrace_recdesc_t *nrec = &recs[i]; 1920 1984 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 … … 32 33 #include <strings.h> 33 34 #include <stdlib.h> 35 #else /* VBOX */ 36 # include <iprt/asm.h> 37 #endif /* VBOX */ 34 38 35 39 #include <dt_regset.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.h
r53652 r53653 32 32 33 33 #include <sys/types.h> 34 #endif 34 #else /* VBOX */ 35 # include "VBoxDTraceTypes.h" 36 #endif /* VBOX */ 35 37 36 38 #ifdef __cplusplus -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.c
r53634 r53653 24 24 */ 25 25 26 #ifndef VBOX 26 27 #include <strings.h> 27 28 #include <stdlib.h> … … 30 31 31 32 #include <dt_string.h> 33 34 #else /* VBOX */ 35 # include <dt_string.h> 36 # include <dt_impl.h> 37 # include <iprt/ctype.h> 38 # define isalnum(a_ch) RT_C_IS_ALNUM(a_ch) 39 #endif /* VBOX */ 32 40 33 41 /* … … 253 261 strbadidnum(const char *s) 254 262 { 263 #ifndef VBOX 255 264 char *p; 265 #endif 256 266 int c; 257 267 … … 259 269 return (s); 260 270 271 #ifndef VBOX 261 272 errno = 0; 262 273 (void) strtoull(s, &p, 0); … … 264 275 if (errno == 0 && *p == '\0') 265 276 return (NULL); /* matches RGX_INT */ 277 #else 278 /* A number? */ 279 c = *s; 280 if (RT_C_IS_DIGIT(c)) { 281 s++; 282 if (c == '0') { 283 c = *s; 284 if (c == 'x' || c == 'X') { 285 s++; 286 while ((c = *s++) != '\0') { 287 if (RT_C_IS_XDIGIT(c) == 0) 288 return (s - 1); 289 } 290 } else { 291 while ((c = *s++) != '\0') { 292 if (RT_C_IS_ODIGIT(c) == 0) 293 return (s - 1); 294 } 295 } 296 } else { 297 while ((c = *s++) != '\0') { 298 if (RT_C_IS_DIGIT(c) == 0) 299 return (s - 1); 300 } 301 } 302 return (NULL); /* matches RGX_INT */ 303 } 304 #endif 266 305 267 306 while ((c = *s++) != '\0') { -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.c
r53634 r53653 25 25 */ 26 26 27 #ifndef VBOX 27 28 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 … … 32 33 #include <stdlib.h> 33 34 #include <assert.h> 35 #endif 34 36 35 37 #include <dt_strtab.h> -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.h
r53652 r53653 32 32 33 33 #include <sys/types.h> 34 #else 35 # include "VBoxDTraceTypes.h" 34 36 #endif 35 37 -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c
r53634 r53653 24 24 */ 25 25 26 #ifndef VBOX 26 27 #include <sys/sysmacros.h> 27 28 … … 38 39 #include <libgen.h> 39 40 #include <limits.h> 41 #else /* VBOX */ 42 # include <ctype.h> 43 # include <iprt/mp.h> 44 # ifdef _MSC_VER 45 # include <io.h> 46 # else 47 # include <unistd.h> 48 # endif 49 #endif /* VBOX */ 40 50 41 51 #include <dt_impl.h> … … 217 227 dtrace_class_t c; 218 228 char *p, *q; 229 #ifdef VBOX 230 size_t cbStr; 231 #endif 219 232 220 233 if (str == NULL || attr == NULL) … … 222 235 223 236 *attr = _dtrace_maxattr; 237 #ifndef VBOX 224 238 p = strdupa(str); 239 #else 240 cbStr = strlen(str) + 1; 241 p = alloca(cbStr); 242 memcpy(p, str, cbStr); 243 #endif 225 244 226 245 if ((p = dt_getstrattr(p, &q)) == NULL) … … 473 492 return (v->dtv_ioctl(dtp->dt_varg, val, arg)); 474 493 494 #ifndef VBOX 475 495 if (dtp->dt_fd >= 0) 476 496 return (ioctl(dtp->dt_fd, val, arg)); 497 #else 498 AssertFailed(); /** @todo FIXME */ 499 #endif 477 500 478 501 errno = EBADF; … … 486 509 487 510 if (v == NULL) 511 #ifndef VBOX 488 512 return (p_online(cpu, P_STATUS)); 513 #else 514 return RTMpIsCpuOnline(cpu) ? 1 515 : RTMpIsCpuPresent(cpu) ? 0 : -1; /* Only -1 is checked. */ 516 #endif 489 517 490 518 return (v->dtv_status(dtp->dt_varg, cpu)); 491 519 } 492 520 521 #ifndef VBOX 493 522 long 494 523 dt_sysconf(dtrace_hdl_t *dtp, int name) … … 501 530 return (v->dtv_sysconf(dtp->dt_varg, name)); 502 531 } 532 #endif /* !VBOX */ 503 533 504 534 /* … … 561 591 assert(dtp->dt_sprintf_buf != NULL); 562 592 563 buf = &dtp->dt_sprintf_buf[len = strlen(dtp->dt_sprintf_buf)];593 buf = &dtp->dt_sprintf_buf[len = VBDTCAST(int)strlen(dtp->dt_sprintf_buf)]; 564 594 len = dtp->dt_sprintf_buflen - len; 565 595 assert(len >= 0); … … 742 772 dt_gmatch(const char *s, const char *p) 743 773 { 774 #ifndef VBOX 744 775 return (p == NULL || *p == '\0' || gmatch(s, p)); 776 #else 777 return (p == NULL || *p == '\0' || RTStrSimplePatternMatch(p, s)); /** @todo implement gmatch. */ 778 #endif 745 779 } 746 780 … … 805 839 dt_string2str(char *s, char *str, int nbytes) 806 840 { 807 int len = strlen(s);841 int len = VBDTCAST(int)strlen(s); 808 842 809 843 if (nbytes == 0) { … … 832 866 dtrace_addr2str(dtrace_hdl_t *dtp, uint64_t addr, char *str, int nbytes) 833 867 { 868 #ifndef VBOX 834 869 dtrace_syminfo_t dts; 835 870 GElf_Sym sym; … … 863 898 } 864 899 } 900 #else 901 char s[32]; 902 RTStrPrintf(s, sizeof(s), "0x%llx", (uint64_t)addr); 903 #endif 865 904 866 905 return (dt_string2str(s, str, nbytes)); … … 871 910 uint64_t addr, char *str, int nbytes) 872 911 { 912 #ifndef VBOX 873 913 char name[PATH_MAX], objname[PATH_MAX], c[PATH_MAX * 2]; 874 914 struct ps_prochandle *P = NULL; … … 906 946 dt_proc_unlock(dtp, P); 907 947 dt_proc_release(dtp, P); 948 #else 949 char c[32]; 950 RTStrPrintf(c, sizeof (c), "0x%llx", addr); 951 #endif 908 952 909 953 return (dt_string2str(c, str, nbytes)); -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h
r53652 r53653 525 525 const dtrace_probedesc_t *, dtrace_probeinfo_t *); 526 526 527 #ifndef VBOX528 527 /* 529 528 * DTrace Vector Interface … … 536 535 struct dtrace_vector { 537 536 int (*dtv_ioctl)(void *, int, void *); 537 #ifndef VBOX 538 538 int (*dtv_lookup_by_addr)(void *, GElf_Addr, GElf_Sym *, 539 539 dtrace_syminfo_t *); 540 #endif /* !VBOX */ 540 541 int (*dtv_status)(void *, processorid_t); 541 542 long (*dtv_sysconf)(void *, int); 542 543 }; 543 #endif /* !VBOX */544 544 545 545 /*
Note:
See TracChangeset
for help on using the changeset viewer.