aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/lockstat/sym.c
diff options
context:
space:
mode:
authorSteven Hartland <smh@FreeBSD.org>2015-01-17 14:44:59 +0000
committerSteven Hartland <smh@FreeBSD.org>2015-01-17 14:44:59 +0000
commitbc96366c864c07ef352edb92017357917c75b36c (patch)
tree09e9633064b6303a8afc6891fff761eb6e399cee /cddl/contrib/opensolaris/cmd/lockstat/sym.c
parentb0b74fb366450ac61b7df38daa92bc19cbfc3ecc (diff)
downloadsrc-bc96366c864c07ef352edb92017357917c75b36c.tar.gz
src-bc96366c864c07ef352edb92017357917c75b36c.zip
Mechanically convert cddl sun #ifdef's to illumos
Since the upstream for cddl code is now illumos not sun, mechanically convert all sun #ifdef's to illumos #ifdef's which have been used in all newer code for some time. Also do a manual pass to correct the use if #ifdef comments as per style(9) as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos. MFC after: 1 month Sponsored by: Multiplay
Notes
Notes: svn path=/head/; revision=277300
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