aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/lockstat/sym.c
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/lockstat/sym.c')
-rw-r--r--cddl/contrib/opensolaris/cmd/lockstat/sym.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/cddl/contrib/opensolaris/cmd/lockstat/sym.c b/cddl/contrib/opensolaris/cmd/lockstat/sym.c
index 5940c938d96c..f3feb549c477 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>
#include <sys/param.h>
@@ -66,7 +65,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
@@ -105,7 +104,7 @@ remove_symbol(uintptr_t addr)
sep->addr = 0;
}
-#if defined(sun)
+#ifdef illumos
static void
fake_up_certain_popular_kernel_symbols(void)
{
@@ -133,8 +132,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)
{
@@ -151,7 +149,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)
@@ -177,12 +175,12 @@ symtab_init(void)
int fd;
int i;
int strindex = -1;
-#if !defined(sun)
+#ifndef illumos
void *ksyms;
size_t sz;
#endif
-#if defined(__FreeBSD__)
+#ifndef illumos
if ((fd = open("/dev/ksyms", O_RDONLY)) == -1) {
if (errno == ENOENT && modfind("ksyms") == -1) {
kldload("ksyms");
@@ -196,12 +194,11 @@ symtab_init(void)
return (-1);
#endif
-#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