summaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
index 0eb2a2cdcc2f..b8b146732a89 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -26,11 +26,10 @@
*/
#include <sys/types.h>
-#if defined(sun)
+#ifdef illumos
#include <sys/modctl.h>
#include <sys/systeminfo.h>
#else
-/* FreeBSD */
#include <sys/param.h>
#include <sys/module.h>
#include <sys/linker.h>
@@ -39,7 +38,7 @@
#include <libelf.h>
#include <strings.h>
-#if defined(sun)
+#ifdef illumos
#include <alloca.h>
#endif
#include <limits.h>
@@ -60,7 +59,7 @@
#include <dt_printf.h>
#include <dt_string.h>
#include <dt_provider.h>
-#if !defined(sun)
+#ifndef illumos
#include <sys/sysctl.h>
#include <string.h>
#endif
@@ -164,7 +163,7 @@ const dt_version_t _dtrace_versions[] = {
/*
* Global variables that are formatted on FreeBSD based on the kernel file name.
*/
-#if !defined(sun)
+#ifndef illumos
static char curthread_str[MAXPATHLEN];
static char intmtx_str[MAXPATHLEN];
static char threadmtx_str[MAXPATHLEN];
@@ -246,7 +245,7 @@ static const dt_ident_t _dtrace_globals[] = {
{ "curthread", DT_IDENT_SCALAR, 0, DIF_VAR_CURTHREAD,
{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE,
DTRACE_CLASS_COMMON }, DT_VERS_1_0,
-#if defined(sun)
+#ifdef illumos
&dt_idops_type, "genunix`kthread_t *" },
#else
&dt_idops_type, curthread_str },
@@ -297,13 +296,13 @@ static const dt_ident_t _dtrace_globals[] = {
{ "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" },
{ "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN,
-#if defined(sun)
+#ifdef illumos
DT_VERS_1_5, &dt_idops_func, "string(ipaddr_t *)" },
#else
DT_VERS_1_5, &dt_idops_func, "string(in_addr_t *)" },
#endif
{ "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN,
-#if defined(sun)
+#ifdef illumos
DT_VERS_1_5, &dt_idops_func, "string(in6_addr_t *)" },
#else
DT_VERS_1_5, &dt_idops_func, "string(struct in6_addr *)" },
@@ -328,7 +327,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@)" },
{ "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "uintptr_t *(void *, size_t)" },
-#if !defined(sun)
+#ifndef illumos
{ "memstr", DT_IDENT_FUNC, 0, DIF_SUBR_MEMSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "string(void *, char, size_t)" },
#endif
@@ -342,7 +341,7 @@ static const dt_ident_t _dtrace_globals[] = {
{ "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "size_t(mblk_t *)" },
-#if defined(sun)
+#ifdef illumos
{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`kmutex_t *)" },
@@ -413,7 +412,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "int()" },
{ "rindex", DT_IDENT_FUNC, 0, DIF_SUBR_RINDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
&dt_idops_func, "int(const char *, const char *, [int])" },
-#if defined(sun)
+#ifdef illumos
{ "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`krwlock_t *)" },
@@ -471,7 +470,7 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "string(const char *, int, [int])" },
{ "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@)" },
-#if !defined(sun)
+#ifndef illumos
{ "sx_isexclusive", DT_IDENT_FUNC, 0, DIF_SUBR_SX_ISEXCLUSIVE,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, sxlock_str },
@@ -531,12 +530,12 @@ static const dt_ident_t _dtrace_globals[] = {
{ "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "int64_t" },
-#if defined(sun)
+#ifdef illumos
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
#endif
-#if !defined(sun)
+#ifndef illumos
{ "cpu", DT_IDENT_SCALAR, 0, DIF_VAR_CPU,
DT_ATTR_STABCMN, DT_VERS_1_6_3, &dt_idops_type, "int" },
#endif
@@ -780,7 +779,7 @@ const dtrace_pattr_t _dtrace_prvdesc = {
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
};
-#if defined(sun)
+#ifdef illumos
const char *_dtrace_defcpp = "/usr/ccs/lib/cpp"; /* default cpp(1) to invoke */
const char *_dtrace_defld = "/usr/ccs/bin/ld"; /* default ld(1) to invoke */
#else
@@ -789,7 +788,7 @@ const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */
#endif
const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */
-#if defined(sun)
+#ifdef illumos
const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */
#else
const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */
@@ -814,7 +813,7 @@ typedef struct dt_fdlist {
uint_t df_size; /* size of df_fds[] */
} dt_fdlist_t;
-#if defined(sun)
+#ifdef illumos
#pragma init(_dtrace_init)
#else
void _dtrace_init(void) __attribute__ ((constructor));
@@ -850,7 +849,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
dt_provmod_t *prov;
char path[PATH_MAX];
int fd;
-#if defined(sun)
+#ifdef illumos
struct dirent *dp, *ep;
DIR *dirp;
@@ -897,7 +896,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
}
(void) closedir(dirp);
-#else
+#else /* !illumos */
char *p;
char *p1;
char *p_providers = NULL;
@@ -982,7 +981,7 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
}
if (p_providers != NULL)
free(p_providers);
-#endif
+#endif /* illumos */
}
static void
@@ -999,7 +998,7 @@ dt_provmod_destroy(dt_provmod_t **provmod)
*provmod = NULL;
}
-#if defined(sun)
+#ifdef illumos
static const char *
dt_get_sysinfo(int cmd, char *buf, size_t len)
{
@@ -1112,7 +1111,7 @@ dt_vopen(int version, int flags, int *errp,
err = errno;
}
#endif
-#if defined(sun)
+#ifdef illumos
ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
#else
ftfd = open("/dev/dtrace/fasttrap", O_RDWR);
@@ -1154,7 +1153,7 @@ alloc:
bzero(dtp, sizeof (dtrace_hdl_t));
dtp->dt_oflags = flags;
-#if defined(sun)
+#ifdef illumos
dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
#else
dtp->dt_prcmode = DT_PROC_STOP_POSTINIT;
@@ -1170,7 +1169,7 @@ alloc:
dtp->dt_fterr = fterr;
dtp->dt_cdefs_fd = -1;
dtp->dt_ddefs_fd = -1;
-#if defined(sun)
+#ifdef illumos
dtp->dt_stdout_fd = -1;
#else
dtp->dt_freopen_fp = NULL;
@@ -1202,7 +1201,7 @@ alloc:
dtp->dt_cpp_argv[0] = (char *)strbasename(dtp->dt_cpp_path);
-#if defined(sun)
+#ifdef illumos
(void) snprintf(isadef, sizeof (isadef), "-D__SUNW_D_%u",
(uint_t)(sizeof (void *) * NBBY));
@@ -1242,7 +1241,7 @@ alloc:
return (set_open_errno(dtp, errp, EDT_NOMEM));
#endif
-#if defined(sun)
+#ifdef illumos
#ifdef __x86
/*
* On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit
@@ -1282,7 +1281,7 @@ alloc:
* 'kern.bootfile' sysctl value tells us exactly which file is being
* used as the kernel.
*/
-#if !defined(sun)
+#ifndef illumos
{
char bootfile[MAXPATHLEN];
char *p;
@@ -1644,7 +1643,7 @@ dtrace_close(dtrace_hdl_t *dtp)
(void) close(dtp->dt_cdefs_fd);
if (dtp->dt_ddefs_fd != -1)
(void) close(dtp->dt_ddefs_fd);
-#if defined(sun)
+#ifdef illumos
if (dtp->dt_stdout_fd != -1)
(void) close(dtp->dt_stdout_fd);
#else