diff options
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/lockstat')
-rw-r--r-- | cddl/contrib/opensolaris/cmd/lockstat/lockstat.c | 24 | ||||
-rw-r--r-- | cddl/contrib/opensolaris/cmd/lockstat/sym.c | 17 |
2 files changed, 18 insertions, 23 deletions
diff --git a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c index 07f7cda..4f2f2c7 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c @@ -46,10 +46,9 @@ #include <signal.h> #include <assert.h> -#if defined(sun) +#ifdef illumos #define GETOPT_EOF EOF #else -/* FreeBSD */ #include <sys/time.h> #include <sys/resource.h> @@ -57,7 +56,7 @@ #define GETOPT_EOF (-1) typedef uintptr_t pc_t; -#endif /* defined(sun) */ +#endif #define LOCKSTAT_OPTSTR "x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V" @@ -226,10 +225,9 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'H', "Lock", "Unknown event (type 53)", "units" }, { 'H', "Lock", "Unknown event (type 54)", "units" }, { 'H', "Lock", "Unknown event (type 55)", "units" }, -#if defined(sun) +#ifdef illumos { 'I', "CPU+PIL", "Profiling interrupt", "nsec", #else - /* FreeBSD */ { 'I', "CPU+Pri_Class", "Profiling interrupt", "nsec", #endif "profile:::profile-97", NULL }, @@ -243,7 +241,7 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'E', "Lock", "Lockstat record failure", "(N/A)" }, }; -#if !defined(sun) +#ifndef illumos static char *g_pri_class[] = { "", "Intr", @@ -610,7 +608,7 @@ filter_add(char **filt, char *what, uintptr_t base, uintptr_t size) *filt[0] = '\0'; } -#if defined(sun) +#ifdef illumos (void) sprintf(c, "%s(%s >= 0x%p && %s < 0x%p)", *filt[0] != '\0' ? " || " : "", what, (void *)base, what, (void *)(base + size)); #else @@ -688,7 +686,7 @@ dprog_addevent(int event) * the number of nanoseconds) is the number of nanoseconds * late -- and it's stored in arg2. */ -#if defined(sun) +#ifdef illumos arg0 = "(uintptr_t)curthread->t_cpu + \n" "\t curthread->t_cpu->cpu_profile_pil"; #else @@ -836,7 +834,7 @@ dprog_compile() } static void -#if defined(sun) +#ifdef illumos status_fire(void) #else status_fire(int i) @@ -1435,7 +1433,7 @@ main(int argc, char **argv) exit(127); } -#if defined(sun) +#ifdef illumos while (waitpid(child, &status, WEXITED) != child) #else while (waitpid(child, &status, 0) != child) @@ -1480,7 +1478,7 @@ main(int argc, char **argv) dfail("failed to walk aggregate"); } -#if defined(sun) +#ifdef illumos if ((data_buf = memalign(sizeof (uint64_t), (g_nrecs + 1) * g_recsize)) == NULL) #else @@ -1512,7 +1510,7 @@ main(int argc, char **argv) if (g_gflag) { lsrec_t *newlsp, *oldlsp; -#if defined(sun) +#ifdef illumos newlsp = memalign(sizeof (uint64_t), g_nrecs_used * LS_TIME * (g_stkdepth + 1)); #else @@ -1676,7 +1674,7 @@ format_symbol(char *buf, uintptr_t addr, int show_size) else if (symoff == 0) (void) sprintf(buf, "%s", symname); else if (symoff < 16 && bcmp(symname, "cpu[", 4) == 0) /* CPU+PIL */ -#if defined(sun) +#ifdef illumos (void) sprintf(buf, "%s+%ld", symname, (long)symoff); #else (void) sprintf(buf, "%s+%s", symname, g_pri_class[(int)symoff]); diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c index 78b27d2..5361607 100644 --- a/cddl/contrib/opensolaris/cmd/lockstat/sym.c +++ b/cddl/contrib/opensolaris/cmd/lockstat/sym.c @@ -42,12 +42,11 @@ #include <libelf.h> #include <link.h> #include <elf.h> -#if defined(sun) +#ifdef illumos #include <sys/machelf.h> #include <kstat.h> #else -/* FreeBSD */ #include <sys/elf.h> #include <sys/ksyms.h> #endif @@ -63,7 +62,7 @@ static syment_t *symbol_table; static int nsyms, maxsyms; static char maxsymname[64]; -#if defined(sun) +#ifdef illumos #ifdef _ELF64 #define elf_getshdr elf64_getshdr #else @@ -102,7 +101,7 @@ remove_symbol(uintptr_t addr) sep->addr = 0; } -#if defined(sun) +#ifdef illumos static void fake_up_certain_popular_kernel_symbols(void) { @@ -130,8 +129,7 @@ fake_up_certain_popular_kernel_symbols(void) } (void) kstat_close(kc); } -#else -/* FreeBSD */ +#else /* !illumos */ static void fake_up_certain_popular_kernel_symbols(void) { @@ -148,7 +146,7 @@ fake_up_certain_popular_kernel_symbols(void) add_symbol(name, addr, sizeof (uintptr_t)); } } -#endif /* !defined(sun) */ +#endif /* illumos */ static int symcmp(const void *p1, const void *p2) @@ -174,7 +172,7 @@ symtab_init(void) int fd; int i; int strindex = -1; -#if !defined(sun) +#ifndef illumos void *ksyms; size_t sz; #endif @@ -182,12 +180,11 @@ symtab_init(void) if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) return (-1); -#if defined(sun) +#ifdef illumos (void) elf_version(EV_CURRENT); elf = elf_begin(fd, ELF_C_READ, NULL); #else - /* FreeBSD */ /* * XXX - libelf needs to be fixed so it will work with * non 'ordinary' files like /dev/ksyms. The following |