aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>2008-04-26 00:54:52 +0000
committerJohn Birrell <jb@FreeBSD.org>2008-04-26 00:54:52 +0000
commit275928fc142e604d7d091feb5eff54c72f241964 (patch)
tree8ca775b7063efa797f34e76afbae30ecb5cb3dc9
parent2de84d2572206157cf33d1fb75463eeb42ae8e42 (diff)
downloadsrc-275928fc142e604d7d091feb5eff54c72f241964.tar.gz
src-275928fc142e604d7d091feb5eff54c72f241964.zip
Vendor import of the full userland contrib part of DTrace support fromvendor/opensolaris/20080410a
OpenSolaris. This commit resets files to match the versions in the OpenSolaris tree as of 2008/04/10. The changes in this import from the previous import are the ones that will subsequently re-applied to take files off the vendor branch. This is unfortunately necessary because the Solaris developers won't allow FreeBSD support #ifdefs in their source code because that creates 'dead code' (stuff that they never compile).
Notes
Notes: svn path=/vendor-cddl/opensolaris/dist/cddl/contrib/opensolaris/; revision=178528 svn path=/vendor-cddl/opensolaris/20080410a/cddl/contrib/opensolaris/; revision=178530; tag=vendor/opensolaris/20080410a
-rw-r--r--cmd/dtrace/dtrace.c72
-rw-r--r--cmd/dtrace/test/cmd/scripts/dstyle.pl2
-rw-r--r--cmd/dtrace/test/cmd/scripts/dtest.pl8
-rw-r--r--cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d5
-rw-r--r--cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d5
-rw-r--r--cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d5
-rw-r--r--cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d5
-rw-r--r--cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh2
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.hton.d4
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d16
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d58
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d109
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d4
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d6
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d4
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.substr.d74
-rw-r--r--cmd/dtrace/test/tst/common/funcs/tst.substr.d.out92
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.create.ksh4
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.exec.ksh6
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh4
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.execfail.ksh4
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh25
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh2
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.sigwait.c9
-rw-r--r--cmd/dtrace/test/tst/common/proc/tst.sigwait.d6
-rw-r--r--cmd/dtrace/test/tst/common/raise/tst.raise1.d2
-rw-r--r--cmd/dtrace/test/tst/common/raise/tst.raise2.c1
-rw-r--r--cmd/dtrace/test/tst/common/raise/tst.raise2.d2
-rw-r--r--cmd/dtrace/test/tst/common/raise/tst.raise3.c1
-rw-r--r--cmd/dtrace/test/tst/common/raise/tst.raise3.d2
-rw-r--r--cmd/dtrace/test/tst/common/safety/tst.rw.d12
-rw-r--r--cmd/dtrace/test/tst/common/trace/tst.misc.d5
-rw-r--r--cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d5
-rw-r--r--cmd/mdb/tools/common/die.c14
-rw-r--r--cmd/mdb/tools/common/util.h2
-rw-r--r--cmd/sgs/include/alist.h4
-rw-r--r--cmd/sgs/include/debug.h11
-rw-r--r--cmd/sgs/include/sgs.h17
-rw-r--r--cmd/sgs/tools/common/findprime.c1
-rw-r--r--lib/libctf/common/ctf_lib.c35
-rw-r--r--lib/libctf/common/ctf_subr.c5
-rw-r--r--lib/libdtrace/common/drti.c37
-rw-r--r--lib/libdtrace/common/dt_aggregate.c25
-rw-r--r--lib/libdtrace/common/dt_cc.c102
-rw-r--r--lib/libdtrace/common/dt_cg.c54
-rw-r--r--lib/libdtrace/common/dt_consume.c382
-rw-r--r--lib/libdtrace/common/dt_dof.c4
-rw-r--r--lib/libdtrace/common/dt_error.c18
-rw-r--r--lib/libdtrace/common/dt_errtags.h6
-rw-r--r--lib/libdtrace/common/dt_handle.c4
-rw-r--r--lib/libdtrace/common/dt_ident.c6
-rw-r--r--lib/libdtrace/common/dt_impl.h32
-rw-r--r--lib/libdtrace/common/dt_lex.l26
-rw-r--r--lib/libdtrace/common/dt_link.c221
-rw-r--r--lib/libdtrace/common/dt_map.c18
-rw-r--r--lib/libdtrace/common/dt_module.c105
-rw-r--r--lib/libdtrace/common/dt_open.c273
-rw-r--r--lib/libdtrace/common/dt_options.c17
-rw-r--r--lib/libdtrace/common/dt_parser.c2
-rw-r--r--lib/libdtrace/common/dt_pid.c114
-rw-r--r--lib/libdtrace/common/dt_pragma.c50
-rw-r--r--lib/libdtrace/common/dt_printf.c93
-rw-r--r--lib/libdtrace/common/dt_proc.c123
-rw-r--r--lib/libdtrace/common/dt_proc.h2
-rw-r--r--lib/libdtrace/common/dt_program.c9
-rw-r--r--lib/libdtrace/common/dt_provider.c4
-rw-r--r--lib/libdtrace/common/dt_subr.c65
-rw-r--r--lib/libdtrace/common/dt_work.c23
-rw-r--r--lib/libdtrace/common/dtrace.h11
-rw-r--r--lib/libdtrace/common/mkerrtags.sh6
-rw-r--r--lib/libdtrace/common/mknames.sh6
-rw-r--r--lib/libgen/common/gmatch.c13
-rw-r--r--tools/ctf/common/list.c4
-rw-r--r--tools/ctf/common/memory.c1
-rw-r--r--tools/ctf/cvt/alist.c38
-rw-r--r--tools/ctf/cvt/alist.h1
-rw-r--r--tools/ctf/cvt/barrier.c14
-rw-r--r--tools/ctf/cvt/barrier.h5
-rw-r--r--tools/ctf/cvt/ctf.c109
-rw-r--r--tools/ctf/cvt/ctfconvert.c21
-rw-r--r--tools/ctf/cvt/ctfmerge.c16
-rw-r--r--tools/ctf/cvt/ctftools.h28
-rw-r--r--tools/ctf/cvt/dwarf.c242
-rw-r--r--tools/ctf/cvt/fixup_tdescs.c24
-rw-r--r--tools/ctf/cvt/hash.c26
-rw-r--r--tools/ctf/cvt/iidesc.c20
-rw-r--r--tools/ctf/cvt/input.c5
-rw-r--r--tools/ctf/cvt/merge.c81
-rw-r--r--tools/ctf/cvt/output.c61
-rw-r--r--tools/ctf/cvt/st_parse.c34
-rw-r--r--tools/ctf/cvt/stabs.c12
-rw-r--r--tools/ctf/cvt/strtab.c2
-rw-r--r--tools/ctf/cvt/strtab.h2
-rw-r--r--tools/ctf/cvt/tdata.c42
-rw-r--r--tools/ctf/cvt/traverse.c18
-rw-r--r--tools/ctf/cvt/traverse.h2
-rw-r--r--tools/ctf/cvt/util.c63
-rw-r--r--tools/ctf/dump/dump.c50
98 files changed, 705 insertions, 2717 deletions
diff --git a/cmd/dtrace/dtrace.c b/cmd/dtrace/dtrace.c
index f909e229b5f2..81a6953b63fa 100644
--- a/cmd/dtrace/dtrace.c
+++ b/cmd/dtrace/dtrace.c
@@ -34,20 +34,15 @@
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
-#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <limits.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <libgen.h>
-#if defined(sun)
#include <libproc.h>
-#endif
typedef struct dtrace_cmd {
void (*dc_func)(struct dtrace_cmd *); /* function to compile arg */
@@ -97,9 +92,8 @@ static int g_mode = DMODE_EXEC;
static int g_status = E_SUCCESS;
static int g_grabanon = 0;
static const char *g_ofile = NULL;
-static FILE *g_ofp;
+static FILE *g_ofp = stdout;
static dtrace_hdl_t *g_dtp;
-#if defined(sun)
static char *g_etcfile = "/etc/system";
static const char *g_etcbegin = "* vvvv Added by DTrace";
static const char *g_etcend = "* ^^^^ Added by DTrace";
@@ -114,7 +108,6 @@ static const char *g_etc[] = {
"* chapter of the Solaris Dynamic Tracing Guide for details.",
"*",
NULL };
-#endif
static int
usage(FILE *fp)
@@ -202,10 +195,6 @@ fatal(const char *fmt, ...)
static void
dfatal(const char *fmt, ...)
{
-#if !defined(sun) && defined(NEED_ERRLOC)
- char *p_errfile = NULL;
- int errline = 0;
-#endif
va_list ap;
va_start(ap, fmt);
@@ -223,11 +212,6 @@ dfatal(const char *fmt, ...)
(void) fprintf(stderr, "%s\n",
dtrace_errmsg(g_dtp, dtrace_errno(g_dtp)));
}
-#if !defined(sun) && defined(NEED_ERRLOC)
- dt_get_errloc(g_dtp, &p_errfile, &errline);
- if (p_errfile != NULL)
- printf("File '%s', line %d\n", p_errfile, errline);
-#endif
/*
* Close the DTrace handle to ensure that any controlled processes are
@@ -388,7 +372,6 @@ dof_prune(const char *fname)
free(buf);
}
-#if defined(sun)
static void
etcsystem_prune(void)
{
@@ -499,7 +482,6 @@ etcsystem_add(void)
error("added forceload directives to %s\n", g_ofile);
}
-#endif
static void
print_probe_info(const dtrace_probeinfo_t *p)
@@ -629,26 +611,12 @@ anon_prog(const dtrace_cmd_t *dcp, dof_hdr_t *dof, int n)
p = (uchar_t *)dof;
q = p + dof->dofh_loadsz;
-#if defined(sun)
oprintf("dof-data-%d=0x%x", n, *p++);
while (p < q)
oprintf(",0x%x", *p++);
oprintf(";\n");
-#else
- /*
- * On FreeBSD, the DOF data is handled as a kernel environment (kenv)
- * string. We use two hex characters per DOF byte.
- */
- oprintf("dof-data-%d=%02x", n, *p++);
-
- while (p < q)
- oprintf("%02x", *p++);
-
- oprintf("\n");
-#endif
-
dtrace_dof_destroy(g_dtp, dof);
}
@@ -773,8 +741,6 @@ compile_str(dtrace_cmd_t *dcp)
static void
prochandler(struct ps_prochandle *P, const char *msg, void *arg)
{
-fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
const psinfo_t *prp = Ppsinfo(P);
int pid = Pstatus(P)->pr_pid;
char name[SIG2STR_MAX];
@@ -812,7 +778,6 @@ fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__
g_pslive--;
break;
}
-#endif
}
/*ARGSUSED*/
@@ -1194,10 +1159,9 @@ main(int argc, char *argv[])
dtrace_optval_t opt;
dtrace_cmd_t *dcp;
- g_ofp = stdout;
int done = 0, mode = 0;
- int err, i, c;
- char *p, **v;
+ int err, i;
+ char c, *p, **v;
struct ps_prochandle *P;
pid_t pid;
@@ -1224,7 +1188,7 @@ main(int argc, char *argv[])
* options into g_argv[], and abort if any invalid options are found.
*/
for (optind = 1; optind < argc; optind++) {
- while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) {
+ while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
switch (c) {
case '3':
if (strcmp(optarg, "2") != 0) {
@@ -1373,14 +1337,8 @@ main(int argc, char *argv[])
dtrace_errmsg(NULL, err));
}
-#if defined(__i386__)
- /* XXX The 32-bit seems to need more buffer space by default -sson */
- (void) dtrace_setopt(g_dtp, "bufsize", "12m");
- (void) dtrace_setopt(g_dtp, "aggsize", "12m");
-#else
(void) dtrace_setopt(g_dtp, "bufsize", "4m");
(void) dtrace_setopt(g_dtp, "aggsize", "4m");
-#endif
/*
* If -G is specified, enable -xlink=dynamic and -xunodefs to permit
@@ -1413,7 +1371,7 @@ main(int argc, char *argv[])
* this time; these will compiled as part of the fourth processing pass.
*/
for (optind = 1; optind < argc; optind++) {
- while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) {
+ while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
switch (c) {
case 'a':
if (dtrace_setopt(g_dtp, "grabanon", 0) != 0)
@@ -1570,7 +1528,7 @@ main(int argc, char *argv[])
* may been affected by any library options set by the second pass.
*/
for (optind = 1; optind < argc; optind++) {
- while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) {
+ while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
switch (c) {
case 'c':
if ((v = make_argv(optarg)) == NULL)
@@ -1658,21 +1616,10 @@ main(int argc, char *argv[])
case DMODE_ANON:
if (g_ofile == NULL)
-#if defined(sun)
g_ofile = "/kernel/drv/dtrace.conf";
-#else
- /*
- * On FreeBSD, anonymous DOF data is written to
- * the DTrace DOF file that the boot loader will
- * read if booting with the DTrace option.
- */
- g_ofile = "/boot/dtrace.dof";
-#endif
dof_prune(g_ofile); /* strip out any old DOF directives */
-#if defined(sun)
etcsystem_prune(); /* string out any forceload directives */
-#endif
if (g_cmdc == 0) {
dtrace_close(g_dtp);
@@ -1703,10 +1650,8 @@ main(int argc, char *argv[])
* that itself contains a #pragma D option quiet.
*/
error("saved anonymous enabling in %s\n", g_ofile);
-#if defined(sun)
etcsystem_add();
error("run update_drv(1M) or reboot to enable changes\n");
-#endif
dtrace_close(g_dtp);
return (g_status);
@@ -1835,11 +1780,6 @@ main(int argc, char *argv[])
if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
(void) sigaction(SIGTERM, &act, NULL);
-#if !defined(sun)
- if (sigaction(SIGUSR1, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
- (void) sigaction(SIGUSR1, &act, NULL);
-#endif
-
/*
* Now that tracing is active and we are ready to consume trace data,
* continue any grabbed or created processes, setting them running
diff --git a/cmd/dtrace/test/cmd/scripts/dstyle.pl b/cmd/dtrace/test/cmd/scripts/dstyle.pl
index cb47c7cbfd1c..1cbc34a74593 100644
--- a/cmd/dtrace/test/cmd/scripts/dstyle.pl
+++ b/cmd/dtrace/test/cmd/scripts/dstyle.pl
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl
+#!/usr/perl5/bin/perl
#
# CDDL HEADER START
#
diff --git a/cmd/dtrace/test/cmd/scripts/dtest.pl b/cmd/dtrace/test/cmd/scripts/dtest.pl
index e8d9032fcd6c..96244107532d 100644
--- a/cmd/dtrace/test/cmd/scripts/dtest.pl
+++ b/cmd/dtrace/test/cmd/scripts/dtest.pl
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl
+#!/usr/perl5/bin/perl
#
# CDDL HEADER START
#
@@ -43,7 +43,7 @@ $USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] "
@dtrace_argv = ();
-$ksh_path = '/bin/sh';
+$ksh_path = '/usr/bin/ksh';
@files = ();
%exceptions = ();
@@ -273,7 +273,7 @@ sub run_tests {
}
$fullname = "$dir/$name";
- $exe = "./$base.exe";
+ $exe = "$dir/$base.exe";
$exe_pid = -1;
if ($opt_a && ($status != 0 || $tag != 0 || $droptag != 0 ||
@@ -592,7 +592,7 @@ if ($opt_g) {
# Ensure that $PATH contains a cc(1) so that we can execute the
# test programs that require compilation of C code.
#
-#$ENV{'PATH'} = $ENV{'PATH'} . ':/ws/onnv-tools/SUNWspro/SS11/bin';
+$ENV{'PATH'} = $ENV{'PATH'} . ':/ws/onnv-tools/SUNWspro/SS11/bin';
if ($opt_b) {
logmsg("badioctl'ing ... ");
diff --git a/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d b/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d
index 267d121274c7..6c4d0251596b 100644
--- a/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d
+++ b/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d
@@ -40,8 +40,3 @@ BEGIN
x[123] = `kmem_flags;
x[456] = *`rootvp;
}
-
-ERROR
-{
- exit(1);
-}
diff --git a/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d b/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d
index ce360cd25d9a..e1f17cbbad54 100644
--- a/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d
+++ b/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d
@@ -40,8 +40,3 @@ BEGIN
self->x[123] = `kmem_flags;
self->x[456] = *`rootvp;
}
-
-ERROR
-{
- exit(1);
-}
diff --git a/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d b/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d
index 6961a0d58055..c90f6e93e9b6 100644
--- a/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d
+++ b/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d
@@ -53,8 +53,3 @@ tick-10ms
printf("address of process = %u\n", curpsinfo->pr_addr);
exit (0);
}
-
-ERROR
-{
- exit(1);
-}
diff --git a/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d b/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d
index b805e2754502..098f38b6844e 100644
--- a/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d
+++ b/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d
@@ -49,8 +49,3 @@ BEGIN
printf("address of process = %u\n", curpsinfo->pr_addr);
exit (0);
}
-
-ERROR
-{
- exit(1);
-}
diff --git a/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh b/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh
index c34a4aabddfc..9d48f99bcfff 100644
--- a/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh
+++ b/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh
@@ -46,7 +46,7 @@ fi
dtrace=$1
$dtrace -qZm wassup'{printf("Iamkool");}' \
--qm BEGIN'{printf("I am done"); exit(0);}'
+-qm unix'{printf("I am done"); exit(0);}'
status=$?
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.hton.d b/cmd/dtrace/test/tst/common/funcs/tst.hton.d
index 4908251a68e0..f01188386cda 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.hton.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.hton.d
@@ -30,9 +30,7 @@
* ASSERTION: Test network byte-ordering routines.
*/
-#if defined(__amd64__) || defined(__i386__)
-#define _LITTLE_ENDIAN
-#endif
+#include <sys/isa_defs.h>
BEGIN
{
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d b/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d
index fbc56203d5e6..cf7459d35b8d 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d
@@ -28,17 +28,17 @@
#pragma D option quiet
-in_addr_t *ip4a;
-in_addr_t *ip4b;
-in_addr_t *ip4c;
-in_addr_t *ip4d;
+ipaddr_t *ip4a;
+ipaddr_t *ip4b;
+ipaddr_t *ip4c;
+ipaddr_t *ip4d;
BEGIN
{
- this->buf4a = alloca(sizeof (in_addr_t));
- this->buf4b = alloca(sizeof (in_addr_t));
- this->buf4c = alloca(sizeof (in_addr_t));
- this->buf4d = alloca(sizeof (in_addr_t));
+ this->buf4a = alloca(sizeof (ipaddr_t));
+ this->buf4b = alloca(sizeof (ipaddr_t));
+ this->buf4c = alloca(sizeof (ipaddr_t));
+ this->buf4d = alloca(sizeof (ipaddr_t));
ip4a = this->buf4a;
ip4b = this->buf4b;
ip4c = this->buf4c;
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d b/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d
index 40b3849da278..9a00eb782afa 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d
@@ -53,35 +53,35 @@ BEGIN
ip6f = this->buf6f;
ip6g = this->buf6g;
- ip6a->__u6_addr.__u6_addr8[0] = 0xfe;
- ip6a->__u6_addr.__u6_addr8[1] = 0x80;
- ip6a->__u6_addr.__u6_addr8[8] = 0x02;
- ip6a->__u6_addr.__u6_addr8[9] = 0x14;
- ip6a->__u6_addr.__u6_addr8[10] = 0x4f;
- ip6a->__u6_addr.__u6_addr8[11] = 0xff;
- ip6a->__u6_addr.__u6_addr8[12] = 0xfe;
- ip6a->__u6_addr.__u6_addr8[13] = 0x0b;
- ip6a->__u6_addr.__u6_addr8[14] = 0x76;
- ip6a->__u6_addr.__u6_addr8[15] = 0xc8;
- ip6b->__u6_addr.__u6_addr8[0] = 0x10;
- ip6b->__u6_addr.__u6_addr8[1] = 0x80;
- ip6b->__u6_addr.__u6_addr8[10] = 0x08;
- ip6b->__u6_addr.__u6_addr8[11] = 0x08;
- ip6b->__u6_addr.__u6_addr8[13] = 0x20;
- ip6b->__u6_addr.__u6_addr8[13] = 0x0c;
- ip6b->__u6_addr.__u6_addr8[14] = 0x41;
- ip6b->__u6_addr.__u6_addr8[15] = 0x7a;
- ip6c->__u6_addr.__u6_addr8[15] = 0x01;
- ip6e->__u6_addr.__u6_addr8[12] = 0x7f;
- ip6e->__u6_addr.__u6_addr8[15] = 0x01;
- ip6f->__u6_addr.__u6_addr8[10] = 0xff;
- ip6f->__u6_addr.__u6_addr8[11] = 0xff;
- ip6f->__u6_addr.__u6_addr8[12] = 0x7f;
- ip6f->__u6_addr.__u6_addr8[15] = 0x01;
- ip6g->__u6_addr.__u6_addr8[10] = 0xff;
- ip6g->__u6_addr.__u6_addr8[11] = 0xfe;
- ip6g->__u6_addr.__u6_addr8[12] = 0x7f;
- ip6g->__u6_addr.__u6_addr8[15] = 0x01;
+ ip6a->_S6_un._S6_u8[0] = 0xfe;
+ ip6a->_S6_un._S6_u8[1] = 0x80;
+ ip6a->_S6_un._S6_u8[8] = 0x02;
+ ip6a->_S6_un._S6_u8[9] = 0x14;
+ ip6a->_S6_un._S6_u8[10] = 0x4f;
+ ip6a->_S6_un._S6_u8[11] = 0xff;
+ ip6a->_S6_un._S6_u8[12] = 0xfe;
+ ip6a->_S6_un._S6_u8[13] = 0x0b;
+ ip6a->_S6_un._S6_u8[14] = 0x76;
+ ip6a->_S6_un._S6_u8[15] = 0xc8;
+ ip6b->_S6_un._S6_u8[0] = 0x10;
+ ip6b->_S6_un._S6_u8[1] = 0x80;
+ ip6b->_S6_un._S6_u8[10] = 0x08;
+ ip6b->_S6_un._S6_u8[11] = 0x08;
+ ip6b->_S6_un._S6_u8[13] = 0x20;
+ ip6b->_S6_un._S6_u8[13] = 0x0c;
+ ip6b->_S6_un._S6_u8[14] = 0x41;
+ ip6b->_S6_un._S6_u8[15] = 0x7a;
+ ip6c->_S6_un._S6_u8[15] = 0x01;
+ ip6e->_S6_un._S6_u8[12] = 0x7f;
+ ip6e->_S6_un._S6_u8[15] = 0x01;
+ ip6f->_S6_un._S6_u8[10] = 0xff;
+ ip6f->_S6_un._S6_u8[11] = 0xff;
+ ip6f->_S6_un._S6_u8[12] = 0x7f;
+ ip6f->_S6_un._S6_u8[15] = 0x01;
+ ip6g->_S6_un._S6_u8[10] = 0xff;
+ ip6g->_S6_un._S6_u8[11] = 0xfe;
+ ip6g->_S6_un._S6_u8[12] = 0x7f;
+ ip6g->_S6_un._S6_u8[15] = 0x01;
printf("%s\n", inet_ntoa6(ip6a));
printf("%s\n", inet_ntoa6(ip6b));
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d b/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d
index 21452d6e96e7..c1e4b1bb0cbc 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d
@@ -28,13 +28,10 @@
#pragma D option quiet
-inline int AF_INET = 2;
-inline int AF_INET6 = 28;
-
-in_addr_t *ip4a;
-in_addr_t *ip4b;
-in_addr_t *ip4c;
-in_addr_t *ip4d;
+ipaddr_t *ip4a;
+ipaddr_t *ip4b;
+ipaddr_t *ip4c;
+ipaddr_t *ip4d;
struct in6_addr *ip6a;
struct in6_addr *ip6b;
struct in6_addr *ip6c;
@@ -46,10 +43,10 @@ struct in6_addr *ip6h;
BEGIN
{
- this->buf4a = alloca(sizeof (in_addr_t));
- this->buf4b = alloca(sizeof (in_addr_t));
- this->buf4c = alloca(sizeof (in_addr_t));
- this->buf4d = alloca(sizeof (in_addr_t));
+ this->buf4a = alloca(sizeof (ipaddr_t));
+ this->buf4b = alloca(sizeof (ipaddr_t));
+ this->buf4c = alloca(sizeof (ipaddr_t));
+ this->buf4d = alloca(sizeof (ipaddr_t));
this->buf6a = alloca(sizeof (struct in6_addr));
this->buf6b = alloca(sizeof (struct in6_addr));
this->buf6c = alloca(sizeof (struct in6_addr));
@@ -75,51 +72,51 @@ BEGIN
*ip4b = htonl(0x7f000001);
*ip4c = htonl(0xffffffff);
*ip4d = htonl(0x00000000);
- ip6a->__u6_addr.__u6_addr8[0] = 0xfe;
- ip6a->__u6_addr.__u6_addr8[1] = 0x80;
- ip6a->__u6_addr.__u6_addr8[8] = 0x02;
- ip6a->__u6_addr.__u6_addr8[9] = 0x14;
- ip6a->__u6_addr.__u6_addr8[10] = 0x4f;
- ip6a->__u6_addr.__u6_addr8[11] = 0xff;
- ip6a->__u6_addr.__u6_addr8[12] = 0xfe;
- ip6a->__u6_addr.__u6_addr8[13] = 0x0b;
- ip6a->__u6_addr.__u6_addr8[14] = 0x76;
- ip6a->__u6_addr.__u6_addr8[15] = 0xc8;
- ip6b->__u6_addr.__u6_addr8[0] = 0x10;
- ip6b->__u6_addr.__u6_addr8[1] = 0x80;
- ip6b->__u6_addr.__u6_addr8[10] = 0x08;
- ip6b->__u6_addr.__u6_addr8[11] = 0x08;
- ip6b->__u6_addr.__u6_addr8[13] = 0x20;
- ip6b->__u6_addr.__u6_addr8[13] = 0x0c;
- ip6b->__u6_addr.__u6_addr8[14] = 0x41;
- ip6b->__u6_addr.__u6_addr8[15] = 0x7a;
- ip6c->__u6_addr.__u6_addr8[15] = 0x01;
- ip6e->__u6_addr.__u6_addr8[12] = 0x7f;
- ip6e->__u6_addr.__u6_addr8[15] = 0x01;
- ip6f->__u6_addr.__u6_addr8[10] = 0xff;
- ip6f->__u6_addr.__u6_addr8[11] = 0xff;
- ip6f->__u6_addr.__u6_addr8[12] = 0x7f;
- ip6f->__u6_addr.__u6_addr8[15] = 0x01;
- ip6g->__u6_addr.__u6_addr8[10] = 0xff;
- ip6g->__u6_addr.__u6_addr8[11] = 0xfe;
- ip6g->__u6_addr.__u6_addr8[12] = 0x7f;
- ip6g->__u6_addr.__u6_addr8[15] = 0x01;
- ip6h->__u6_addr.__u6_addr8[0] = 0xff;
- ip6h->__u6_addr.__u6_addr8[1] = 0xff;
- ip6h->__u6_addr.__u6_addr8[2] = 0xff;
- ip6h->__u6_addr.__u6_addr8[3] = 0xff;
- ip6h->__u6_addr.__u6_addr8[4] = 0xff;
- ip6h->__u6_addr.__u6_addr8[5] = 0xff;
- ip6h->__u6_addr.__u6_addr8[6] = 0xff;
- ip6h->__u6_addr.__u6_addr8[7] = 0xff;
- ip6h->__u6_addr.__u6_addr8[8] = 0xff;
- ip6h->__u6_addr.__u6_addr8[9] = 0xff;
- ip6h->__u6_addr.__u6_addr8[10] = 0xff;
- ip6h->__u6_addr.__u6_addr8[11] = 0xff;
- ip6h->__u6_addr.__u6_addr8[12] = 0xff;
- ip6h->__u6_addr.__u6_addr8[13] = 0xff;
- ip6h->__u6_addr.__u6_addr8[14] = 0xff;
- ip6h->__u6_addr.__u6_addr8[15] = 0xff;
+ ip6a->_S6_un._S6_u8[0] = 0xfe;
+ ip6a->_S6_un._S6_u8[1] = 0x80;
+ ip6a->_S6_un._S6_u8[8] = 0x02;
+ ip6a->_S6_un._S6_u8[9] = 0x14;
+ ip6a->_S6_un._S6_u8[10] = 0x4f;
+ ip6a->_S6_un._S6_u8[11] = 0xff;
+ ip6a->_S6_un._S6_u8[12] = 0xfe;
+ ip6a->_S6_un._S6_u8[13] = 0x0b;
+ ip6a->_S6_un._S6_u8[14] = 0x76;
+ ip6a->_S6_un._S6_u8[15] = 0xc8;
+ ip6b->_S6_un._S6_u8[0] = 0x10;
+ ip6b->_S6_un._S6_u8[1] = 0x80;
+ ip6b->_S6_un._S6_u8[10] = 0x08;
+ ip6b->_S6_un._S6_u8[11] = 0x08;
+ ip6b->_S6_un._S6_u8[13] = 0x20;
+ ip6b->_S6_un._S6_u8[13] = 0x0c;
+ ip6b->_S6_un._S6_u8[14] = 0x41;
+ ip6b->_S6_un._S6_u8[15] = 0x7a;
+ ip6c->_S6_un._S6_u8[15] = 0x01;
+ ip6e->_S6_un._S6_u8[12] = 0x7f;
+ ip6e->_S6_un._S6_u8[15] = 0x01;
+ ip6f->_S6_un._S6_u8[10] = 0xff;
+ ip6f->_S6_un._S6_u8[11] = 0xff;
+ ip6f->_S6_un._S6_u8[12] = 0x7f;
+ ip6f->_S6_un._S6_u8[15] = 0x01;
+ ip6g->_S6_un._S6_u8[10] = 0xff;
+ ip6g->_S6_un._S6_u8[11] = 0xfe;
+ ip6g->_S6_un._S6_u8[12] = 0x7f;
+ ip6g->_S6_un._S6_u8[15] = 0x01;
+ ip6h->_S6_un._S6_u8[0] = 0xff;
+ ip6h->_S6_un._S6_u8[1] = 0xff;
+ ip6h->_S6_un._S6_u8[2] = 0xff;
+ ip6h->_S6_un._S6_u8[3] = 0xff;
+ ip6h->_S6_un._S6_u8[4] = 0xff;
+ ip6h->_S6_un._S6_u8[5] = 0xff;
+ ip6h->_S6_un._S6_u8[6] = 0xff;
+ ip6h->_S6_un._S6_u8[7] = 0xff;
+ ip6h->_S6_un._S6_u8[8] = 0xff;
+ ip6h->_S6_un._S6_u8[9] = 0xff;
+ ip6h->_S6_un._S6_u8[10] = 0xff;
+ ip6h->_S6_un._S6_u8[11] = 0xff;
+ ip6h->_S6_un._S6_u8[12] = 0xff;
+ ip6h->_S6_un._S6_u8[13] = 0xff;
+ ip6h->_S6_un._S6_u8[14] = 0xff;
+ ip6h->_S6_un._S6_u8[15] = 0xff;
printf("%s\n", inet_ntop(AF_INET, ip4a));
printf("%s\n", inet_ntop(AF_INET, ip4b));
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d b/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d
index 0f97aa1a951e..b4aa84f95535 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d
@@ -38,8 +38,8 @@
lockstat:::adaptive-acquire
{
- this->owned = mutex_owned((struct mtx *)arg0);
- this->owner = mutex_owner((struct mtx *)arg0);
+ this->owned = mutex_owned((kmutex_t *)arg0);
+ this->owner = mutex_owner((kmutex_t *)arg0);
}
lockstat:::adaptive-acquire
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d b/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d
index dbb10c3fd598..a021d502bbfe 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d
@@ -41,17 +41,17 @@
#pragma D option quiet
-struct thread *ptr;
+kthread_t *ptr;
BEGIN
{
i = 0;
}
-lockstat::mtx_lock:adaptive-acquire
+lockstat:genunix:mutex_enter:adaptive-acquire
{
- ptr = mutex_owner((struct mtx *)arg0);
+ ptr = mutex_owner((kmutex_t *)arg0);
i++;
}
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d b/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d
index ac43e790b7b3..c13abab20be9 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d
@@ -44,9 +44,9 @@ BEGIN
ret = -99;
}
-mtx_lock:adaptive-acquire
+mutex_enter:adaptive-acquire
{
- ret = mutex_type_adaptive((struct mtx *)arg0);
+ ret = mutex_type_adaptive((kmutex_t *)arg0);
i++;
}
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.substr.d b/cmd/dtrace/test/tst/common/funcs/tst.substr.d
index edee6442e350..6001d6b03bc7 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.substr.d
+++ b/cmd/dtrace/test/tst/common/funcs/tst.substr.d
@@ -20,20 +20,18 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#pragma D option quiet
-#pragma D option strsize=32
struct {
int index;
int length;
int nolen;
- int alt;
} command[int];
int i;
@@ -41,9 +39,6 @@ int i;
BEGIN
{
str = "foobarbazbop";
- str2 = "";
- altstr = "CRAIG: Positioned them, I don't ";
- altstr2 = "know... I'm fairly wide guy.";
command[i].index = 3;
command[i].nolen = 1;
@@ -113,18 +108,6 @@ BEGIN
command[i].length = -1;
i++;
- command[i].index = 3;
- command[i].length = -4;
- i++;
-
- command[i].index = 3;
- command[i].length = -20;
- i++;
-
- command[i].index = -10;
- command[i].length = -5;
- i++;
-
command[i].index = 0;
command[i].length = 400;
i++;
@@ -161,16 +144,6 @@ BEGIN
command[i].length = strlen(str) - 1;
i++;
- command[i].index = 100;
- command[i].length = 10;
- command[i].alt = 1;
- i++;
-
- command[i].index = 100;
- command[i].nolen = 1;
- command[i].alt = 1;
- i++;
-
end = i;
i = 0;
printf("#!/usr/perl5/bin/perl\n\nBEGIN {\n");
@@ -180,21 +153,17 @@ BEGIN
tick-1ms
/i < end && command[i].nolen/
{
- this->str = command[i].alt ? altstr : str;
- this->str2 = command[i].alt ? altstr2 : str2;
- this->result = substr(command[i].alt ?
- "CRAIG: Positioned them, I don't know... I'm fairly wide guy." :
- str, command[i].index);
+ this->result = substr(str, command[i].index);
- printf("\tif (substr(\"%s%s\", %d) ne \"%s\") {\n",
- this->str, this->str2, command[i].index, this->result);
+ printf("\tif (substr(\"%s\", %d) != \"%s\") {\n",
+ str, command[i].index, this->result);
- printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d) = ",
- this->str, this->str2, command[i].index);
- printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s%s\", %d));\n",
- this->str, this->str2, command[i].index);
- printf("\t\tprintf(\" D => substr(\\\"%s%s\\\", %d) = ",
- this->str, this->str2, command[i].index);
+ printf("\t\tprintf(\"perl => substr(\\\"%s\\\", %d) = ",
+ str, command[i].index);
+ printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s\", %d));\n",
+ str, command[i].index);
+ printf("\t\tprintf(\" D => substr(\\\"%s\\\", %d) = ",
+ str, command[i].index);
printf("\\\"%%s\\\"\\n\",\n\t\t \"%s\");\n", this->result);
printf("\t\t$failed++;\n");
printf("\t}\n\n");
@@ -203,21 +172,16 @@ tick-1ms
tick-1ms
/i < end && !command[i].nolen/
{
- this->str = command[i].alt ? altstr : str;
- this->str2 = command[i].alt ? altstr2 : str2;
- this->result = substr(command[i].alt ?
- "CRAIG: Positioned them, I don't know... I'm fairly wide guy." :
- str, command[i].index, command[i].length);
+ this->result = substr(str, command[i].index, command[i].length);
- printf("\tif (substr(\"%s%s\", %d, %d) ne \"%s\") {\n",
- this->str, this->str2, command[i].index, command[i].length,
- this->result);
- printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d, %d) = ",
- this->str, this->str2, command[i].index, command[i].length);
- printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s%s\", %d, %d));\n",
- this->str, this->str2, command[i].index, command[i].length);
- printf("\t\tprintf(\" D => substr(\\\"%s%s\\\", %d, %d) = ",
- this->str, this->str2, command[i].index, command[i].length);
+ printf("\tif (substr(\"%s\", %d, %d) != \"%s\") {\n",
+ str, command[i].index, command[i].length, this->result);
+ printf("\t\tprintf(\"perl => substr(\\\"%s\\\", %d, %d) = ",
+ str, command[i].index, command[i].length);
+ printf("\\\"%%s\\\"\\n\",\n\t\t substr(\"%s\", %d, %d));\n",
+ str, command[i].index, command[i].length);
+ printf("\t\tprintf(\" D => substr(\\\"%s\\\", %d, %d) = ",
+ str, command[i].index, command[i].length);
printf("\\\"%%s\\\"\\n\",\n\t\t \"%s\");\n", this->result);
printf("\t\t$failed++;\n");
printf("\t}\n\n");
diff --git a/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out b/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out
index 5b498ef36be9..d4087a2ac2c7 100644
--- a/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out
+++ b/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out
@@ -1,7 +1,7 @@
#!/usr/perl5/bin/perl
BEGIN {
- if (substr("foobarbazbop", 3) ne "barbazbop") {
+ if (substr("foobarbazbop", 3) != "barbazbop") {
printf("perl => substr(\"foobarbazbop\", 3) = \"%s\"\n",
substr("foobarbazbop", 3));
printf(" D => substr(\"foobarbazbop\", 3) = \"%s\"\n",
@@ -9,7 +9,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 300) ne "") {
+ if (substr("foobarbazbop", 300) != "") {
printf("perl => substr(\"foobarbazbop\", 300) = \"%s\"\n",
substr("foobarbazbop", 300));
printf(" D => substr(\"foobarbazbop\", 300) = \"%s\"\n",
@@ -17,7 +17,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -10) ne "obarbazbop") {
+ if (substr("foobarbazbop", -10) != "obarbazbop") {
printf("perl => substr(\"foobarbazbop\", -10) = \"%s\"\n",
substr("foobarbazbop", -10));
printf(" D => substr(\"foobarbazbop\", -10) = \"%s\"\n",
@@ -25,7 +25,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 0) ne "foobarbazbop") {
+ if (substr("foobarbazbop", 0) != "foobarbazbop") {
printf("perl => substr(\"foobarbazbop\", 0) = \"%s\"\n",
substr("foobarbazbop", 0));
printf(" D => substr(\"foobarbazbop\", 0) = \"%s\"\n",
@@ -33,7 +33,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 1) ne "oobarbazbop") {
+ if (substr("foobarbazbop", 1) != "oobarbazbop") {
printf("perl => substr(\"foobarbazbop\", 1) = \"%s\"\n",
substr("foobarbazbop", 1));
printf(" D => substr(\"foobarbazbop\", 1) = \"%s\"\n",
@@ -41,7 +41,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 11) ne "p") {
+ if (substr("foobarbazbop", 11) != "p") {
printf("perl => substr(\"foobarbazbop\", 11) = \"%s\"\n",
substr("foobarbazbop", 11));
printf(" D => substr(\"foobarbazbop\", 11) = \"%s\"\n",
@@ -49,7 +49,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 12) ne "") {
+ if (substr("foobarbazbop", 12) != "") {
printf("perl => substr(\"foobarbazbop\", 12) = \"%s\"\n",
substr("foobarbazbop", 12));
printf(" D => substr(\"foobarbazbop\", 12) = \"%s\"\n",
@@ -57,7 +57,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 13) ne "") {
+ if (substr("foobarbazbop", 13) != "") {
printf("perl => substr(\"foobarbazbop\", 13) = \"%s\"\n",
substr("foobarbazbop", 13));
printf(" D => substr(\"foobarbazbop\", 13) = \"%s\"\n",
@@ -65,7 +65,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 8, 20) ne "zbop") {
+ if (substr("foobarbazbop", 8, 20) != "zbop") {
printf("perl => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n",
substr("foobarbazbop", 8, 20));
printf(" D => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n",
@@ -73,7 +73,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 4, 4) ne "arba") {
+ if (substr("foobarbazbop", 4, 4) != "arba") {
printf("perl => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n",
substr("foobarbazbop", 4, 4));
printf(" D => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n",
@@ -81,7 +81,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 5, 8) ne "rbazbop") {
+ if (substr("foobarbazbop", 5, 8) != "rbazbop") {
printf("perl => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n",
substr("foobarbazbop", 5, 8));
printf(" D => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n",
@@ -89,7 +89,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 5, 9) ne "rbazbop") {
+ if (substr("foobarbazbop", 5, 9) != "rbazbop") {
printf("perl => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n",
substr("foobarbazbop", 5, 9));
printf(" D => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n",
@@ -97,7 +97,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 400, 20) ne "") {
+ if (substr("foobarbazbop", 400, 20) != "") {
printf("perl => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n",
substr("foobarbazbop", 400, 20));
printf(" D => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n",
@@ -105,7 +105,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 400, 0) ne "") {
+ if (substr("foobarbazbop", 400, 0) != "") {
printf("perl => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n",
substr("foobarbazbop", 400, 0));
printf(" D => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n",
@@ -113,7 +113,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 400, -1) ne "") {
+ if (substr("foobarbazbop", 400, -1) != "") {
printf("perl => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n",
substr("foobarbazbop", 400, -1));
printf(" D => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n",
@@ -121,7 +121,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 3, 0) ne "") {
+ if (substr("foobarbazbop", 3, 0) != "") {
printf("perl => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n",
substr("foobarbazbop", 3, 0));
printf(" D => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n",
@@ -129,39 +129,15 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", 3, -1) ne "barbazbo") {
+ if (substr("foobarbazbop", 3, -1) != "") {
printf("perl => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
substr("foobarbazbop", 3, -1));
printf(" D => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
- "barbazbo");
- $failed++;
- }
-
- if (substr("foobarbazbop", 3, -4) ne "barba") {
- printf("perl => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n",
- substr("foobarbazbop", 3, -4));
- printf(" D => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n",
- "barba");
- $failed++;
- }
-
- if (substr("foobarbazbop", 3, -20) ne "") {
- printf("perl => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n",
- substr("foobarbazbop", 3, -20));
- printf(" D => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n",
"");
$failed++;
}
- if (substr("foobarbazbop", -10, -5) ne "obarb") {
- printf("perl => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n",
- substr("foobarbazbop", -10, -5));
- printf(" D => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n",
- "obarb");
- $failed++;
- }
-
- if (substr("foobarbazbop", 0, 400) ne "foobarbazbop") {
+ if (substr("foobarbazbop", 0, 400) != "foobarbazbop") {
printf("perl => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
substr("foobarbazbop", 0, 400));
printf(" D => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
@@ -169,7 +145,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -1, 400) ne "p") {
+ if (substr("foobarbazbop", -1, 400) != "p") {
printf("perl => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
substr("foobarbazbop", -1, 400));
printf(" D => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
@@ -177,7 +153,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -1, 0) ne "") {
+ if (substr("foobarbazbop", -1, 0) != "") {
printf("perl => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
substr("foobarbazbop", -1, 0));
printf(" D => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
@@ -185,7 +161,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -1, -1) ne "") {
+ if (substr("foobarbazbop", -1, -1) != "") {
printf("perl => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
substr("foobarbazbop", -1, -1));
printf(" D => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
@@ -193,7 +169,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -24, 24) ne "foobarbazbop") {
+ if (substr("foobarbazbop", -24, 24) != "foobarbazbop") {
printf("perl => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
substr("foobarbazbop", -24, 24));
printf(" D => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
@@ -201,7 +177,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -24, 12) ne "") {
+ if (substr("foobarbazbop", -24, 12) != "") {
printf("perl => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
substr("foobarbazbop", -24, 12));
printf(" D => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
@@ -209,7 +185,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -24, 13) ne "f") {
+ if (substr("foobarbazbop", -24, 13) != "f") {
printf("perl => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
substr("foobarbazbop", -24, 13));
printf(" D => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
@@ -217,7 +193,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -12, 12) ne "foobarbazbop") {
+ if (substr("foobarbazbop", -12, 12) != "foobarbazbop") {
printf("perl => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
substr("foobarbazbop", -12, 12));
printf(" D => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
@@ -225,7 +201,7 @@ BEGIN {
$failed++;
}
- if (substr("foobarbazbop", -12, 11) ne "foobarbazbo") {
+ if (substr("foobarbazbop", -12, 11) != "foobarbazbo") {
printf("perl => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
substr("foobarbazbop", -12, 11));
printf(" D => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
@@ -233,22 +209,6 @@ BEGIN {
$failed++;
}
- if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10) ne "") {
- printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n",
- substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10));
- printf(" D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n",
- "");
- $failed++;
- }
-
- if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100) ne "") {
- printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n",
- substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100));
- printf(" D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n",
- "");
- $failed++;
- }
-
exit($failed);
}
diff --git a/cmd/dtrace/test/tst/common/proc/tst.create.ksh b/cmd/dtrace/test/tst/common/proc/tst.create.ksh
index 6b21eb86c9a5..5b484cf0849d 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.create.ksh
+++ b/cmd/dtrace/test/tst/common/proc/tst.create.ksh
@@ -36,7 +36,7 @@ script()
{
$dtrace -s /dev/stdin <<EOF
proc:::create
- /args[0]->p_pptr->p_pid == $child && pid == $child/
+ /args[0]->pr_ppid == $child && pid == $child/
{
exit(0);
}
@@ -46,7 +46,7 @@ EOF
sleeper()
{
while true; do
- /bin/sleep 1
+ /usr/bin/sleep 1
done
}
diff --git a/cmd/dtrace/test/tst/common/proc/tst.exec.ksh b/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
index 92330fb01c3e..0318ae6daf69 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
+++ b/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
@@ -36,12 +36,12 @@ script()
{
$dtrace -s /dev/stdin <<EOF
proc:::exec
- /curpsinfo->pr_ppid == $child && args[0] == "/bin/sleep"/
+ /curpsinfo->pr_ppid == $child && args[0] == "/usr/bin/sleep"/
{
self->exec = 1;
}
- proc:::exec_success
+ proc:::exec-success
/self->exec/
{
exit(0);
@@ -52,7 +52,7 @@ EOF
sleeper()
{
while true; do
- /bin/sleep 1
+ /usr/bin/sleep 1
done
}
diff --git a/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh b/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
index 5dbce13e0c5f..fb1efc5432ee 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
+++ b/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
@@ -42,7 +42,7 @@ script()
self->exec = 1;
}
- proc:::exec_failure
+ proc:::exec-failure
/self->exec && args[0] == ENOENT/
{
exit(0);
@@ -53,7 +53,7 @@ EOF
sleeper()
{
while true; do
- /bin/sleep 1
+ /usr/bin/sleep 1
$badexec
done
}
diff --git a/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh b/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
index 3b2dbb39a737..d2241e1e56b4 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
+++ b/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
@@ -45,7 +45,7 @@ script()
self->exec = 1;
}
- proc:::exec_failure
+ proc:::exec-failure
/self->exec/
{
exit(0);
@@ -56,7 +56,7 @@ EOF
sleeper()
{
while true; do
- /bin/sleep 1
+ /usr/bin/sleep 1
$badexec
done
}
diff --git a/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh b/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh
index 867e4ffdf1eb..df3fdb3d6dc0 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh
+++ b/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh
@@ -43,16 +43,18 @@ script()
$dtrace -s /dev/stdin <<EOF
proc:::exit
/curpsinfo->pr_ppid == $child &&
- execargs == "$longsleep" && args[0] == CLD_DUMPED/
+ curpsinfo->pr_psargs == "$longsleep" && args[0] == CLD_DUMPED/
{
exit(0);
}
proc:::exit
/curpsinfo->pr_ppid == $child &&
- execargs == "$longsleep" && args[0] != CLD_DUMPED/
+ curpsinfo->pr_psargs == "$longsleep" && args[0] != CLD_DUMPED/
{
- printf("Child process could did dump core.");
+ printf("Child process could not dump core. Check coreadm(1M)");
+ printf(" settings; either per-process or global core dumps ");
+ printf("must be enabled for this test to work properly.");
exit(1);
}
EOF
@@ -60,12 +62,13 @@ EOF
sleeper()
{
+ /usr/bin/coreadm -p $corefile
while true; do
$longsleep &
- /bin/sleep 1
+ /usr/bin/sleep 1
kill -SEGV $!
done
- /bin/rm -f $corefile
+ /usr/bin/rm -f $corefile
}
if [ $# != 1 ]; then
@@ -74,8 +77,8 @@ if [ $# != 1 ]; then
fi
dtrace=$1
-longsleep="/bin/sleep 10000"
-corefile=/tmp/sleep.core
+longsleep="/usr/bin/sleep 10000"
+corefile=/tmp/core.$$
sleeper &
child=$!
@@ -83,10 +86,10 @@ child=$!
script
status=$?
-#pstop $child
-#pkill -P $child
+pstop $child
+pkill -P $child
kill $child
-#prun $child
+prun $child
-/bin/rm -f $corefile
+/usr/bin/rm -f $corefile
exit $status
diff --git a/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh b/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh
index 0d71b15f4ee1..13af911cadf9 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh
+++ b/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh
@@ -46,7 +46,7 @@ EOF
sleeper()
{
while true; do
- /bin/sleep 1
+ /usr/bin/sleep 1
done
}
diff --git a/cmd/dtrace/test/tst/common/proc/tst.sigwait.c b/cmd/dtrace/test/tst/common/proc/tst.sigwait.c
index c9cc43472cab..8f6231bd749a 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.sigwait.c
+++ b/cmd/dtrace/test/tst/common/proc/tst.sigwait.c
@@ -33,8 +33,6 @@
#include <errno.h>
#include <string.h>
-#define NANOSEC 1000000000
-
int
main(int argc, char **argv)
{
@@ -43,7 +41,6 @@ main(int argc, char **argv)
sigset_t set;
timer_t tid;
char *cmd = argv[0];
- int sig;
ev.sigev_notify = SIGEV_SIGNAL;
ev.sigev_signo = SIGUSR1;
@@ -69,9 +66,9 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
- do {
- (void) sigwait(&set, &sig);
- } while(sig != SIGUSR1);
+ for (;;) {
+ (void) sigwait(&set);
+ }
/*NOTREACHED*/
return (0);
diff --git a/cmd/dtrace/test/tst/common/proc/tst.sigwait.d b/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
index fd6baffdc276..851fa262d6bb 100644
--- a/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
+++ b/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
@@ -28,13 +28,13 @@
#pragma D option destructive
-proc:::signal_send
-/args[1]->p_pid == $1 && args[2] == SIGUSR1/
+proc:::signal-send
+/pid == 0 && args[1]->pr_pid == $1 && args[2] == SIGUSR1/
{
sent = 1;
}
-proc:::signal_clear
+proc:::signal-clear
/pid == $1 && args[0] == SIGUSR1 && sent/
{
exit(0);
diff --git a/cmd/dtrace/test/tst/common/raise/tst.raise1.d b/cmd/dtrace/test/tst/common/raise/tst.raise1.d
index cdc7154750b6..b3b70f24aae4 100644
--- a/cmd/dtrace/test/tst/common/raise/tst.raise1.d
+++ b/cmd/dtrace/test/tst/common/raise/tst.raise1.d
@@ -54,7 +54,7 @@ syscall::getpid:entry
timeout = timestamp + 500000000;
}
-syscall::exit:entry
+syscall::rexit:entry
{
exit(0);
}
diff --git a/cmd/dtrace/test/tst/common/raise/tst.raise2.c b/cmd/dtrace/test/tst/common/raise/tst.raise2.c
index 9089283f7893..be0d98204f42 100644
--- a/cmd/dtrace/test/tst/common/raise/tst.raise2.c
+++ b/cmd/dtrace/test/tst/common/raise/tst.raise2.c
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <signal.h>
-#include <stdlib.h>
static void
handle(int sig)
diff --git a/cmd/dtrace/test/tst/common/raise/tst.raise2.d b/cmd/dtrace/test/tst/common/raise/tst.raise2.d
index 4f68a0b93b3b..1f967a3d3ee1 100644
--- a/cmd/dtrace/test/tst/common/raise/tst.raise2.d
+++ b/cmd/dtrace/test/tst/common/raise/tst.raise2.d
@@ -54,7 +54,7 @@ syscall::getpid:return
timeout = timestamp + 500000000;
}
-syscall::exit:entry
+syscall::rexit:entry
{
exit(0);
}
diff --git a/cmd/dtrace/test/tst/common/raise/tst.raise3.c b/cmd/dtrace/test/tst/common/raise/tst.raise3.c
index 9089283f7893..be0d98204f42 100644
--- a/cmd/dtrace/test/tst/common/raise/tst.raise3.c
+++ b/cmd/dtrace/test/tst/common/raise/tst.raise3.c
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <signal.h>
-#include <stdlib.h>
static void
handle(int sig)
diff --git a/cmd/dtrace/test/tst/common/raise/tst.raise3.d b/cmd/dtrace/test/tst/common/raise/tst.raise3.d
index cdc7154750b6..b3b70f24aae4 100644
--- a/cmd/dtrace/test/tst/common/raise/tst.raise3.d
+++ b/cmd/dtrace/test/tst/common/raise/tst.raise3.d
@@ -54,7 +54,7 @@ syscall::getpid:entry
timeout = timestamp + 500000000;
}
-syscall::exit:entry
+syscall::rexit:entry
{
exit(0);
}
diff --git a/cmd/dtrace/test/tst/common/safety/tst.rw.d b/cmd/dtrace/test/tst/common/safety/tst.rw.d
index c1fcd85bac04..0df978779d47 100644
--- a/cmd/dtrace/test/tst/common/safety/tst.rw.d
+++ b/cmd/dtrace/test/tst/common/safety/tst.rw.d
@@ -38,22 +38,22 @@ fbt:::
fbt:::
/on/
{
- @[rw_read_held((struct rwlock *)&`unp_global_rwlock)] = count();
- @[rw_read_held((struct rwlock *)rand())] = count();
+ @[rw_read_held((krwlock_t *)&`clock)] = count();
+ @[rw_read_held((krwlock_t *)rand())] = count();
}
fbt:::
/on/
{
- @[rw_write_held((struct rwlock *)&`unp_global_rwlock)] = count();
- @[rw_write_held((struct rwlock *)rand())] = count();
+ @[rw_write_held((krwlock_t *)&`clock)] = count();
+ @[rw_write_held((krwlock_t *)rand())] = count();
}
fbt:::
/on/
{
- @[rw_iswriter((struct rwlock *)&`unp_global_rwlock)] = count();
- @[rw_iswriter((struct rwlock *)rand())] = count();
+ @[rw_iswriter((krwlock_t *)&`clock)] = count();
+ @[rw_iswriter((krwlock_t *)rand())] = count();
}
tick-1sec
diff --git a/cmd/dtrace/test/tst/common/trace/tst.misc.d b/cmd/dtrace/test/tst/common/trace/tst.misc.d
index 70ad5fc6d969..179d76027871 100644
--- a/cmd/dtrace/test/tst/common/trace/tst.misc.d
+++ b/cmd/dtrace/test/tst/common/trace/tst.misc.d
@@ -61,8 +61,3 @@ tick-1
{
exit(0);
}
-
-ERROR
-{
- exit(1);
-}
diff --git a/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d b/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d
index 537b72281254..afa1570d4c00 100644
--- a/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d
+++ b/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d
@@ -52,8 +52,3 @@ tick-1
{
exit(0);
}
-
-ERROR
-{
- exit(1);
-}
diff --git a/cmd/mdb/tools/common/die.c b/cmd/mdb/tools/common/die.c
index 602969e1abb3..16523ff24d57 100644
--- a/cmd/mdb/tools/common/die.c
+++ b/cmd/mdb/tools/common/die.c
@@ -40,9 +40,6 @@ die(char *format, ...)
{
va_list ap;
int err = errno;
-#if !defined(sun)
- const char *progname = getprogname();
-#endif
(void) fprintf(stderr, "%s: ", progname);
@@ -54,20 +51,13 @@ die(char *format, ...)
if (format[strlen(format) - 1] != '\n')
(void) fprintf(stderr, ": %s\n", strerror(err));
-#if defined(__FreeBSD__)
- exit(0);
-#else
exit(1);
-#endif
}
void
elfdie(char *format, ...)
{
va_list ap;
-#if !defined(sun)
- const char *progname = getprogname();
-#endif
(void) fprintf(stderr, "%s: ", progname);
@@ -79,9 +69,5 @@ elfdie(char *format, ...)
if (format[strlen(format) - 1] != '\n')
(void) fprintf(stderr, ": %s\n", elf_errmsg(elf_errno()));
-#if defined(__FreeBSD__)
- exit(0);
-#else
exit(1);
-#endif
}
diff --git a/cmd/mdb/tools/common/util.h b/cmd/mdb/tools/common/util.h
index a0932ada0d57..34e191b6a656 100644
--- a/cmd/mdb/tools/common/util.h
+++ b/cmd/mdb/tools/common/util.h
@@ -40,9 +40,7 @@ extern int findelfsecidx(Elf *, char *);
extern void die(char *, ...);
extern void elfdie(char *, ...);
-#if defined(sun)
extern const char *progname;
-#endif
#ifdef __cplusplus
}
diff --git a/cmd/sgs/include/alist.h b/cmd/sgs/include/alist.h
index c27160bd35cc..e92811f2ee5c 100644
--- a/cmd/sgs/include/alist.h
+++ b/cmd/sgs/include/alist.h
@@ -39,11 +39,7 @@ extern "C" {
#endif
#include <sys/types.h>
-#if defined(sun)
#include <sys/machelf.h>
-#else
-#include <sys/elf.h>
-#endif
/*
* An Alist implements array lists. The functionality is similar to
diff --git a/cmd/sgs/include/debug.h b/cmd/sgs/include/debug.h
index 0a42f8dd9e9b..1b733bbf6f61 100644
--- a/cmd/sgs/include/debug.h
+++ b/cmd/sgs/include/debug.h
@@ -405,7 +405,6 @@ extern uintptr_t Dbg_setup(const char *, Dbg_desc *);
#define Dbg_unused_file Dbg64_unused_file
#define Dbg_unused_lcinterface Dbg64_unused_lcinterface
-#define Dbg_unused_path Dbg64_unused_path
#define Dbg_unused_sec Dbg64_unused_sec
#define Dbg_unused_unref Dbg64_unused_unref
@@ -608,7 +607,6 @@ extern uintptr_t Dbg_setup(const char *, Dbg_desc *);
#define Dbg_unused_file Dbg32_unused_file
#define Dbg_unused_lcinterface Dbg32_unused_lcinterface
-#define Dbg_unused_path Dbg32_unused_path
#define Dbg_unused_sec Dbg32_unused_sec
#define Dbg_unused_unref Dbg32_unused_unref
@@ -678,7 +676,7 @@ extern void Dbg_file_del_rescan(Lm_list *);
extern void Dbg_file_delete(Rt_map *);
extern void Dbg_file_dlclose(Lm_list *, const char *, int);
extern void Dbg_file_dldump(Rt_map *, const char *, int);
-extern void Dbg_file_dlopen(Rt_map *, const char *, int *, int);
+extern void Dbg_file_dlopen(Rt_map *, const char *, int);
extern void Dbg_file_elf(Lm_list *, const char *, ulong_t, ulong_t,
ulong_t, ulong_t, const char *, Aliste);
extern void Dbg_file_filtee(Lm_list *, const char *, const char *, int);
@@ -710,7 +708,7 @@ extern void Dbg_libs_found(Lm_list *, const char *, int);
extern void Dbg_libs_ignore(Lm_list *, const char *);
extern void Dbg_libs_init(Lm_list *, List *, List *);
extern void Dbg_libs_l(Lm_list *, const char *, const char *);
-extern void Dbg_libs_path(Lm_list *, const char *, uint_t, const char *);
+extern void Dbg_libs_path(Lm_list *, const char *, Half, const char *);
extern void Dbg_libs_req(Lm_list *, const char *, const char *,
const char *);
extern void Dbg_libs_update(Lm_list *, List *, List *);
@@ -807,8 +805,7 @@ extern void Dbg_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *,
extern void Dbg_syms_ar_title(Lm_list *, const char *, int);
extern void Dbg_syms_created(Lm_list *, const char *);
extern void Dbg_syms_discarded(Lm_list *, Sym_desc *);
-extern void Dbg_syms_dlsym(Rt_map *, const char *, int *, const char *,
- int);
+extern void Dbg_syms_dlsym(Rt_map *, const char *, const char *, int);
extern void Dbg_syms_dup_sort_addr(Lm_list *, const char *, const char *,
const char *, Addr);
extern void Dbg_syms_entered(Ofl_desc *, Sym *, Sym_desc *);
@@ -861,8 +858,6 @@ extern void Dbg_util_wait(Rt_map *, Rt_map *, int);
extern void Dbg_unused_file(Lm_list *, const char *, int, uint_t);
extern void Dbg_unused_lcinterface(Rt_map *, Rt_map *, int);
-extern void Dbg_unused_path(Lm_list *, const char *, uint_t, uint_t,
- const char *);
extern void Dbg_unused_sec(Lm_list *, Is_desc *);
extern void Dbg_unused_unref(Rt_map *, const char *);
diff --git a/cmd/sgs/include/sgs.h b/cmd/sgs/include/sgs.h
index 34669cf60b3a..a1ec44b2cce9 100644
--- a/cmd/sgs/include/sgs.h
+++ b/cmd/sgs/include/sgs.h
@@ -24,7 +24,7 @@
* All Rights Reserved
*
*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Global include file for all sgs.
@@ -35,6 +35,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -48,11 +49,7 @@ extern "C" {
#ifndef _ASM
#include <sys/types.h>
-#if defined(sun)
#include <sys/machelf.h>
-#else
-#include <elf.h>
-#endif
#include <stdlib.h>
#include <libelf.h>
#include <assert.h>
@@ -69,14 +66,8 @@ extern "C" {
#ifndef _ASM
-/*
- * link_ver_string[] contains a version string for use by the link-editor
- * and all other linker components. It is found in libconv, and is
- * generated by sgs/libconv/common/bld_vernote.ksh. That script produces
- * libconv/{plat}/vernote.s, which is in turn assembled/linked into
- * libconv.
- */
-extern const char link_ver_string[];
+extern const char link_ver_string[]; /* Linker version id */
+ /* see libconv/{plat}/vernote.s */
/*
* Macro to round to next double word boundary.
*/
diff --git a/cmd/sgs/tools/common/findprime.c b/cmd/sgs/tools/common/findprime.c
index 299fa21362c7..87d88c0b930a 100644
--- a/cmd/sgs/tools/common/findprime.c
+++ b/cmd/sgs/tools/common/findprime.c
@@ -27,7 +27,6 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
-#include <sgs.h>
/*
* function that will find a prime'ish number. Usefull for
diff --git a/lib/libctf/common/ctf_lib.c b/lib/libctf/common/ctf_lib.c
index 6cd003663cac..6e599540a4f6 100644
--- a/lib/libctf/common/ctf_lib.c
+++ b/lib/libctf/common/ctf_lib.c
@@ -29,25 +29,18 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
-#include <sys/zmod.h>
#include <ctf_impl.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#if defined(sun)
#include <dlfcn.h>
-#else
-#include <zlib.h>
-#endif
#include <gelf.h>
-#if defined(sun)
#ifdef _LP64
static const char *_libctf_zlib = "/usr/lib/64/libz.so";
#else
static const char *_libctf_zlib = "/usr/lib/libz.so";
#endif
-#endif
static struct {
int (*z_uncompress)(uchar_t *, ulong_t *, const uchar_t *, ulong_t);
@@ -58,20 +51,14 @@ static struct {
static size_t _PAGESIZE;
static size_t _PAGEMASK;
-#if defined(sun)
#pragma init(_libctf_init)
-#else
-void _libctf_init(void) __attribute__ ((constructor));
-#endif
void
_libctf_init(void)
{
-#if defined(sun)
const char *p = getenv("LIBCTF_DECOMPRESSOR");
if (p != NULL)
_libctf_zlib = p; /* use alternate decompression library */
-#endif
_libctf_debug = getenv("LIBCTF_DEBUG") != NULL;
@@ -87,7 +74,6 @@ _libctf_init(void)
void *
ctf_zopen(int *errp)
{
-#if defined(sun)
ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib);
if (zlib.z_dlp != NULL)
@@ -99,21 +85,14 @@ ctf_zopen(int *errp)
if ((zlib.z_dlp = dlopen(_libctf_zlib, RTLD_LAZY | RTLD_LOCAL)) == NULL)
return (ctf_set_open_errno(errp, ECTF_ZINIT));
- zlib.z_uncompress = (int (*)(uchar_t *, ulong_t *, const uchar_t *, ulong_t)) dlsym(zlib.z_dlp, "uncompress");
- zlib.z_error = (const char *(*)(int)) dlsym(zlib.z_dlp, "zError");
+ zlib.z_uncompress = (int (*)()) dlsym(zlib.z_dlp, "uncompress");
+ zlib.z_error = (const char *(*)()) dlsym(zlib.z_dlp, "zError");
if (zlib.z_uncompress == NULL || zlib.z_error == NULL) {
(void) dlclose(zlib.z_dlp);
bzero(&zlib, sizeof (zlib));
return (ctf_set_open_errno(errp, ECTF_ZINIT));
}
-#else
- zlib.z_uncompress = uncompress;
- zlib.z_error = zError;
-
- /* Dummy return variable as 'no error' */
- zlib.z_dlp = (void *) (uintptr_t) 1;
-#endif
return (zlib.z_dlp);
}
@@ -241,7 +220,7 @@ ctf_fdopen(int fd, int *errp)
* If we have read enough bytes to form a CTF header and the magic
* string matches, attempt to interpret the file as raw CTF.
*/
- if (nbytes >= (ssize_t) sizeof (ctf_preamble_t) &&
+ if (nbytes >= sizeof (ctf_preamble_t) &&
hdr.ctf.ctp_magic == CTF_MAGIC) {
if (hdr.ctf.ctp_version > CTF_VERSION)
return (ctf_set_open_errno(errp, ECTF_CTFVERS));
@@ -271,7 +250,7 @@ ctf_fdopen(int fd, int *errp)
* do our own largefile ELF processing, and convert everything to
* GElf structures so that clients can operate on any data model.
*/
- if (nbytes >= (ssize_t) sizeof (Elf32_Ehdr) &&
+ if (nbytes >= sizeof (Elf32_Ehdr) &&
bcmp(&hdr.e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) {
#ifdef _BIG_ENDIAN
uchar_t order = ELFDATA2MSB;
@@ -283,7 +262,7 @@ ctf_fdopen(int fd, int *errp)
void *strs_map;
size_t strs_mapsz;
- char *strs;
+ const char *strs;
if (hdr.e32.e_ident[EI_DATA] != order)
return (ctf_set_open_errno(errp, ECTF_ENDIAN));
@@ -291,7 +270,7 @@ ctf_fdopen(int fd, int *errp)
return (ctf_set_open_errno(errp, ECTF_ELFVERS));
if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS64) {
- if (nbytes < (ssize_t) sizeof (GElf_Ehdr))
+ if (nbytes < sizeof (GElf_Ehdr))
return (ctf_set_open_errno(errp, ECTF_FMT));
} else {
Elf32_Ehdr e32 = hdr.e32;
@@ -342,7 +321,7 @@ ctf_fdopen(int fd, int *errp)
strs_map = mmap64(NULL, strs_mapsz, PROT_READ, MAP_PRIVATE,
fd, sp[hdr.e64.e_shstrndx].sh_offset & _PAGEMASK);
- strs = (char *)strs_map +
+ strs = (const char *)strs_map +
(sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK);
if (strs_map == MAP_FAILED) {
diff --git a/lib/libctf/common/ctf_subr.c b/lib/libctf/common/ctf_subr.c
index e9f5ad7a1f71..467b6a8181a8 100644
--- a/lib/libctf/common/ctf_subr.c
+++ b/lib/libctf/common/ctf_subr.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <ctf_impl.h>
+#include <libctf.h>
#include <sys/mman.h>
#include <stdarg.h>
@@ -57,7 +58,7 @@ ctf_alloc(size_t size)
/*ARGSUSED*/
void
-ctf_free(void *buf, __unused size_t size)
+ctf_free(void *buf, size_t size)
{
free(buf);
}
@@ -65,7 +66,7 @@ ctf_free(void *buf, __unused size_t size)
const char *
ctf_strerror(int err)
{
- return ((const char *) strerror(err));
+ return (strerror(err));
}
/*PRINTFLIKE1*/
diff --git a/lib/libdtrace/common/drti.c b/lib/libdtrace/common/drti.c
index c983c5b595a8..f8570e686f5b 100644
--- a/lib/libdtrace/common/drti.c
+++ b/lib/libdtrace/common/drti.c
@@ -55,7 +55,7 @@
* DTRACE_DOF_INIT_DEVNAME set the path to the helper node
*/
-static const char *devnamep = "/dev/dtrace/helper";
+static const char *devname = "/dev/dtrace/helper";
static const char *olddevname = "/devices/pseudo/dtrace@0:helper";
static const char *modname; /* Name of this load object */
@@ -85,12 +85,7 @@ dprintf(int debug, const char *fmt, ...)
va_end(ap);
}
-#if defined(sun)
#pragma init(dtrace_dof_init)
-#else
-static void dtrace_dof_init(void) __attribute__ ((constructor));
-#endif
-
static void
dtrace_dof_init(void)
{
@@ -101,13 +96,8 @@ dtrace_dof_init(void)
Elf32_Ehdr *elf;
#endif
dof_helper_t dh;
-#if defined(sun)
Link_map *lmp;
Lmid_t lmid;
-#else
- struct link_map *lmp;
- u_long lmid = 0;
-#endif
int fd;
const char *p;
@@ -119,12 +109,10 @@ dtrace_dof_init(void)
return;
}
-#if defined(sun)
if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) {
dprintf(1, "couldn't discover link map ID\n");
return;
}
-#endif
if ((modname = strrchr(lmp->l_name, '/')) == NULL)
modname = lmp->l_name;
@@ -142,7 +130,7 @@ dtrace_dof_init(void)
elf = (void *)lmp->l_addr;
dh.dofhp_dof = (uintptr_t)dof;
- dh.dofhp_addr = elf->e_type == ET_DYN ? (uintptr_t) lmp->l_addr : 0;
+ dh.dofhp_addr = elf->e_type == ET_DYN ? lmp->l_addr : 0;
if (lmid == 0) {
(void) snprintf(dh.dofhp_mod, sizeof (dh.dofhp_mod),
@@ -153,10 +141,10 @@ dtrace_dof_init(void)
}
if ((p = getenv("DTRACE_DOF_INIT_DEVNAME")) != NULL)
- devnamep = p;
+ devname = p;
- if ((fd = open64(devnamep, O_RDWR)) < 0) {
- dprintf(1, "failed to open helper device %s", devnamep);
+ if ((fd = open64(devname, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devname);
/*
* If the device path wasn't explicitly set, try again with
@@ -165,10 +153,10 @@ dtrace_dof_init(void)
if (p != NULL)
return;
- devnamep = olddevname;
+ devname = olddevname;
- if ((fd = open64(devnamep, O_RDWR)) < 0) {
- dprintf(1, "failed to open helper device %s", devnamep);
+ if ((fd = open64(devname, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devname);
return;
}
}
@@ -181,19 +169,14 @@ dtrace_dof_init(void)
(void) close(fd);
}
-#if defined(sun)
#pragma fini(dtrace_dof_fini)
-#else
-static void dtrace_dof_fini(void) __attribute__ ((destructor));
-#endif
-
static void
dtrace_dof_fini(void)
{
int fd;
- if ((fd = open64(devnamep, O_RDWR)) < 0) {
- dprintf(1, "failed to open helper device %s", devnamep);
+ if ((fd = open64(devname, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devname);
return;
}
diff --git a/lib/libdtrace/common/dt_aggregate.c b/lib/libdtrace/common/dt_aggregate.c
index ac32f769a934..2e66250b88d7 100644
--- a/lib/libdtrace/common/dt_aggregate.c
+++ b/lib/libdtrace/common/dt_aggregate.c
@@ -32,11 +32,7 @@
#include <unistd.h>
#include <dt_impl.h>
#include <assert.h>
-#if defined(sun)
#include <alloca.h>
-#else
-#include <sys/sysctl.h>
-#endif
#include <limits.h>
#define DTRACE_AHASHSIZE 32779 /* big 'ol prime */
@@ -58,7 +54,7 @@ static int dt_keypos;
static void
dt_aggregate_count(int64_t *existing, int64_t *new, size_t size)
{
- uint_t i;
+ int i;
for (i = 0; i < size / sizeof (int64_t); i++)
existing[i] = existing[i] + new[i];
@@ -211,10 +207,9 @@ dt_aggregate_lquantizedcmp(int64_t *lhs, int64_t *rhs)
static int
dt_aggregate_quantizedcmp(int64_t *lhs, int64_t *rhs)
{
- int nbuckets = DTRACE_QUANTIZE_NBUCKETS;
+ int nbuckets = DTRACE_QUANTIZE_NBUCKETS, i;
long double ltotal = 0, rtotal = 0;
int64_t lzero, rzero;
- uint_t i;
for (i = 0; i < nbuckets; i++) {
int64_t bucketval = DTRACE_QUANTIZE_BUCKETVAL(i);
@@ -264,11 +259,7 @@ dt_aggregate_usym(dtrace_hdl_t *dtp, uint64_t *data)
dt_proc_lock(dtp, P);
-#if defined(sun)
if (Plookup_by_addr(P, *pc, NULL, 0, &sym) == 0)
-#else
- if (proc_addr2sym(P, *pc, NULL, 0, &sym) == 0)
-#endif
*pc = sym.st_value;
dt_proc_unlock(dtp, P);
@@ -291,11 +282,7 @@ dt_aggregate_umod(dtrace_hdl_t *dtp, uint64_t *data)
dt_proc_lock(dtp, P);
-#if defined(sun)
if ((map = Paddr_to_map(P, *pc)) != NULL)
-#else
- if ((map = proc_addr2map(P, *pc)) != NULL)
-#endif
*pc = map->pr_vaddr;
dt_proc_unlock(dtp, P);
@@ -380,11 +367,7 @@ dt_aggregate_snap_cpu(dtrace_hdl_t *dtp, processorid_t cpu)
buf->dtbd_cpu = cpu;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) {
-#endif
if (errno == ENOENT) {
/*
* If that failed with ENOENT, it may be because the
@@ -653,7 +636,7 @@ dtrace_aggregate_snap(dtrace_hdl_t *dtp)
return (0);
for (i = 0; i < agp->dtat_ncpus; i++) {
- if ((rval = dt_aggregate_snap_cpu(dtp, agp->dtat_cpus[i])))
+ if (rval = dt_aggregate_snap_cpu(dtp, agp->dtat_cpus[i]))
return (rval);
}
@@ -1131,7 +1114,7 @@ dt_aggwalk_rval(dtrace_hdl_t *dtp, dt_ahashent_t *h, int rval)
case DTRACE_AGGWALK_REMOVE: {
dtrace_aggdata_t *aggdata = &h->dtahe_data;
- int max_cpus = agp->dtat_maxcpu;
+ int i, max_cpus = agp->dtat_maxcpu;
/*
* First, remove this hash entry from its hash chain.
diff --git a/lib/libdtrace/common/dt_cc.c b/lib/libdtrace/common/dt_cc.c
index 8bd09151d1c4..64b29220491e 100644
--- a/lib/libdtrace/common/dt_cc.c
+++ b/lib/libdtrace/common/dt_cc.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -87,7 +87,6 @@
#include <sys/wait.h>
#include <assert.h>
-#include <string.h>
#include <strings.h>
#include <signal.h>
#include <unistd.h>
@@ -949,77 +948,6 @@ dt_action_speculate(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
}
static void
-dt_action_printm(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
-{
- dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
-
- dt_node_t *size = dnp->dn_args;
- dt_node_t *addr = dnp->dn_args->dn_list;
-
- char n[DT_TYPE_NAMELEN];
-
- if (dt_node_is_posconst(size) == 0) {
- dnerror(size, D_PRINTM_SIZE, "printm( ) argument #1 must "
- "be a non-zero positive integral constant expression\n");
- }
-
- if (dt_node_is_pointer(addr) == 0) {
- dnerror(addr, D_PRINTM_ADDR,
- "printm( ) argument #2 is incompatible with "
- "prototype:\n\tprototype: pointer\n"
- "\t argument: %s\n",
- dt_node_type_name(addr, n, sizeof (n)));
- }
-
- dt_cg(yypcb, addr);
- ap->dtad_difo = dt_as(yypcb);
- ap->dtad_kind = DTRACEACT_PRINTM;
-
- ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
- ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + sizeof(uintptr_t);
-}
-
-static void
-dt_action_printt(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
-{
- dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
-
- dt_node_t *size = dnp->dn_args;
- dt_node_t *addr = dnp->dn_args->dn_list;
-
- char n[DT_TYPE_NAMELEN];
-
- if (dt_node_is_posconst(size) == 0) {
- dnerror(size, D_PRINTT_SIZE, "printt( ) argument #1 must "
- "be a non-zero positive integral constant expression\n");
- }
-
- if (addr == NULL || addr->dn_kind != DT_NODE_FUNC ||
- addr->dn_ident != dt_idhash_lookup(dtp->dt_globals, "typeref")) {
- dnerror(addr, D_PRINTT_ADDR,
- "printt( ) argument #2 is incompatible with "
- "prototype:\n\tprototype: typeref()\n"
- "\t argument: %s\n",
- dt_node_type_name(addr, n, sizeof (n)));
- }
-
- dt_cg(yypcb, addr);
- ap->dtad_difo = dt_as(yypcb);
- ap->dtad_kind = DTRACEACT_PRINTT;
-
- ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
-
- /*
- * Allow additional buffer space for the data size, type size,
- * type string length and a stab in the dark (32 bytes) for the
- * type string. The type string is part of the typeref() that
- * this action references.
- */
- ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + 3 * sizeof(uintptr_t) + 32;
-
-}
-
-static void
dt_action_commit(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
{
dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
@@ -1085,12 +1013,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
case DT_ACT_PRINTF:
dt_action_printflike(dtp, dnp->dn_expr, sdp, DTRACEACT_PRINTF);
break;
- case DT_ACT_PRINTM:
- dt_action_printm(dtp, dnp->dn_expr, sdp);
- break;
- case DT_ACT_PRINTT:
- dt_action_printt(dtp, dnp->dn_expr, sdp);
- break;
case DT_ACT_RAISE:
dt_action_raise(dtp, dnp->dn_expr, sdp);
break;
@@ -1667,9 +1589,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
char **argv = malloc(sizeof (char *) * (argc + 5));
FILE *ofp = tmpfile();
-#if defined(sun)
char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */
-#endif
char verdef[32]; /* big enough for -D__SUNW_D_VERSION=0x%08x + \0 */
struct sigaction act, oact;
@@ -1677,11 +1597,7 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
int wstat, estat;
pid_t pid;
-#if defined(sun)
off64_t off;
-#else
- off_t off = 0;
-#endif
int c;
if (argv == NULL || ofp == NULL) {
@@ -1708,10 +1624,8 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
(void) fseeko64(ifp, off, SEEK_SET);
}
-#if defined(sun)
(void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp));
(void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp));
-#endif
bcopy(dtp->dt_cpp_argv, argv, sizeof (char *) * argc);
@@ -1719,7 +1633,6 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
"-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax);
argv[argc++] = verdef;
-#if defined(sun)
switch (dtp->dt_stdcmode) {
case DT_STDC_XA:
case DT_STDC_XT:
@@ -1732,9 +1645,6 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
argv[argc++] = ipath;
argv[argc++] = opath;
-#else
- argv[argc++] = "-P";
-#endif
argv[argc] = NULL;
/*
@@ -1761,12 +1671,6 @@ dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
}
if (pid == 0) {
-#if !defined(sun)
- if (isatty(fileno(ifp)) == 0)
- lseek(fileno(ifp), off, SEEK_SET);
- dup2(fileno(ifp), 0);
- dup2(fileno(ofp), 1);
-#endif
(void) execvp(dtp->dt_cpp_path, argv);
_exit(errno == ENOENT ? 127 : 126);
}
@@ -2106,10 +2010,8 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
dt_dprintf("skipping library %s: %s\n",
dld->dtld_library,
dtrace_errmsg(dtp, dtrace_errno(dtp)));
- } else {
- dld->dtld_loaded = B_TRUE;
+ } else
dt_program_destroy(dtp, pgp);
- }
}
dt_lib_depend_free(dtp);
diff --git a/lib/libdtrace/common/dt_cg.c b/lib/libdtrace/common/dt_cg.c
index a33cccd676d2..4557c6f85cfa 100644
--- a/lib/libdtrace/common/dt_cg.c
+++ b/lib/libdtrace/common/dt_cg.c
@@ -267,7 +267,7 @@ dt_cg_field_get(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp,
* properties are used to compute shift as USHIFT or SSHIFT, below.
*/
if (dnp->dn_flags & DT_NF_SIGNED) {
-#if BYTE_ORDER == _BIG_ENDIAN
+#ifdef _BIG_ENDIAN
shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
mp->ctm_offset % NBBY;
#else
@@ -281,7 +281,7 @@ dt_cg_field_get(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp,
instr = DIF_INSTR_FMT(DIF_OP_SRA, r1, r2, r1);
dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
} else {
-#if BYTE_ORDER == _BIG_ENDIAN
+#ifdef _BIG_ENDIAN
shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
(mp->ctm_offset % NBBY + e.cte_bits);
#else
@@ -369,7 +369,7 @@ dt_cg_field_set(dt_node_t *src, dt_irlist_t *dlp,
* input register to width cte_bits, and cmask as the mask used to
* pass through the containing bits and zero the field bits.
*/
-#if BYTE_ORDER == _BIG_ENDIAN
+#ifdef _BIG_ENDIAN
shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
(m.ctm_offset % NBBY + e.cte_bits);
#else
@@ -1339,40 +1339,6 @@ dt_cg_inline(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
}
static void
-dt_cg_func_typeref(dtrace_hdl_t *dtp, dt_node_t *dnp)
-{
- dtrace_typeinfo_t dtt;
- dt_node_t *addr = dnp->dn_args;
- dt_node_t *nelm = addr->dn_list;
- dt_node_t *strp = nelm->dn_list;
- dt_node_t *typs = strp->dn_list;
- char buf[DT_TYPE_NAMELEN];
- char *p;
-
- ctf_type_name(addr->dn_ctfp, addr->dn_type, buf, sizeof (buf));
-
- /*
- * XXX Hack alert! XXX
- * The prototype has two dummy args that we munge to represent
- * the type string and the type size.
- *
- * Yes, I hear your grumble, but it works for now. We'll come
- * up with a more elegant implementation later. :-)
- */
- free(strp->dn_string);
-
- if ((p = strchr(buf, '*')) != NULL)
- *p = '\0';
-
- strp->dn_string = strdup(buf);
-
- if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, buf, &dtt) < 0)
- return;
-
- typs->dn_value = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
-}
-
-static void
dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
{
ctf_file_t *ctfp = dnp->dn_ctfp;
@@ -1827,9 +1793,7 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
}
switch (dnp->dn_kind) {
- case DT_NODE_FUNC: {
- dtrace_hdl_t *dtp = yypcb->pcb_hdl;
-
+ case DT_NODE_FUNC:
if ((idp = dnp->dn_ident)->di_kind != DT_IDENT_FUNC) {
dnerror(dnp, D_CG_EXPR, "%s %s( ) may not be "
"called from a D expression (D program "
@@ -1837,15 +1801,6 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
dt_idkind_name(idp->di_kind), idp->di_name);
}
- switch (idp->di_id) {
- case DIF_SUBR_TYPEREF:
- dt_cg_func_typeref(dtp, dnp);
- break;
-
- default:
- break;
- }
-
dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);
if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
@@ -1858,7 +1813,6 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
dt_cg_node_alloc(DT_LBL_NONE, instr));
break;
- }
case DT_NODE_VAR:
if (dnp->dn_ident->di_kind == DT_IDENT_XLSOU ||
diff --git a/lib/libdtrace/common/dt_consume.c b/lib/libdtrace/common/dt_consume.c
index 776fd17c0309..62d39e07dd41 100644
--- a/lib/libdtrace/common/dt_consume.c
+++ b/lib/libdtrace/common/dt_consume.c
@@ -32,9 +32,7 @@
#include <limits.h>
#include <assert.h>
#include <ctype.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <dt_impl.h>
#define DT_MASK_LO 0x00000000FFFFFFFFULL
@@ -712,7 +710,7 @@ dt_print_stddev(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
/*ARGSUSED*/
int
dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
- size_t nbytes, int width, int quiet, int raw)
+ size_t nbytes, int width, int quiet)
{
/*
* If the byte stream is a series of printable characters, followed by
@@ -725,7 +723,7 @@ dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
if (nbytes == 0)
return (0);
- if (raw || dtp->dt_options[DTRACEOPT_RAWBYTES] != DTRACEOPT_UNSET)
+ if (dtp->dt_options[DTRACEOPT_RAWBYTES] != DTRACEOPT_UNSET)
goto raw;
for (i = 0; i < nbytes; i++) {
@@ -860,7 +858,7 @@ dt_print_stack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
return (dt_set_errno(dtp, EDT_BADSTACKPC));
}
- if (pc == 0)
+ if (pc == NULL)
break;
addr += size;
@@ -948,23 +946,15 @@ dt_print_ustack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
if (P != NULL)
dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
- for (i = 0; i < depth && pc[i] != 0; i++) {
+ for (i = 0; i < depth && pc[i] != NULL; i++) {
const prmap_t *map;
if ((err = dt_printf(dtp, fp, "%*s", indent, "")) < 0)
break;
-#if defined(sun)
if (P != NULL && Plookup_by_addr(P, pc[i],
-#else
- if (P != NULL && proc_addr2sym(P, pc[i],
-#endif
name, sizeof (name), &sym) == 0) {
-#if defined(sun)
(void) Pobjname(P, pc[i], objname, sizeof (objname));
-#else
- (void) proc_objname(P, pc[i], objname, sizeof (objname));
-#endif
if (pc[i] > sym.st_value) {
(void) snprintf(c, sizeof (c),
@@ -975,12 +965,8 @@ dt_print_ustack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
"%s`%s", dt_basename(objname), name);
}
} else if (str != NULL && str[0] != '\0' && str[0] != '@' &&
-#if defined(sun)
(P != NULL && ((map = Paddr_to_map(P, pc[i])) == NULL ||
(map->pr_mflags & MA_WRITE)))) {
-#else
- (P != NULL && ((map = proc_addr2map(P, pc[i])) == NULL))) {
-#endif
/*
* If the current string pointer in the string table
* does not point to an empty string _and_ the program
@@ -996,12 +982,8 @@ dt_print_ustack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
*/
(void) snprintf(c, sizeof (c), "%s", str);
} else {
-#if defined(sun)
if (P != NULL && Pobjname(P, pc[i], objname,
-#else
- if (P != NULL && proc_objname(P, pc[i], objname,
-#endif
- sizeof (objname)) != 0) {
+ sizeof (objname)) != NULL) {
(void) snprintf(c, sizeof (c), "%s`0x%llx",
dt_basename(objname), (u_longlong_t)pc[i]);
} else {
@@ -1070,11 +1052,7 @@ dt_print_usym(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, dtrace_actkind_t act)
dt_proc_lock(dtp, P);
-#if defined(sun)
if (Plookup_by_addr(P, pc, NULL, 0, &sym) == 0)
-#else
- if (proc_addr2sym(P, pc, NULL, 0, &sym) == 0)
-#endif
pc = sym.st_value;
dt_proc_unlock(dtp, P);
@@ -1117,11 +1095,7 @@ dt_print_umod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
if (P != NULL)
dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
-#if defined(sun)
- if (P != NULL && Pobjname(P, pc, objname, sizeof (objname)) != 0) {
-#else
- if (P != NULL && proc_objname(P, pc, objname, sizeof (objname)) != 0) {
-#endif
+ if (P != NULL && Pobjname(P, pc, objname, sizeof (objname)) != NULL) {
(void) snprintf(c, sizeof (c), "%s", dt_basename(objname));
} else {
(void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
@@ -1137,314 +1111,6 @@ dt_print_umod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
return (err);
}
-int
-dt_print_memory(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr)
-{
- int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
- size_t nbytes = *((uintptr_t *) addr);
-
- return (dt_print_bytes(dtp, fp, addr + sizeof(uintptr_t),
- nbytes, 50, quiet, 1));
-}
-
-typedef struct dt_type_cbdata {
- dtrace_hdl_t *dtp;
- dtrace_typeinfo_t dtt;
- caddr_t addr;
- caddr_t addrend;
- const char *name;
- int f_type;
- int indent;
- int type_width;
- int name_width;
- FILE *fp;
-} dt_type_cbdata_t;
-
-static int dt_print_type_data(dt_type_cbdata_t *, ctf_id_t);
-
-static int
-dt_print_type_member(const char *name, ctf_id_t type, ulong_t off, void *arg)
-{
- dt_type_cbdata_t cbdata;
- dt_type_cbdata_t *cbdatap = arg;
- ssize_t ssz;
-
- if ((ssz = ctf_type_size(cbdatap->dtt.dtt_ctfp, type)) <= 0)
- return (0);
-
- off /= 8;
-
- cbdata = *cbdatap;
- cbdata.name = name;
- cbdata.addr += off;
- cbdata.addrend = cbdata.addr + ssz;
-
- return (dt_print_type_data(&cbdata, type));
-}
-
-static int
-dt_print_type_width(const char *name, ctf_id_t type, ulong_t off, void *arg)
-{
- char buf[DT_TYPE_NAMELEN];
- char *p;
- dt_type_cbdata_t *cbdatap = arg;
- size_t sz = strlen(name);
-
- ctf_type_name(cbdatap->dtt.dtt_ctfp, type, buf, sizeof (buf));
-
- if ((p = strchr(buf, '[')) != NULL)
- p[-1] = '\0';
- else
- p = "";
-
- sz += strlen(p);
-
- if (sz > cbdatap->name_width)
- cbdatap->name_width = sz;
-
- sz = strlen(buf);
-
- if (sz > cbdatap->type_width)
- cbdatap->type_width = sz;
-
- return (0);
-}
-
-static int
-dt_print_type_data(dt_type_cbdata_t *cbdatap, ctf_id_t type)
-{
- caddr_t addr = cbdatap->addr;
- caddr_t addrend = cbdatap->addrend;
- char buf[DT_TYPE_NAMELEN];
- char *p;
- int cnt = 0;
- uint_t kind = ctf_type_kind(cbdatap->dtt.dtt_ctfp, type);
- ssize_t ssz = ctf_type_size(cbdatap->dtt.dtt_ctfp, type);
-
- ctf_type_name(cbdatap->dtt.dtt_ctfp, type, buf, sizeof (buf));
-
- if ((p = strchr(buf, '[')) != NULL)
- p[-1] = '\0';
- else
- p = "";
-
- if (cbdatap->f_type) {
- int type_width = roundup(cbdatap->type_width + 1, 4);
- int name_width = roundup(cbdatap->name_width + 1, 4);
-
- name_width -= strlen(cbdatap->name);
-
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s%-*s%s%-*s = ",cbdatap->indent * 4,"",type_width,buf,cbdatap->name,name_width,p);
- }
-
- while (addr < addrend) {
- dt_type_cbdata_t cbdata;
- ctf_arinfo_t arinfo;
- ctf_encoding_t cte;
- uintptr_t *up;
- void *vp = addr;
- cbdata = *cbdatap;
- cbdata.name = "";
- cbdata.addr = addr;
- cbdata.addrend = addr + ssz;
- cbdata.f_type = 0;
- cbdata.indent++;
- cbdata.type_width = 0;
- cbdata.name_width = 0;
-
- if (cnt > 0)
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s", cbdatap->indent * 4,"");
-
- switch (kind) {
- case CTF_K_INTEGER:
- if (ctf_type_encoding(cbdatap->dtt.dtt_ctfp, type, &cte) != 0)
- return (-1);
- if ((cte.cte_format & CTF_INT_SIGNED) != 0)
- switch (cte.cte_bits) {
- case 8:
- if (isprint(*((char *) vp)))
- dt_printf(cbdatap->dtp, cbdatap->fp, "'%c', ", *((char *) vp));
- dt_printf(cbdatap->dtp, cbdatap->fp, "%d (0x%x);\n", *((char *) vp), *((char *) vp));
- break;
- case 16:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%hd (0x%hx);\n", *((short *) vp), *((u_short *) vp));
- break;
- case 32:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%d (0x%x);\n", *((int *) vp), *((u_int *) vp));
- break;
- case 64:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%jd (0x%jx);\n", *((long long *) vp), *((unsigned long long *) vp));
- break;
- default:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_INTEGER: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits);
- break;
- }
- else
- switch (cte.cte_bits) {
- case 8:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%u (0x%x);\n", *((uint8_t *) vp) & 0xff, *((uint8_t *) vp) & 0xff);
- break;
- case 16:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%hu (0x%hx);\n", *((u_short *) vp), *((u_short *) vp));
- break;
- case 32:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%u (0x%x);\n", *((u_int *) vp), *((u_int *) vp));
- break;
- case 64:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%ju (0x%jx);\n", *((unsigned long long *) vp), *((unsigned long long *) vp));
- break;
- default:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_INTEGER: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits);
- break;
- }
- break;
- case CTF_K_FLOAT:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_FLOAT: format %x offset %u bits %u\n",cte.cte_format,cte.cte_offset,cte.cte_bits);
- break;
- case CTF_K_POINTER:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%p;\n", *((void **) addr));
- break;
- case CTF_K_ARRAY:
- if (ctf_array_info(cbdatap->dtt.dtt_ctfp, type, &arinfo) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "{\n%*s",cbdata.indent * 4,"");
- dt_print_type_data(&cbdata, arinfo.ctr_contents);
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,"");
- break;
- case CTF_K_FUNCTION:
- dt_printf(cbdatap->dtp, cbdatap->fp, "CTF_K_FUNCTION:\n");
- break;
- case CTF_K_STRUCT:
- cbdata.f_type = 1;
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_width, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "{\n");
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_member, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,"");
- break;
- case CTF_K_UNION:
- cbdata.f_type = 1;
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_width, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "{\n");
- if (ctf_member_iter(cbdatap->dtt.dtt_ctfp, type,
- dt_print_type_member, &cbdata) != 0)
- return (-1);
- dt_printf(cbdatap->dtp, cbdatap->fp, "%*s};\n",cbdatap->indent * 4,"");
- break;
- case CTF_K_ENUM:
- dt_printf(cbdatap->dtp, cbdatap->fp, "%s;\n", ctf_enum_name(cbdatap->dtt.dtt_ctfp, type, *((int *) vp)));
- break;
- case CTF_K_TYPEDEF:
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- case CTF_K_VOLATILE:
- if (cbdatap->f_type)
- dt_printf(cbdatap->dtp, cbdatap->fp, "volatile ");
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- case CTF_K_CONST:
- if (cbdatap->f_type)
- dt_printf(cbdatap->dtp, cbdatap->fp, "const ");
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- case CTF_K_RESTRICT:
- if (cbdatap->f_type)
- dt_printf(cbdatap->dtp, cbdatap->fp, "restrict ");
- dt_print_type_data(&cbdata, ctf_type_reference(cbdatap->dtt.dtt_ctfp,type));
- break;
- default:
- break;
- }
-
- addr += ssz;
- cnt++;
- }
-
- return (0);
-}
-
-static int
-dt_print_type(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr)
-{
- caddr_t addrend;
- char *p;
- dtrace_typeinfo_t dtt;
- dt_type_cbdata_t cbdata;
- int num = 0;
- int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
- ssize_t ssz;
-
- if (!quiet)
- dt_printf(dtp, fp, "\n");
-
- /* Get the total number of bytes of data buffered. */
- size_t nbytes = *((uintptr_t *) addr);
- addr += sizeof(uintptr_t);
-
- /*
- * Get the size of the type so that we can check that it matches
- * the CTF data we look up and so that we can figure out how many
- * type elements are buffered.
- */
- size_t typs = *((uintptr_t *) addr);
- addr += sizeof(uintptr_t);
-
- /*
- * Point to the type string in the buffer. Get it's string
- * length and round it up to become the offset to the start
- * of the buffered type data which we would like to be aligned
- * for easy access.
- */
- char *strp = (char *) addr;
- int offset = roundup(strlen(strp) + 1, sizeof(uintptr_t));
-
- /*
- * The type string might have a format such as 'int [20]'.
- * Check if there is an array dimension present.
- */
- if ((p = strchr(strp, '[')) != NULL) {
- /* Strip off the array dimension. */
- *p++ = '\0';
-
- for (; *p != '\0' && *p != ']'; p++)
- num = num * 10 + *p - '0';
- } else
- /* No array dimension, so default. */
- num = 1;
-
- /* Lookup the CTF type from the type string. */
- if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, strp, &dtt) < 0)
- return (-1);
-
- /* Offset the buffer address to the start of the data... */
- addr += offset;
-
- ssz = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
-
- if (typs != ssz) {
- printf("Expected type size from buffer (%lu) to match type size looked up now (%ld)\n", (u_long) typs, (long) ssz);
- return (-1);
- }
-
- cbdata.dtp = dtp;
- cbdata.dtt = dtt;
- cbdata.name = "";
- cbdata.addr = addr;
- cbdata.addrend = addr + nbytes;
- cbdata.indent = 1;
- cbdata.f_type = 1;
- cbdata.type_width = 0;
- cbdata.name_width = 0;
- cbdata.fp = fp;
-
- return (dt_print_type_data(&cbdata, dtt.dtt_type));
-}
-
static int
dt_print_sym(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
{
@@ -1764,7 +1430,7 @@ dt_print_datum(dtrace_hdl_t *dtp, FILE *fp, dtrace_recdesc_t *rec,
(uint32_t)normal);
break;
default:
- err = dt_print_bytes(dtp, fp, addr, size, 50, 0, 0);
+ err = dt_print_bytes(dtp, fp, addr, size, 50, 0);
break;
}
@@ -2139,18 +1805,6 @@ again:
goto nextrec;
}
- if (act == DTRACEACT_PRINTM) {
- if (dt_print_memory(dtp, fp, addr) < 0)
- return (-1);
- goto nextrec;
- }
-
- if (act == DTRACEACT_PRINTT) {
- if (dt_print_type(dtp, fp, addr) < 0)
- return (-1);
- goto nextrec;
- }
-
if (DTRACEACT_ISPRINTFLIKE(act)) {
void *fmtdata;
int (*func)(dtrace_hdl_t *, FILE *, void *,
@@ -2281,7 +1935,7 @@ nofmt:
break;
default:
n = dt_print_bytes(dtp, fp, addr,
- rec->dtrd_size, 33, quiet, 0);
+ rec->dtrd_size, 33, quiet);
break;
}
@@ -2410,20 +2064,13 @@ dt_consume_begin(dtrace_hdl_t *dtp, FILE *fp, dtrace_bufdesc_t *buf,
dt_begin_t begin;
processorid_t cpu = dtp->dt_beganon;
dtrace_bufdesc_t nbuf;
-#if !defined(sun)
- dtrace_bufdesc_t *pbuf;
-#endif
int rval, i;
static int max_ncpus;
dtrace_optval_t size;
dtp->dt_beganon = -1;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
-#endif
/*
* We really don't expect this to fail, but it is at least
* technically possible for this to fail with ENOENT. In this
@@ -2485,12 +2132,7 @@ dt_consume_begin(dtrace_hdl_t *dtp, FILE *fp, dtrace_bufdesc_t *buf,
if (i == cpu)
continue;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &nbuf) == -1) {
-#else
- pbuf = &nbuf;
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &pbuf) == -1) {
-#endif
/*
* If we failed with ENOENT, it may be because the
* CPU was unconfigured -- this is okay. Any other
@@ -2597,11 +2239,7 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
if (dtp->dt_stopped && (i == dtp->dt_endedon))
continue;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
-#endif
/*
* If we failed with ENOENT, it may be because the
* CPU was unconfigured -- this is okay. Any other
@@ -2622,11 +2260,7 @@ dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
buf->dtbd_cpu = dtp->dt_endedon;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &buf) == -1) {
-#endif
/*
* This _really_ shouldn't fail, but it is strictly speaking
* possible for this to return ENOENT if the CPU that called
diff --git a/lib/libdtrace/common/dt_dof.c b/lib/libdtrace/common/dt_dof.c
index f35a386c5d7d..075001157618 100644
--- a/lib/libdtrace/common/dt_dof.c
+++ b/lib/libdtrace/common/dt_dof.c
@@ -27,14 +27,10 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
-#if defined(sun)
#include <sys/sysmacros.h>
-#endif
#include <strings.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
diff --git a/lib/libdtrace/common/dt_error.c b/lib/libdtrace/common/dt_error.c
index 263f70c85ecc..5005f593a43d 100644
--- a/lib/libdtrace/common/dt_error.c
+++ b/lib/libdtrace/common/dt_error.c
@@ -25,7 +25,6 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include <string.h>
#include <strings.h>
#include <dt_impl.h>
@@ -139,29 +138,12 @@ dtrace_errno(dtrace_hdl_t *dtp)
return (dtp->dt_errno);
}
-#if defined(sun)
int
dt_set_errno(dtrace_hdl_t *dtp, int err)
{
dtp->dt_errno = err;
return (-1);
}
-#else
-int
-_dt_set_errno(dtrace_hdl_t *dtp, int err, const char *errfile, int errline)
-{
- dtp->dt_errno = err;
- dtp->dt_errfile = errfile;
- dtp->dt_errline = errline;
- return (-1);
-}
-
-void dt_get_errloc(dtrace_hdl_t *dtp, const char **p_errfile, int *p_errline)
-{
- *p_errfile = dtp->dt_errfile;
- *p_errline = dtp->dt_errline;
-}
-#endif
void
dt_set_errmsg(dtrace_hdl_t *dtp, const char *errtag, const char *region,
diff --git a/lib/libdtrace/common/dt_errtags.h b/lib/libdtrace/common/dt_errtags.h
index 62f955505711..9e32dfdf2492 100644
--- a/lib/libdtrace/common/dt_errtags.h
+++ b/lib/libdtrace/common/dt_errtags.h
@@ -235,11 +235,7 @@ typedef enum {
D_FREOPEN_INVALID, /* frename() filename is invalid */
D_LQUANT_MATCHBASE, /* lquantize() mismatch on base */
D_LQUANT_MATCHLIM, /* lquantize() mismatch on limit */
- D_LQUANT_MATCHSTEP, /* lquantize() mismatch on step */
- D_PRINTM_ADDR, /* printm() memref bad type */
- D_PRINTM_SIZE, /* printm() size bad type */
- D_PRINTT_ADDR, /* printt() typeref bad type */
- D_PRINTT_SIZE /* printt() size bad type */
+ D_LQUANT_MATCHSTEP /* lquantize() mismatch on step */
} dt_errtag_t;
extern const char *dt_errtag(dt_errtag_t);
diff --git a/lib/libdtrace/common/dt_handle.c b/lib/libdtrace/common/dt_handle.c
index ea039e993bd2..9d27aee4ded2 100644
--- a/lib/libdtrace/common/dt_handle.c
+++ b/lib/libdtrace/common/dt_handle.c
@@ -31,9 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include <assert.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <dt_impl.h>
#include <dt_program.h>
@@ -249,7 +247,7 @@ dt_handle_liberr(dtrace_hdl_t *dtp, const dtrace_probedata_t *data,
err.dteda_action = -1;
err.dteda_offset = -1;
err.dteda_fault = DTRACEFLT_LIBRARY;
- err.dteda_addr = 0;
+ err.dteda_addr = NULL;
len = strlen(faultstr) +
strlen(errpd->dtpd_provider) + strlen(errpd->dtpd_mod) +
diff --git a/lib/libdtrace/common/dt_ident.c b/lib/libdtrace/common/dt_ident.c
index 13adbb45e1a7..c437e0ab031a 100644
--- a/lib/libdtrace/common/dt_ident.c
+++ b/lib/libdtrace/common/dt_ident.c
@@ -26,20 +26,14 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#if defined(sun)
#include <sys/sysmacros.h>
-#endif
#include <strings.h>
#include <stdlib.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <assert.h>
#include <errno.h>
#include <ctype.h>
-#if defined(sun)
#include <sys/procfs_isa.h>
-#endif
#include <limits.h>
#include <dt_ident.h>
diff --git a/lib/libdtrace/common/dt_impl.h b/lib/libdtrace/common/dt_impl.h
index 6bcc5bc49ab0..2454e3b7cd02 100644
--- a/lib/libdtrace/common/dt_impl.h
+++ b/lib/libdtrace/common/dt_impl.h
@@ -18,7 +18,6 @@
*
* CDDL HEADER END
*/
-
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -31,13 +30,6 @@
#include <sys/param.h>
#include <sys/objfs.h>
-#if !defined(sun)
-#include <sys/bitmap.h>
-#include <sys/utsname.h>
-#include <sys/ioccom.h>
-#include <sys/time.h>
-#include <string.h>
-#endif
#include <setjmp.h>
#include <libctf.h>
#include <dtrace.h>
@@ -135,9 +127,6 @@ typedef struct dt_module {
GElf_Addr dm_bss_va; /* virtual address of BSS */
GElf_Xword dm_bss_size; /* size in bytes of BSS */
dt_idhash_t *dm_extern; /* external symbol definitions */
-#if !defined(sun)
- caddr_t dm_reloc_offset; /* Symbol relocation offset. */
-#endif
} dt_module_t;
#define DT_DM_LOADED 0x1 /* module symbol and type data is loaded */
@@ -194,7 +183,6 @@ typedef struct dt_lib_depend {
char *dtld_libpath; /* library pathname */
uint_t dtld_finish; /* completion time in tsort for lib */
uint_t dtld_start; /* starting time in tsort for lib */
- uint_t dtld_loaded; /* boolean: is this library loaded */
dt_list_t dtld_dependencies; /* linked-list of lib dependencies */
dt_list_t dtld_dependents; /* linked-list of lib dependents */
} dt_lib_depend_t;
@@ -277,20 +265,12 @@ struct dtrace_hdl {
int dt_version; /* library version requested by client */
int dt_ctferr; /* error resulting from last CTF failure */
int dt_errno; /* error resulting from last failed operation */
-#if !defined(sun)
- const char *dt_errfile;
- int dt_errline;
-#endif
int dt_fd; /* file descriptor for dtrace pseudo-device */
int dt_ftfd; /* file descriptor for fasttrap pseudo-device */
int dt_fterr; /* saved errno from failed open of dt_ftfd */
int dt_cdefs_fd; /* file descriptor for C CTF debugging cache */
int dt_ddefs_fd; /* file descriptor for D CTF debugging cache */
-#if defined(sun)
int dt_stdout_fd; /* file descriptor for saved stdout */
-#else
- FILE *dt_freopen_fp; /* file pointer for freopened stdout */
-#endif
dtrace_handle_err_f *dt_errhdlr; /* error handler, if any */
void *dt_errarg; /* error handler argument */
dtrace_prog_t *dt_errprog; /* error handler program, if any */
@@ -432,8 +412,6 @@ struct dtrace_hdl {
#define DT_ACT_UMOD DT_ACT(26) /* umod() action */
#define DT_ACT_UADDR DT_ACT(27) /* uaddr() action */
#define DT_ACT_SETOPT DT_ACT(28) /* setopt() action */
-#define DT_ACT_PRINTM DT_ACT(29) /* printm() action */
-#define DT_ACT_PRINTT DT_ACT(30) /* printt() action */
/*
* Sentinel to tell freopen() to restore the saved stdout. This must not
@@ -561,21 +539,11 @@ extern int dt_version_defined(dt_version_t);
extern char *dt_cpp_add_arg(dtrace_hdl_t *, const char *);
extern char *dt_cpp_pop_arg(dtrace_hdl_t *);
-#if defined(sun)
extern int dt_set_errno(dtrace_hdl_t *, int);
-#else
-int _dt_set_errno(dtrace_hdl_t *, int, const char *, int);
-void dt_get_errloc(dtrace_hdl_t *, const char **, int *);
-#define dt_set_errno(_a,_b) _dt_set_errno(_a,_b,__FILE__,__LINE__)
-#endif
extern void dt_set_errmsg(dtrace_hdl_t *, const char *, const char *,
const char *, int, const char *, va_list);
-#if defined(sun)
extern int dt_ioctl(dtrace_hdl_t *, int, void *);
-#else
-extern int dt_ioctl(dtrace_hdl_t *, u_long, void *);
-#endif
extern int dt_status(dtrace_hdl_t *, processorid_t);
extern long dt_sysconf(dtrace_hdl_t *, int);
extern ssize_t dt_write(dtrace_hdl_t *, int, const void *, size_t);
diff --git a/lib/libdtrace/common/dt_lex.l b/lib/libdtrace/common/dt_lex.l
index 48975274dede..fc74df15e0a6 100644
--- a/lib/libdtrace/common/dt_lex.l
+++ b/lib/libdtrace/common/dt_lex.l
@@ -41,32 +41,12 @@
* We need to undefine lex's input and unput macros so that references to these
* call the functions provided at the end of this source file.
*/
-#if defined(sun)
#undef input
#undef unput
-#else
-/*
- * Define YY_INPUT for flex since input() can't be re-defined.
- */
-#define YY_INPUT(buf,result,max_size) \
- if (yypcb->pcb_fileptr != NULL) { \
- if (((result = fread(buf, 1, max_size, yypcb->pcb_fileptr)) == 0) \
- && ferror(yypcb->pcb_fileptr)) \
- longjmp(yypcb->pcb_jmpbuf, EDT_FIO); \
- } else { \
- int n; \
- for (n = 0; n < max_size && \
- yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen; n++) \
- buf[n] = *yypcb->pcb_strptr++; \
- result = n; \
- }
-#endif
static int id_or_type(const char *);
-#if defined(sun)
static int input(void);
static void unput(int);
-#endif
/*
* We first define a set of labeled states for use in the D lexer and then a
@@ -428,7 +408,7 @@ if (yypcb->pcb_token != 0) {
xyerror(D_CHR_OFLOW, "character constant is "
"too long");
}
-#if BYTE_ORDER == _LITTLE_ENDIAN
+#ifdef _LITTLE_ENDIAN
p = ((char *)&yylval.l_int) + nbytes - 1;
for (q = s; nbytes != 0; nbytes--)
*p-- = *q++;
@@ -717,9 +697,7 @@ yyinit(dt_pcb_t *pcb)
yypcb = pcb;
yylineno = 1;
yypragma = NULL;
-#if defined(sun)
yysptr = yysbuf;
-#endif
}
/*
@@ -815,7 +793,6 @@ id_or_type(const char *s)
return (ttok);
}
-#if defined(sun)
static int
input(void)
{
@@ -857,4 +834,3 @@ unput(int c)
*yysptr++ = c;
yytchar = c;
}
-#endif
diff --git a/lib/libdtrace/common/dt_link.c b/lib/libdtrace/common/dt_link.c
index bc46df577a27..957d8f8bc3df 100644
--- a/lib/libdtrace/common/dt_link.c
+++ b/lib/libdtrace/common/dt_link.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -30,28 +30,18 @@
#include <elf.h>
#include <sys/types.h>
-#if defined(sun)
#include <sys/sysmacros.h>
-#else
-#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
-#endif
#include <unistd.h>
#include <strings.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
-#if defined(sun)
#include <wait.h>
-#else
-#include <sys/wait.h>
-#endif
#include <assert.h>
#include <sys/ipc.h>
@@ -224,23 +214,11 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf32_t *dep)
s = &dofs[dofrh->dofr_tgtsec];
for (j = 0; j < nrel; j++) {
-#if defined(__arm__)
-/* XXX */
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#elif defined(__ia64__)
-/* XXX */
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#elif defined(__i386) || defined(__amd64)
+#if defined(__i386) || defined(__amd64)
rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset;
rel->r_info = ELF32_R_INFO(count + dep->de_global,
R_386_32);
-#elif defined(__mips__)
-/* XXX */
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#elif defined(__powerpc__)
-/* XXX */
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
#elif defined(__sparc)
/*
* Add 4 bytes to hit the low half of this 64-bit
@@ -412,17 +390,7 @@ prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
s = &dofs[dofrh->dofr_tgtsec];
for (j = 0; j < nrel; j++) {
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
-#if defined(__arm__)
-/* XXX */
-#elif defined(__ia64__)
-/* XXX */
-#elif defined(__mips__)
-/* XXX */
-#elif defined(__powerpc__)
-/* XXX */
-#elif defined(__i386) || defined(__amd64)
+#if defined(__i386) || defined(__amd64)
rel->r_offset = s->dofs_offset +
dofr[j].dofr_offset;
rel->r_info = ELF64_R_INFO(count + dep->de_global,
@@ -435,7 +403,6 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
#else
#error unknown ISA
#endif
-#endif
sym->st_name = base + dofr[j].dofr_name - 1;
sym->st_value = 0;
@@ -513,24 +480,13 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3;
elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT;
elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS32;
-#if BYTE_ORDER == _BIG_ENDIAN
+#if defined(_BIG_ENDIAN)
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
-#else
+#elif defined(_LITTLE_ENDIAN)
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
#endif
-#if defined(__FreeBSD__)
- elf_file.ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#endif
elf_file.ehdr.e_type = ET_REL;
-#if defined(__arm__)
- elf_file.ehdr.e_machine = EM_ARM;
-#elif defined(__ia64__)
- elf_file.ehdr.e_machine = EM_IA_64;
-#elif defined(__mips__)
- elf_file.ehdr.e_machine = EM_MIPS;
-#elif defined(__powerpc__)
- elf_file.ehdr.e_machine = EM_PPC;
-#elif defined(__sparc)
+#if defined(__sparc)
elf_file.ehdr.e_machine = EM_SPARC;
#elif defined(__i386) || defined(__amd64)
elf_file.ehdr.e_machine = EM_386;
@@ -661,24 +617,13 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3;
elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT;
elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS64;
-#if BYTE_ORDER == _BIG_ENDIAN
+#if defined(_BIG_ENDIAN)
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
-#else
+#elif defined(_LITTLE_ENDIAN)
elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
#endif
-#if defined(__FreeBSD__)
- elf_file.ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
-#endif
elf_file.ehdr.e_type = ET_REL;
-#if defined(__arm__)
- elf_file.ehdr.e_machine = EM_ARM;
-#elif defined(__ia64__)
- elf_file.ehdr.e_machine = EM_IA_64;
-#elif defined(__mips__)
- elf_file.ehdr.e_machine = EM_MIPS;
-#elif defined(__powerpc__)
- elf_file.ehdr.e_machine = EM_PPC;
-#elif defined(__sparc)
+#if defined(__sparc)
elf_file.ehdr.e_machine = EM_SPARCV9;
#elif defined(__i386) || defined(__amd64)
elf_file.ehdr.e_machine = EM_AMD64;
@@ -794,44 +739,7 @@ dt_symtab_lookup(Elf_Data *data_sym, int nsym, uintptr_t addr, uint_t shn,
return (ret);
}
-#if defined(__arm__)
-/* XXX */
-static int
-dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
- uint32_t *off)
-{
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
- return (0);
-}
-#elif defined(__ia64__)
-/* XXX */
-static int
-dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
- uint32_t *off)
-{
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
- return (0);
-}
-#elif defined(__mips__)
-/* XXX */
-static int
-dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
- uint32_t *off)
-{
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
- return (0);
-}
-#elif defined(__powerpc__)
-/* XXX */
-static int
-dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
- uint32_t *off)
-{
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
- return (0);
-}
-
-#elif defined(__sparc)
+#if defined(__sparc)
#define DT_OP_RET 0x81c7e008
#define DT_OP_NOP 0x01000000
@@ -942,9 +850,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
#elif defined(__i386) || defined(__amd64)
#define DT_OP_NOP 0x90
-#define DT_OP_RET 0xc3
#define DT_OP_CALL 0xe8
-#define DT_OP_JMP32 0xe9
#define DT_OP_REX_RAX 0x48
#define DT_OP_XOR_EAX_0 0x33
#define DT_OP_XOR_EAX_1 0xc0
@@ -954,7 +860,6 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
uint32_t *off)
{
uint8_t *ip = (uint8_t *)(p + rela->r_offset - 1);
- uint8_t ret;
/*
* On x86, the first byte of the instruction is the call opcode and
@@ -978,43 +883,38 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
* We may have already processed this object file in an earlier linker
* invocation. Check to see if the present instruction sequence matches
* the one we would install. For is-enabled probes, we advance the
- * offset to the first nop instruction in the sequence to match the
- * text modification code below.
+ * offset to the first nop instruction in the sequence.
*/
if (!isenabled) {
- if ((ip[0] == DT_OP_NOP || ip[0] == DT_OP_RET) &&
- ip[1] == DT_OP_NOP && ip[2] == DT_OP_NOP &&
- ip[3] == DT_OP_NOP && ip[4] == DT_OP_NOP)
+ if (ip[0] == DT_OP_NOP && ip[1] == DT_OP_NOP &&
+ ip[2] == DT_OP_NOP && ip[3] == DT_OP_NOP &&
+ ip[4] == DT_OP_NOP)
return (0);
} else if (dtp->dt_oflags & DTRACE_O_LP64) {
if (ip[0] == DT_OP_REX_RAX &&
ip[1] == DT_OP_XOR_EAX_0 && ip[2] == DT_OP_XOR_EAX_1 &&
- (ip[3] == DT_OP_NOP || ip[3] == DT_OP_RET) &&
- ip[4] == DT_OP_NOP) {
+ ip[3] == DT_OP_NOP && ip[4] == DT_OP_NOP) {
(*off) += 3;
return (0);
}
} else {
if (ip[0] == DT_OP_XOR_EAX_0 && ip[1] == DT_OP_XOR_EAX_1 &&
- (ip[2] == DT_OP_NOP || ip[2] == DT_OP_RET) &&
- ip[3] == DT_OP_NOP && ip[4] == DT_OP_NOP) {
+ ip[2] == DT_OP_NOP && ip[3] == DT_OP_NOP &&
+ ip[4] == DT_OP_NOP) {
(*off) += 2;
return (0);
}
}
/*
- * We expect either a call instrution with a 32-bit displacement or a
- * jmp instruction with a 32-bit displacement acting as a tail-call.
+ * We only expect a call instrution with a 32-bit displacement.
*/
- if (ip[0] != DT_OP_CALL && ip[0] != DT_OP_JMP32) {
- dt_dprintf("found %x instead of a call or jmp instruction at "
- "%llx\n", ip[0], (u_longlong_t)rela->r_offset);
+ if (ip[0] != DT_OP_CALL) {
+ dt_dprintf("found %x instead of a call instruction at %llx\n",
+ ip[0], (u_longlong_t)rela->r_offset);
return (-1);
}
- ret = (ip[0] == DT_OP_JMP32) ? DT_OP_RET : DT_OP_NOP;
-
/*
* Establish the instruction sequence -- all nops for probes, and an
* instruction to clear the return value register (%eax/%rax) followed
@@ -1023,7 +923,7 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
* for more readable disassembly when the probe is enabled.
*/
if (!isenabled) {
- ip[0] = ret;
+ ip[0] = DT_OP_NOP;
ip[1] = DT_OP_NOP;
ip[2] = DT_OP_NOP;
ip[3] = DT_OP_NOP;
@@ -1032,13 +932,13 @@ dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
ip[0] = DT_OP_REX_RAX;
ip[1] = DT_OP_XOR_EAX_0;
ip[2] = DT_OP_XOR_EAX_1;
- ip[3] = ret;
+ ip[3] = DT_OP_NOP;
ip[4] = DT_OP_NOP;
(*off) += 3;
} else {
ip[0] = DT_OP_XOR_EAX_0;
ip[1] = DT_OP_XOR_EAX_1;
- ip[2] = ret;
+ ip[2] = DT_OP_NOP;
ip[3] = DT_OP_NOP;
ip[4] = DT_OP_NOP;
(*off) += 2;
@@ -1133,13 +1033,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
if (dtp->dt_oflags & DTRACE_O_LP64) {
eclass = ELFCLASS64;
-#if defined(__ia64__)
- emachine1 = emachine2 = EM_IA_64;
-#elif defined(__mips__)
- emachine1 = emachine2 = EM_MIPS;
-#elif defined(__powerpc__)
- emachine1 = emachine2 = EM_PPC64;
-#elif defined(__sparc)
+#if defined(__sparc)
emachine1 = emachine2 = EM_SPARCV9;
#elif defined(__i386) || defined(__amd64)
emachine1 = emachine2 = EM_AMD64;
@@ -1147,16 +1041,10 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
symsize = sizeof (Elf64_Sym);
} else {
eclass = ELFCLASS32;
-#if defined(__arm__)
- emachine1 = emachine2 = EM_ARM;
-#elif defined(__mips__)
- emachine1 = emachine2 = EM_MIPS;
-#elif defined(__powerpc__)
- emachine1 = emachine2 = EM_PPC;
-#elif defined(__sparc)
+#if defined(__sparc)
emachine1 = EM_SPARC;
emachine2 = EM_SPARC32PLUS;
-#elif defined(__i386) || defined(__amd64) || defined(__ia64__)
+#elif defined(__i386) || defined(__amd64)
emachine1 = emachine2 = EM_386;
#endif
symsize = sizeof (Elf32_Sym);
@@ -1519,13 +1407,10 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
* already been processed by an earlier link
* invocation.
*/
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
if (rsym.st_shndx != SHN_SUNW_IGNORE) {
rsym.st_shndx = SHN_SUNW_IGNORE;
(void) gelf_update_sym(data_sym, ndx, &rsym);
}
-#endif
}
}
@@ -1553,9 +1438,6 @@ int
dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
const char *file, int objc, char *const objv[])
{
-#if !defined(sun)
- char tfile[PATH_MAX];
-#endif
char drti[PATH_MAX];
dof_hdr_t *dof;
int fd, status, i, cur;
@@ -1563,11 +1445,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
size_t len;
int eprobes = 0, ret = 0;
-#if !defined(sun)
- /* XXX Should get a temp file name here. */
- snprintf(tfile, sizeof(tfile), "%s.tmp", file);
-#endif
-
/*
* A NULL program indicates a special use in which we just link
* together a bunch of object files specified in objv and then
@@ -1629,7 +1506,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
if ((dof = dtrace_dof_create(dtp, pgp, dflags)) == NULL)
return (-1); /* errno is set for us */
-#if defined(sun)
/*
* Create a temporary file and then unlink it if we're going to
* combine it with drti.o later. We can still refer to it in child
@@ -1639,11 +1515,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
return (dt_link_error(dtp, NULL, -1, NULL,
"failed to open %s: %s", file, strerror(errno)));
}
-#else
- if ((fd = open(tfile, O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1)
- return (dt_link_error(dtp, NULL, -1, NULL,
- "failed to open %s: %s", tfile, strerror(errno)));
-#endif
/*
* If -xlinktype=DOF has been selected, just write out the DOF.
@@ -1673,10 +1544,8 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
}
-#if defined(sun)
if (!dtp->dt_lazyload)
(void) unlink(file);
-#endif
if (dtp->dt_oflags & DTRACE_O_LP64)
status = dump_elf64(dtp, dof, fd);
@@ -1689,7 +1558,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
}
if (!dtp->dt_lazyload) {
-#if defined(sun)
const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s";
if (dtp->dt_oflags & DTRACE_O_LP64) {
@@ -1706,37 +1574,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
cmd = alloca(len);
(void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, fd, drti);
-#else
- const char *fmt = "%s -o %s -r %s %s";
-
-#if defined(__amd64__)
- /*
- * Arches which default to 64-bit need to explicitly use
- * the 32-bit library path.
- */
- int use_32 = !(dtp->dt_oflags & DTRACE_O_LP64);
-#else
- /*
- * Arches which are 32-bit only just use the normal
- * library path.
- */
-#if defined(__i386__)
- int use_32 = 1; /* use /usr/lib/... -sson */
-#else
- int use_32 = 0;
-#endif
-#endif
-
- (void) snprintf(drti, sizeof (drti), "/usr/lib%s/dtrace/drti.o",
- use_32 ? "":"32");
-
- len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, tfile,
- drti) + 1;
-
- cmd = alloca(len);
-
- (void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, tfile, drti);
-#endif
if ((status = system(cmd)) == -1) {
ret = dt_link_error(dtp, NULL, -1, NULL,
@@ -1766,9 +1603,5 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
done:
dtrace_dof_destroy(dtp, dof);
-
-#if !defined(sun)
- unlink(tfile);
-#endif
return (ret);
}
diff --git a/lib/libdtrace/common/dt_map.c b/lib/libdtrace/common/dt_map.c
index 1c5c868bb4b0..15361862de8f 100644
--- a/lib/libdtrace/common/dt_map.c
+++ b/lib/libdtrace/common/dt_map.c
@@ -82,11 +82,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
enabled->dtepd_epid = id;
enabled->dtepd_nrecs = 1;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled) == -1) {
-#endif
rval = dt_set_errno(dtp, errno);
free(enabled);
return (rval);
@@ -106,11 +102,7 @@ dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
if ((enabled = nenabled) == NULL)
return (dt_set_errno(dtp, EDT_NOMEM));
-#if defined(sun)
rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled);
-#else
- rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, &enabled);
-#endif
if (rval == -1) {
rval = dt_set_errno(dtp, errno);
@@ -330,11 +322,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id)
agg->dtagd_id = id;
agg->dtagd_nrecs = 1;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg) == -1) {
-#else
- if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg) == -1) {
-#endif
rval = dt_set_errno(dtp, errno);
free(agg);
return (rval);
@@ -353,11 +341,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id)
if ((agg = nagg) == NULL)
return (dt_set_errno(dtp, EDT_NOMEM));
-#if defined(sun)
rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg);
-#else
- rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, &agg);
-#endif
if (rval == -1) {
rval = dt_set_errno(dtp, errno);
@@ -375,7 +359,7 @@ dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id)
* provide the compiler-generated aggregation information.
*/
if (dtp->dt_options[DTRACEOPT_GRABANON] == DTRACEOPT_UNSET &&
- agg->dtagd_rec[0].dtrd_uarg != 0) {
+ agg->dtagd_rec[0].dtrd_uarg != NULL) {
dtrace_stmtdesc_t *sdp;
dt_ident_t *aid;
diff --git a/lib/libdtrace/common/dt_module.c b/lib/libdtrace/common/dt_module.c
index af175012b3be..25197031ce11 100644
--- a/lib/libdtrace/common/dt_module.c
+++ b/lib/libdtrace/common/dt_module.c
@@ -26,23 +26,15 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
-#if defined(sun)
#include <sys/modctl.h>
#include <sys/kobj.h>
#include <sys/kobj_impl.h>
#include <sys/sysmacros.h>
#include <sys/elf.h>
#include <sys/task.h>
-#else
-#include <sys/param.h>
-#include <sys/linker.h>
-#include <sys/stat.h>
-#endif
#include <unistd.h>
-#if defined(sun)
#include <project.h>
-#endif
#include <strings.h>
#include <stdlib.h>
#include <libelf.h>
@@ -50,9 +42,6 @@
#include <assert.h>
#include <errno.h>
#include <dirent.h>
-#if !defined(sun)
-#include <fcntl.h>
-#endif
#include <dt_strtab.h>
#include <dt_module.h>
@@ -77,7 +66,7 @@ dt_module_symhash_insert(dt_module_t *dmp, const char *name, uint_t id)
static uint_t
dt_module_syminit32(dt_module_t *dmp)
{
- Elf32_Sym *sym = dmp->dm_symtab.cts_data;
+ const Elf32_Sym *sym = dmp->dm_symtab.cts_data;
const char *base = dmp->dm_strtab.cts_data;
size_t ss_size = dmp->dm_strtab.cts_size;
uint_t i, n = dmp->dm_nsymelems;
@@ -94,14 +83,9 @@ dt_module_syminit32(dt_module_t *dmp)
continue; /* skip null or invalid names */
if (sym->st_value != 0 &&
- (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) {
+ (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size))
asrsv++; /* reserve space in the address map */
-#if !defined(sun)
- sym->st_value += (Elf_Addr) dmp->dm_reloc_offset;
-#endif
- }
-
dt_module_symhash_insert(dmp, name, i);
}
@@ -111,7 +95,7 @@ dt_module_syminit32(dt_module_t *dmp)
static uint_t
dt_module_syminit64(dt_module_t *dmp)
{
- Elf64_Sym *sym = dmp->dm_symtab.cts_data;
+ const Elf64_Sym *sym = dmp->dm_symtab.cts_data;
const char *base = dmp->dm_strtab.cts_data;
size_t ss_size = dmp->dm_strtab.cts_size;
uint_t i, n = dmp->dm_nsymelems;
@@ -128,14 +112,9 @@ dt_module_syminit64(dt_module_t *dmp)
continue; /* skip null or invalid names */
if (sym->st_value != 0 &&
- (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size)) {
+ (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size))
asrsv++; /* reserve space in the address map */
-#if !defined(sun)
- sym->st_value += (Elf_Addr) dmp->dm_reloc_offset;
-#endif
- }
-
dt_module_symhash_insert(dmp, name, i);
}
@@ -510,13 +489,7 @@ dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp)
if (sp == NULL || (dp = elf_getdata(sp, NULL)) == NULL)
return (0);
-#if defined(sun)
ctsp->cts_data = dp->d_buf;
-#else
- if ((ctsp->cts_data = malloc(dp->d_size)) == NULL)
- return (0);
- memcpy(ctsp->cts_data, dp->d_buf, dp->d_size);
-#endif
ctsp->cts_size = dp->d_size;
dt_dprintf("loaded %s [%s] (%lu bytes)\n",
@@ -692,18 +665,6 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
ctf_close(dmp->dm_ctfp);
dmp->dm_ctfp = NULL;
-#if !defined(sun)
- if (dmp->dm_ctdata.cts_data != NULL) {
- free(dmp->dm_ctdata.cts_data);
- }
- if (dmp->dm_symtab.cts_data != NULL) {
- free(dmp->dm_symtab.cts_data);
- }
- if (dmp->dm_strtab.cts_data != NULL) {
- free(dmp->dm_strtab.cts_data);
- }
-#endif
-
bzero(&dmp->dm_ctdata, sizeof (ctf_sect_t));
bzero(&dmp->dm_symtab, sizeof (ctf_sect_t));
bzero(&dmp->dm_strtab, sizeof (ctf_sect_t));
@@ -729,11 +690,11 @@ dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
dmp->dm_asrsv = 0;
dmp->dm_aslen = 0;
- dmp->dm_text_va = 0;
+ dmp->dm_text_va = NULL;
dmp->dm_text_size = 0;
- dmp->dm_data_va = 0;
+ dmp->dm_data_va = NULL;
dmp->dm_data_size = 0;
- dmp->dm_bss_va = 0;
+ dmp->dm_bss_va = NULL;
dmp->dm_bss_size = 0;
if (dmp->dm_extern != NULL) {
@@ -820,16 +781,9 @@ dt_module_modelname(dt_module_t *dmp)
/*
* Update our module cache by adding an entry for the specified module 'name'.
* We create the dt_module_t and populate it using /system/object/<name>/.
- *
- * On FreeBSD, the module name is passed as the full module file name,
- * including the path.
*/
static void
-#if defined(sun)
dt_module_update(dtrace_hdl_t *dtp, const char *name)
-#else
-dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
-#endif
{
char fname[MAXPATHLEN];
struct stat64 st;
@@ -842,17 +796,8 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
Elf_Data *dp;
Elf_Scn *sp;
-#if defined(sun)
(void) snprintf(fname, sizeof (fname),
"%s/%s/object", OBJFS_ROOT, name);
-#else
- GElf_Phdr ph;
- char name[MAXPATHLEN];
- int i = 0;
-
- (void) strlcpy(name, k_stat->name, sizeof(name));
- (void) strlcpy(fname, k_stat->pathname, sizeof(fname));
-#endif
if ((fd = open(fname, O_RDONLY)) == -1 || fstat64(fd, &st) == -1 ||
(dmp = dt_module_create(dtp, name)) == NULL) {
@@ -924,23 +869,7 @@ dt_module_update(dtrace_hdl_t *dtp, struct kld_file_stat *k_stat)
}
dmp->dm_flags |= DT_DM_KERNEL;
-#if defined(sun)
dmp->dm_modid = (int)OBJFS_MODID(st.st_ino);
-#else
-#if defined(__i386__)
- /*
- * Find the first load section and figure out the relocation
- * offset for the symbols. The kernel module will not need
- * relocation, but the kernel linker modules will.
- */
- for (i = 0; gelf_getphdr(dmp->dm_elf, i, &ph) != NULL; i++) {
- if (ph.p_type == PT_LOAD) {
- dmp->dm_reloc_offset = k_stat->address - ph.p_vaddr;
- break;
- }
- }
-#endif
-#endif
if (dmp->dm_info.objfs_info_primary)
dmp->dm_flags |= DT_DM_PRIMARY;
@@ -958,15 +887,11 @@ dtrace_update(dtrace_hdl_t *dtp)
{
dt_module_t *dmp;
DIR *dirp;
-#if defined(__FreeBSD__)
- int fileid;
-#endif
for (dmp = dt_list_next(&dtp->dt_modlist);
dmp != NULL; dmp = dt_list_next(dmp))
dt_module_unload(dtp, dmp);
-#if defined(sun)
/*
* Open /system/object and attempt to create a libdtrace module for
* each kernel module that is loaded on the current system.
@@ -982,18 +907,6 @@ dtrace_update(dtrace_hdl_t *dtp)
(void) closedir(dirp);
}
-#elif defined(__FreeBSD__)
- /*
- * Use FreeBSD's kernel loader interface to discover what kernel
- * modules are loaded and create a libdtrace module for each one.
- */
- for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) {
- struct kld_file_stat k_stat;
- k_stat.version = sizeof(k_stat);
- if (kldstat(fileid, &k_stat) == 0)
- dt_module_update(dtp, &k_stat);
- }
-#endif
/*
* Look up all the macro identifiers and set di_id to the latest value.
@@ -1006,13 +919,9 @@ dtrace_update(dtrace_hdl_t *dtp)
dt_idhash_lookup(dtp->dt_macros, "pid")->di_id = getpid();
dt_idhash_lookup(dtp->dt_macros, "pgid")->di_id = getpgid(0);
dt_idhash_lookup(dtp->dt_macros, "ppid")->di_id = getppid();
-#if defined(sun)
dt_idhash_lookup(dtp->dt_macros, "projid")->di_id = getprojid();
-#endif
dt_idhash_lookup(dtp->dt_macros, "sid")->di_id = getsid(0);
-#if defined(sun)
dt_idhash_lookup(dtp->dt_macros, "taskid")->di_id = gettaskid();
-#endif
dt_idhash_lookup(dtp->dt_macros, "uid")->di_id = getuid();
/*
diff --git a/lib/libdtrace/common/dt_open.c b/lib/libdtrace/common/dt_open.c
index ec7dec090533..5c04bee77e5b 100644
--- a/lib/libdtrace/common/dt_open.c
+++ b/lib/libdtrace/common/dt_open.c
@@ -27,17 +27,13 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
-#if defined(sun)
#include <sys/modctl.h>
#include <sys/systeminfo.h>
-#endif
#include <sys/resource.h>
#include <libelf.h>
#include <strings.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
@@ -56,13 +52,6 @@
#include <dt_printf.h>
#include <dt_string.h>
#include <dt_provider.h>
-#if !defined(sun)
-#include <sys/sysctl.h>
-#include <string.h>
-#endif
-#if defined(__i386__)
-#include <ieeefp.h>
-#endif
/*
* Stability and versioning definitions. These #defines are used in the tables
@@ -114,9 +103,8 @@
#define DT_VERS_1_4_1 DT_VERSION_NUMBER(1, 4, 1)
#define DT_VERS_1_5 DT_VERSION_NUMBER(1, 5, 0)
#define DT_VERS_1_6 DT_VERSION_NUMBER(1, 6, 0)
-#define DT_VERS_1_6_1 DT_VERSION_NUMBER(1, 6, 1)
-#define DT_VERS_LATEST DT_VERS_1_6_1
-#define DT_VERS_STRING "Sun D 1.6.1"
+#define DT_VERS_LATEST DT_VERS_1_6
+#define DT_VERS_STRING "Sun D 1.6"
const dt_version_t _dtrace_versions[] = {
DT_VERS_1_0, /* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */
@@ -129,22 +117,10 @@ const dt_version_t _dtrace_versions[] = {
DT_VERS_1_4_1, /* D API 1.4.1 Solaris Express 4/07 */
DT_VERS_1_5, /* D API 1.5 Solaris Express 7/07 */
DT_VERS_1_6, /* D API 1.6 */
- DT_VERS_1_6_1, /* D API 1.6.1 */
0
};
/*
- * Global variables that are formatted on FreeBSD based on the kernel file name.
- */
-#if !defined(sun)
-static char curthread_str[MAXPATHLEN];
-static char intmtx_str[MAXPATHLEN];
-static char threadmtx_str[MAXPATHLEN];
-static char rwlock_str[MAXPATHLEN];
-static char sxlock_str[MAXPATHLEN];
-#endif
-
-/*
* Table of global identifiers. This is used to populate the global identifier
* hash when a new dtrace client open occurs. For more info see dt_ident.h.
* The global identifiers that represent functions use the dt_idops_func ops
@@ -218,11 +194,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)
&dt_idops_type, "genunix`kthread_t *" },
-#else
- &dt_idops_type, curthread_str },
-#endif
{ "ddi_pathname", DT_IDENT_FUNC, 0, DIF_SUBR_DDI_PATHNAME,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "string(void *, int64_t)" },
@@ -236,8 +208,6 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_type, "uint_t" },
{ "errno", DT_IDENT_SCALAR, 0, DIF_VAR_ERRNO, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "int" },
-{ "execargs", DT_IDENT_SCALAR, 0, DIF_VAR_EXECARGS,
- DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
{ "execname", DT_IDENT_SCALAR, 0, DIF_VAR_EXECNAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
{ "exit", DT_IDENT_ACTFUNC, 0, DT_ACT_EXIT, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -267,25 +237,15 @@ 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)
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)
DT_VERS_1_5, &dt_idops_func, "string(in6_addr_t *)" },
-#else
- DT_VERS_1_5, &dt_idops_func, "string(struct in6_addr *)" },
-#endif
{ "inet_ntop", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOP, DT_ATTR_STABCMN,
DT_VERS_1_5, &dt_idops_func, "string(int, void *)" },
{ "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uint_t" },
-#if defined(sun)
{ "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "stack(...)" },
-#endif
{ "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "string(int64_t)" },
{ "lquantize", DT_IDENT_AGGFUNC, 0, DTRACEAGG_LQUANTIZE,
@@ -293,8 +253,6 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@, int32_t, int32_t, ...)" },
{ "max", DT_IDENT_AGGFUNC, 0, DTRACEAGG_MAX, DT_ATTR_STABCMN, DT_VERS_1_0,
&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)" },
{ "min", DT_IDENT_AGGFUNC, 0, DTRACEAGG_MIN, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@)" },
{ "mod", DT_IDENT_ACTFUNC, 0, DT_ACT_MOD, DT_ATTR_STABCMN,
@@ -305,7 +263,6 @@ 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)
{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`kmutex_t *)" },
@@ -318,20 +275,6 @@ static const dt_ident_t _dtrace_globals[] = {
{ "mutex_type_spin", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_TYPE_SPIN,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`kmutex_t *)" },
-#else
-{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, intmtx_str },
-{ "mutex_owner", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNER,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, threadmtx_str },
-{ "mutex_type_adaptive", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_TYPE_ADAPTIVE,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, intmtx_str },
-{ "mutex_type_spin", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_TYPE_SPIN,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, intmtx_str },
-#endif
{ "ntohl", DT_IDENT_FUNC, 0, DIF_SUBR_NTOHL, DT_ATTR_EVOLCMN, DT_VERS_1_3,
&dt_idops_func, "uint32_t(uint32_t)" },
{ "ntohll", DT_IDENT_FUNC, 0, DIF_SUBR_NTOHLL, DT_ATTR_EVOLCMN, DT_VERS_1_3,
@@ -350,10 +293,6 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@, ...)" },
{ "printf", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTF, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_func, "void(@, ...)" },
-{ "printm", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTM, DT_ATTR_STABCMN, DT_VERS_1_0,
- &dt_idops_func, "void(size_t, uintptr_t *)" },
-{ "printt", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTT, DT_ATTR_STABCMN, DT_VERS_1_0,
- &dt_idops_func, "void(size_t, uintptr_t *)" },
{ "probefunc", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEFUNC,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
{ "probemod", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEMOD,
@@ -374,7 +313,6 @@ 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)
{ "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`krwlock_t *)" },
@@ -384,17 +322,6 @@ static const dt_ident_t _dtrace_globals[] = {
{ "rw_write_held", DT_IDENT_FUNC, 0, DIF_SUBR_RW_WRITE_HELD,
DT_ATTR_EVOLCMN, DT_VERS_1_0,
&dt_idops_func, "int(genunix`krwlock_t *)" },
-#else
-{ "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, rwlock_str },
-{ "rw_read_held", DT_IDENT_FUNC, 0, DIF_SUBR_RW_READ_HELD,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, rwlock_str },
-{ "rw_write_held", DT_IDENT_FUNC, 0, DIF_SUBR_RW_WRITE_HELD,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, rwlock_str },
-#endif
{ "self", DT_IDENT_PTR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "void" },
{ "setopt", DT_IDENT_ACTFUNC, 0, DT_ACT_SETOPT, DT_ATTR_STABCMN,
@@ -430,17 +357,6 @@ 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)
-{ "sx_isexclusive", DT_IDENT_FUNC, 0, DIF_SUBR_SX_ISEXCLUSIVE,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, sxlock_str },
-{ "sx_shared_held", DT_IDENT_FUNC, 0, DIF_SUBR_SX_SHARED_HELD,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, sxlock_str },
-{ "sx_exclusive_held", DT_IDENT_FUNC, 0, DIF_SUBR_SX_EXCLUSIVE_HELD,
- DT_ATTR_EVOLCMN, DT_VERS_1_0,
- &dt_idops_func, sxlock_str },
-#endif
{ "sym", DT_IDENT_ACTFUNC, 0, DT_ACT_SYM, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_symaddr(uintptr_t)" },
{ "system", DT_IDENT_ACTFUNC, 0, DT_ACT_SYSTEM, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -459,19 +375,14 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_func, "void(@, size_t)" },
{ "trunc", DT_IDENT_ACTFUNC, 0, DT_ACT_TRUNC, DT_ATTR_STABCMN,
DT_VERS_1_0, &dt_idops_func, "void(...)" },
-{ "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1,
- &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" },
-#if defined(sun)
{ "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
{ "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_type, "uint64_t" },
{ "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
-#endif
{ "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uid_t" },
-#if defined(sun)
{ "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
{ "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -483,17 +394,14 @@ static const dt_ident_t _dtrace_globals[] = {
&dt_idops_type, "uint32_t" },
{ "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
-#endif
{ "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "uint64_t" },
{ "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP,
DT_ATTR_STABCMN, DT_VERS_1_0,
&dt_idops_type, "int64_t" },
-#if defined(sun)
{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
-#endif
{ NULL, 0, 0, 0, { 0, 0, 0 }, 0, NULL, NULL }
};
@@ -733,20 +641,11 @@ const dtrace_pattr_t _dtrace_prvdesc = {
{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
};
-#if defined(sun)
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
-const char *_dtrace_defcpp = "cpp"; /* default cpp(1) to invoke */
-const char *_dtrace_defld = "ld"; /* default ld(1) to invoke */
-#endif
const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */
-#if defined(sun)
const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */
-#else
-const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */
-#endif
int _dtrace_strbuckets = 211; /* default number of hash buckets (prime) */
int _dtrace_intbuckets = 256; /* default number of integer buckets (Pof2) */
@@ -759,9 +658,7 @@ int _dtrace_argmax = 32; /* default maximum number of probe arguments */
int _dtrace_debug = 0; /* debug messages enabled (off) */
const char *const _dtrace_version = DT_VERS_STRING; /* API version string */
-#if defined(sun)
int _dtrace_rdvers = RD_VERSION; /* rtld_db feature version */
-#endif
typedef struct dt_fdlist {
int *df_fds; /* array of provider driver file descriptors */
@@ -769,26 +666,16 @@ typedef struct dt_fdlist {
uint_t df_size; /* size of df_fds[] */
} dt_fdlist_t;
-#if defined(sun)
#pragma init(_dtrace_init)
-#else
-void _dtrace_init(void) __attribute__ ((constructor));
-#endif
void
_dtrace_init(void)
{
_dtrace_debug = getenv("DTRACE_DEBUG") != NULL;
-#if defined(sun)
for (; _dtrace_rdvers > 0; _dtrace_rdvers--) {
if (rd_init(_dtrace_rdvers) == RD_OK)
break;
}
-#endif
-#if defined(__i386__)
- /* make long doubles 64 bits -sson */
- (void) fpsetprec(FP_PE);
-#endif
}
static dtrace_hdl_t *
@@ -806,10 +693,9 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
{
dt_provmod_t *prov;
char path[PATH_MAX];
- int fd;
-#if defined(sun)
struct dirent *dp, *ep;
DIR *dirp;
+ int fd;
if ((dirp = opendir(_dtrace_provdir)) == NULL)
return; /* failed to open directory; just skip it */
@@ -854,92 +740,6 @@ dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
}
(void) closedir(dirp);
-#else
- char *p;
- char *p1;
- char *p_providers = NULL;
- int error;
- size_t len = 0;
-
- /*
- * Loop to allocate/reallocate memory for the string of provider
- * names and retry:
- */
- while(1) {
- /*
- * The first time around, get the string length. The next time,
- * hopefully we've allocated enough memory.
- */
- error = sysctlbyname("debug.dtrace.providers",p_providers,&len,NULL,0);
- if (len == 0)
- /* No providers? That's strange. Where's dtrace? */
- break;
- else if (error == 0 && p_providers == NULL) {
- /*
- * Allocate the initial memory which should be enough
- * unless another provider loads before we have
- * time to go back and get the string.
- */
- if ((p_providers = malloc(len)) == NULL)
- /* How do we report errors here? */
- return;
- } else if (error == -1 && errno == ENOMEM) {
- /*
- * The current buffer isn't large enough, so
- * reallocate it. We normally won't need to do this
- * because providers aren't being loaded all the time.
- */
- if ((p = realloc(p_providers,len)) == NULL)
- /* How do we report errors here? */
- return;
- p_providers = p;
- } else
- break;
- }
-
- /* Check if we got a string of provider names: */
- if (error == 0 && len > 0 && p_providers != NULL) {
- p = p_providers;
-
- /*
- * Parse the string containing the space separated
- * provider names.
- */
- while ((p1 = strsep(&p," ")) != NULL) {
- if (dfp->df_ents == dfp->df_size) {
- uint_t size = dfp->df_size ? dfp->df_size * 2 : 16;
- int *fds = realloc(dfp->df_fds, size * sizeof (int));
-
- if (fds == NULL)
- break;
-
- dfp->df_fds = fds;
- dfp->df_size = size;
- }
-
- (void) snprintf(path, sizeof (path), "/dev/dtrace/%s", p1);
-
- if ((fd = open(path, O_RDONLY)) == -1)
- continue; /* failed to open driver; just skip it */
-
- if (((prov = malloc(sizeof (dt_provmod_t))) == NULL) ||
- (prov->dp_name = malloc(strlen(p1) + 1)) == NULL) {
- free(prov);
- (void) close(fd);
- break;
- }
-
- (void) strcpy(prov->dp_name, p1);
- prov->dp_next = *provmod;
- *provmod = prov;
-
- dt_dprintf("opened provider %s\n", p1);
- dfp->df_fds[dfp->df_ents++] = fd;
- }
- }
- if (p_providers != NULL)
- free(p_providers);
-#endif
}
static void
@@ -956,7 +756,6 @@ dt_provmod_destroy(dt_provmod_t **provmod)
*provmod = NULL;
}
-#if defined(sun)
static const char *
dt_get_sysinfo(int cmd, char *buf, size_t len)
{
@@ -971,7 +770,6 @@ dt_get_sysinfo(int cmd, char *buf, size_t len)
return (buf);
}
-#endif
static dtrace_hdl_t *
dt_vopen(int version, int flags, int *errp,
@@ -1059,11 +857,7 @@ dt_vopen(int version, int flags, int *errp,
dtfd = open("/dev/dtrace/dtrace", O_RDWR);
err = errno; /* save errno from opening dtfd */
-#if defined(sun)
ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
-#else
- ftfd = open("/dev/dtrace/fasttrap", O_RDWR);
-#endif
fterr = ftfd == -1 ? errno : 0; /* save errno from open ftfd */
while (df.df_ents-- != 0)
@@ -1112,11 +906,7 @@ alloc:
dtp->dt_fterr = fterr;
dtp->dt_cdefs_fd = -1;
dtp->dt_ddefs_fd = -1;
-#if defined(sun)
dtp->dt_stdout_fd = -1;
-#else
- dtp->dt_freopen_fp = NULL;
-#endif
dtp->dt_modbuckets = _dtrace_strbuckets;
dtp->dt_mods = calloc(dtp->dt_modbuckets, sizeof (dt_module_t *));
dtp->dt_provbuckets = _dtrace_strbuckets;
@@ -1144,7 +934,6 @@ alloc:
dtp->dt_cpp_argv[0] = (char *)strbasename(dtp->dt_cpp_path);
-#if defined(sun)
(void) snprintf(isadef, sizeof (isadef), "-D__SUNW_D_%u",
(uint_t)(sizeof (void *) * NBBY));
@@ -1159,7 +948,6 @@ alloc:
dt_cpp_add_arg(dtp, isadef) == NULL ||
dt_cpp_add_arg(dtp, utsdef) == NULL)
return (set_open_errno(dtp, errp, EDT_NOMEM));
-#endif
if (flags & DTRACE_O_NODEV)
bcopy(&_dtrace_conf, &dtp->dt_conf, sizeof (_dtrace_conf));
@@ -1184,7 +972,6 @@ alloc:
return (set_open_errno(dtp, errp, EDT_NOMEM));
#endif
-#if defined(sun)
#ifdef __x86
/*
* On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit
@@ -1199,17 +986,6 @@ alloc:
return (set_open_errno(dtp, errp, EDT_NOMEM));
}
#endif
-#else
-#if defined(__amd64__) || defined(__i386__)
- if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64) {
- if (dt_cpp_add_arg(dtp, "-m64") == NULL)
- return (set_open_errno(dtp, errp, EDT_NOMEM));
- } else {
- if (dt_cpp_add_arg(dtp, "-m32") == NULL)
- return (set_open_errno(dtp, errp, EDT_NOMEM));
- }
-#endif
-#endif
if (dtp->dt_conf.dtc_difversion < DIF_VERSION)
return (set_open_errno(dtp, errp, EDT_DIFVERS));
@@ -1219,38 +995,6 @@ alloc:
else
bcopy(_dtrace_ints_64, dtp->dt_ints, sizeof (_dtrace_ints_64));
- /*
- * On FreeBSD the kernel module name can't be hard-coded. The
- * 'kern.bootfile' sysctl value tells us exactly which file is being
- * used as the kernel.
- */
-#if !defined(sun)
- {
- char bootfile[MAXPATHLEN];
- char *p;
- int i;
- size_t len = sizeof(bootfile);
-
- /* This call shouldn't fail, but use a default just in case. */
- if (sysctlbyname("kern.bootfile", bootfile, &len, NULL, 0) != 0)
- strlcpy(bootfile, "kernel", sizeof(bootfile));
-
- if ((p = strrchr(bootfile, '/')) != NULL)
- p++;
- else
- p = bootfile;
-
- /*
- * Format the global variables based on the kernel module name.
- */
- snprintf(curthread_str, sizeof(curthread_str), "%s`struct thread *",p);
- snprintf(intmtx_str, sizeof(intmtx_str), "int(%s`struct mtx *)",p);
- snprintf(threadmtx_str, sizeof(threadmtx_str), "struct thread *(%s`struct mtx *)",p);
- snprintf(rwlock_str, sizeof(rwlock_str), "int(%s`struct rwlock *)",p);
- snprintf(sxlock_str, sizeof(sxlock_str), "int(%s`struct sxlock *)",p);
- }
-#endif
-
dtp->dt_macros = dt_idhash_create("macro", NULL, 0, UINT_MAX);
dtp->dt_aggs = dt_idhash_create("aggregation", NULL,
DTRACE_AGGVARIDNONE + 1, UINT_MAX);
@@ -1547,9 +1291,6 @@ dtrace_close(dtrace_hdl_t *dtp)
dt_dirpath_t *dirp;
int i;
- if (dtp->dt_procs != NULL)
- dt_proc_hash_destroy(dtp);
-
while ((pgp = dt_list_next(&dtp->dt_programs)) != NULL)
dt_program_destroy(dtp, pgp);
@@ -1578,6 +1319,9 @@ dtrace_close(dtrace_hdl_t *dtp)
while ((pvp = dt_list_next(&dtp->dt_provlist)) != NULL)
dt_provider_destroy(dtp, pvp);
+ if (dtp->dt_procs != NULL)
+ dt_proc_hash_destroy(dtp);
+
if (dtp->dt_fd != -1)
(void) close(dtp->dt_fd);
if (dtp->dt_ftfd != -1)
@@ -1586,13 +1330,8 @@ 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)
if (dtp->dt_stdout_fd != -1)
(void) close(dtp->dt_stdout_fd);
-#else
- if (dtp->dt_freopen_fp != NULL)
- (void) fclose(dtp->dt_freopen_fp);
-#endif
dt_epid_destroy(dtp);
dt_aggid_destroy(dtp);
diff --git a/lib/libdtrace/common/dt_options.c b/lib/libdtrace/common/dt_options.c
index fa1407f83c12..5353bfae528d 100644
--- a/lib/libdtrace/common/dt_options.c
+++ b/lib/libdtrace/common/dt_options.c
@@ -35,9 +35,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <errno.h>
#include <fcntl.h>
@@ -797,12 +795,7 @@ dt_options_load(dtrace_hdl_t *dtp)
bzero(&hdr, sizeof (dof_hdr_t));
hdr.dofh_loadsz = sizeof (dof_hdr_t);
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &hdr) == -1)
-#else
- dof = &hdr;
- if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1)
-#endif
return (dt_set_errno(dtp, errno));
if (hdr.dofh_loadsz < sizeof (dof_hdr_t))
@@ -815,11 +808,7 @@ dt_options_load(dtrace_hdl_t *dtp)
for (i = 0; i < DTRACEOPT_MAX; i++)
dtp->dt_options[i] = DTRACEOPT_UNSET;
-#if defined(sun)
if (dt_ioctl(dtp, DTRACEIOC_DOFGET, dof) == -1)
-#else
- if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &dof) == -1)
-#endif
return (dt_set_errno(dtp, errno));
for (i = 0; i < dof->dofh_secnum; i++) {
@@ -923,7 +912,7 @@ static const dt_option_t _dtrace_ctoptions[] = {
{ "verbose", dt_opt_cflags, DTRACE_C_DIFV },
{ "version", dt_opt_version },
{ "zdefs", dt_opt_cflags, DTRACE_C_ZDEFS },
- { NULL, NULL, 0 }
+ { NULL }
};
/*
@@ -947,7 +936,7 @@ static const dt_option_t _dtrace_rtoptions[] = {
{ "statusrate", dt_opt_rate, DTRACEOPT_STATUSRATE },
{ "strsize", dt_opt_strsize, DTRACEOPT_STRSIZE },
{ "ustackframes", dt_opt_runtime, DTRACEOPT_USTACKFRAMES },
- { NULL, NULL, 0 }
+ { NULL }
};
/*
@@ -964,7 +953,7 @@ static const dt_option_t _dtrace_drtoptions[] = {
{ "rawbytes", dt_opt_runtime, DTRACEOPT_RAWBYTES },
{ "stackindent", dt_opt_runtime, DTRACEOPT_STACKINDENT },
{ "switchrate", dt_opt_rate, DTRACEOPT_SWITCHRATE },
- { NULL, NULL, 0 }
+ { NULL }
};
int
diff --git a/lib/libdtrace/common/dt_parser.c b/lib/libdtrace/common/dt_parser.c
index b1932866a8c4..9aabc18565db 100644
--- a/lib/libdtrace/common/dt_parser.c
+++ b/lib/libdtrace/common/dt_parser.c
@@ -100,9 +100,7 @@
#include <setjmp.h>
#include <strings.h>
#include <assert.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
diff --git a/lib/libdtrace/common/dt_pid.c b/lib/libdtrace/common/dt_pid.c
index 5640b4af053d..63463293391c 100644
--- a/lib/libdtrace/common/dt_pid.c
+++ b/lib/libdtrace/common/dt_pid.c
@@ -32,9 +32,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <libgen.h>
#include <stddef.h>
@@ -68,14 +66,10 @@ typedef struct dt_pid_probe {
static void
dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj)
{
-#if defined(sun)
if (lmid == LM_ID_BASE)
(void) strncpy(buf, obj, len);
else
(void) snprintf(buf, len, "LM%lx`%s", lmid, obj);
-#else
- (void) strncpy(buf, obj, len);
-#endif
}
static int
@@ -120,11 +114,7 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
int isdash = strcmp("-", func) == 0;
pid_t pid;
-#if defined(sun)
pid = Pstatus(pp->dpp_pr)->pr_pid;
-#else
- pid = proc_getpid(pp->dpp_pr);
-#endif
dt_dprintf("creating probe pid%d:%s:%s:%s\n", (int)pid, pp->dpp_obj,
func, pp->dpp_name);
@@ -144,7 +134,6 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
pp->dpp_obj);
if (!isdash && gmatch("return", pp->dpp_name)) {
-#ifdef DOODAD
if (dt_pid_create_return_probe(pp->dpp_pr, dtp, ftp, symp,
pp->dpp_stret) < 0) {
return (dt_pid_error(dtp, pcb, dpr, ftp,
@@ -152,20 +141,17 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
"for '%s': %s", func,
dtrace_errmsg(dtp, dtrace_errno(dtp))));
}
-#endif
nmatches++;
}
if (!isdash && gmatch("entry", pp->dpp_name)) {
-#ifdef DOODAD
if (dt_pid_create_entry_probe(pp->dpp_pr, dtp, ftp, symp) < 0) {
return (dt_pid_error(dtp, pcb, dpr, ftp,
D_PROC_CREATEFAIL, "failed to create entry probe "
"for '%s': %s", func,
dtrace_errmsg(dtp, dtrace_errno(dtp))));
}
-#endif
nmatches++;
}
@@ -184,10 +170,8 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
(u_longlong_t)off, func));
}
-#ifdef DOODAD
err = dt_pid_create_offset_probe(pp->dpp_pr, pp->dpp_dtp, ftp,
symp, off);
-#endif
if (err == DT_PROC_ERR) {
return (dt_pid_error(dtp, pcb, dpr, ftp,
@@ -205,7 +189,6 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
nmatches++;
} else if (glob && !isdash) {
-#ifdef DOODAD
if (dt_pid_create_glob_offset_probes(pp->dpp_pr,
pp->dpp_dtp, ftp, symp, pp->dpp_name) < 0) {
return (dt_pid_error(dtp, pcb, dpr, ftp,
@@ -213,7 +196,6 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
"failed to create offset probes in '%s': %s", func,
dtrace_errmsg(dtp, dtrace_errno(dtp))));
}
-#endif
nmatches++;
}
@@ -272,17 +254,13 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
if (obj == NULL)
return (0);
-#if defined(sun)
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
-#endif
-
if ((pp->dpp_obj = strrchr(obj, '/')) == NULL)
pp->dpp_obj = obj;
else
pp->dpp_obj++;
-#if defined(sun)
if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret1", &sym,
NULL) == 0)
pp->dpp_stret[0] = sym.st_value;
@@ -306,27 +284,6 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
pp->dpp_stret[3] = sym.st_value;
else
pp->dpp_stret[3] = 0;
-#else
- if (proc_name2sym(pp->dpp_pr, obj, ".stret1", &sym) == 0)
- pp->dpp_stret[0] = sym.st_value;
- else
- pp->dpp_stret[0] = 0;
-
- if (proc_name2sym(pp->dpp_pr, obj, ".stret2", &sym) == 0)
- pp->dpp_stret[1] = sym.st_value;
- else
- pp->dpp_stret[1] = 0;
-
- if (proc_name2sym(pp->dpp_pr, obj, ".stret4", &sym) == 0)
- pp->dpp_stret[2] = sym.st_value;
- else
- pp->dpp_stret[2] = 0;
-
- if (proc_name2sym(pp->dpp_pr, obj, ".stret8", &sym) == 0)
- pp->dpp_stret[3] = sym.st_value;
- else
- pp->dpp_stret[3] = 0;
-#endif
dt_dprintf("%s stret %llx %llx %llx %llx\n", obj,
(u_longlong_t)pp->dpp_stret[0], (u_longlong_t)pp->dpp_stret[1],
@@ -347,24 +304,16 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
* just fail silently in the hopes that some other object will
* contain the desired symbol.
*/
-#if defined(sun)
if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj,
pp->dpp_func, &sym, NULL) != 0) {
-#else
- if (proc_name2sym(pp->dpp_pr, obj, pp->dpp_func, &sym) != 0) {
-#endif
if (strcmp("-", pp->dpp_func) == 0) {
sym.st_name = 0;
sym.st_info =
GELF_ST_INFO(STB_LOCAL, STT_FUNC);
sym.st_other = 0;
sym.st_value = 0;
-#if defined(sun)
sym.st_size = Pstatus(pp->dpp_pr)->pr_dmodel ==
PR_MODEL_ILP32 ? -1U : -1ULL;
-#else
- sym.st_size = ~((Elf64_Xword) 0);
-#endif
} else if (!strisglob(pp->dpp_mod)) {
return (dt_pid_error(dtp, pcb, dpr, NULL,
@@ -387,21 +336,14 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
* We don't instrument PLTs -- they're dynamically rewritten,
* and, so, inherently dicey to instrument.
*/
-#ifdef DOODAD
if (Ppltdest(pp->dpp_pr, sym.st_value) != NULL)
return (0);
-#endif
-#if defined(sun)
(void) Plookup_by_addr(pp->dpp_pr, sym.st_value, pp->dpp_func,
-#else
- (void) proc_addr2sym(pp->dpp_pr, sym.st_value, pp->dpp_func,
-#endif
DTRACE_FUNCNAMELEN, &sym);
return (dt_pid_per_sym(pp, &sym, pp->dpp_func));
} else {
-#ifdef DOODAD
uint_t nmatches = pp->dpp_nmatches;
if (Psymbol_iter_by_addr(pp->dpp_pr, obj, PR_SYMTAB,
@@ -417,7 +359,6 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
BIND_ANY | TYPE_FUNC, dt_pid_sym_filt, pp) == 1)
return (1);
}
-#endif
}
return (0);
@@ -432,11 +373,7 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
if (gmatch(obj, pp->dpp_mod))
return (dt_pid_per_mod(pp, pmp, obj));
-#if defined(sun)
(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
-#else
- pp->dpp_lmid = 0;
-#endif
if ((pp->dpp_obj = strrchr(obj, '/')) == NULL)
pp->dpp_obj = obj;
@@ -454,14 +391,11 @@ dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
static const prmap_t *
dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P)
{
-#ifdef DOODAD
char m[MAXPATHLEN];
Lmid_t lmid = PR_LMID_EVERY;
const char *obj;
-#endif
const prmap_t *pmp;
-#ifdef DOODAD
/*
* Pick apart the link map from the library name.
*/
@@ -493,11 +427,7 @@ dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P)
obj++;
(void) Plmid(P, pmp->pr_vaddr, &lmid);
-
dt_pid_objname(pdp->dtpd_mod, sizeof (pdp->dtpd_mod), lmid, obj);
-#else
-pmp = NULL;
-#endif
return (pmp);
}
@@ -515,7 +445,6 @@ dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
pp.dpp_pr = dpr->dpr_proc;
pp.dpp_pcb = pcb;
-#ifdef DOODAD
/*
* We can only trace dynamically-linked executables (since we've
* hidden some magic in ld.so.1 as well as libc.so.1).
@@ -525,7 +454,6 @@ dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
"process %s is not a dynamically-linked executable",
&pdp->dtpd_provider[3]));
}
-#endif
pp.dpp_mod = pdp->dtpd_mod[0] != '\0' ? pdp->dtpd_mod : "*";
pp.dpp_func = pdp->dtpd_func[0] != '\0' ? pdp->dtpd_func : "*";
@@ -539,13 +467,8 @@ dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
pp.dpp_mod = pdp->dtpd_mod;
(void) strcpy(pdp->dtpd_mod, "a.out");
} else if (strisglob(pp.dpp_mod) ||
-#if defined(sun)
(aout = Pname_to_map(pp.dpp_pr, "a.out")) == NULL ||
(pmp = Pname_to_map(pp.dpp_pr, pp.dpp_mod)) == NULL ||
-#else
- (aout = proc_name2map(pp.dpp_pr, "a.out")) == NULL ||
- (pmp = proc_name2map(pp.dpp_pr, pp.dpp_mod)) == NULL ||
-#endif
aout->pr_vaddr != pmp->pr_vaddr) {
return (dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_LIB,
"only the a.out module is valid with the "
@@ -564,7 +487,6 @@ dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
* to iterate over each module and compare its name against the
* pattern. An empty module name is treated as '*'.
*/
-#ifdef DOODAD
if (strisglob(pp.dpp_mod)) {
ret = Pobject_iter(pp.dpp_pr, dt_pid_mod_filt, &pp);
} else {
@@ -585,7 +507,6 @@ dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
ret = dt_pid_per_mod(&pp, pmp, obj);
}
}
-#endif
return (ret);
}
@@ -595,9 +516,7 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
{
struct ps_prochandle *P = data;
GElf_Sym sym;
-#if defined(sun)
prsyminfo_t sip;
-#endif
dof_helper_t dh;
GElf_Half e_type;
const char *mname;
@@ -611,12 +530,8 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
* run the code to instantiate these providers.
*/
for (i = 0; i < 2; i++) {
-#if defined(sun)
if (Pxlookup_by_name(P, PR_LMID_EVERY, oname, syms[i], &sym,
&sip) != 0) {
-#else
- if (proc_name2sym(P, oname, syms[i], &sym) != 0) {
-#endif
continue;
}
@@ -627,25 +542,18 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
dt_dprintf("lookup of %s succeeded for %s\n", syms[i], mname);
-#ifdef DOODAD
if (Pread(P, &e_type, sizeof (e_type), pmp->pr_vaddr +
offsetof(Elf64_Ehdr, e_type)) != sizeof (e_type)) {
dt_dprintf("read of ELF header failed");
continue;
}
-#endif
dh.dofhp_dof = sym.st_value;
dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;
dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
-#if defined(sun)
sip.prs_lmid, mname);
-#else
- 0, mname);
-#endif
-#ifdef DOODAD
if (fd == -1 &&
(fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) {
dt_dprintf("pr_open of helper device failed: %s\n",
@@ -655,13 +563,10 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
if (pr_ioctl(P, fd, DTRACEHIOC_ADDDOF, &dh, sizeof (dh)) < 0)
dt_dprintf("DOF was rejected for %s\n", dh.dofhp_mod);
-#endif
}
-#ifdef DOODAD
if (fd != -1)
(void) pr_close(P, fd);
-#endif
return (0);
}
@@ -675,19 +580,13 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
-#ifdef DOODAD
(void) Pupdate_maps(P);
if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) {
ret = -1;
(void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT,
"failed to instantiate probes for pid %d: %s",
-#if defined(sun)
(int)Pstatus(P)->pr_pid, strerror(errno));
-#else
- (int)proc_getpid(P), strerror(errno));
-#endif
}
-#endif
/*
* Put the module name in its canonical form.
@@ -768,13 +667,7 @@ dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
assert(dpr != NULL);
(void) pthread_mutex_lock(&dpr->dpr_lock);
- if ((err = dt_pid_create_pid_probes(pdp, dtp, pcb, dpr)) == 0) {
- /*
- * Alert other retained enablings which may match
- * against the newly created probes.
- */
- (void) dt_ioctl(dtp, DTRACEIOC_ENABLE, NULL);
- }
+ err = dt_pid_create_pid_probes(pdp, dtp, pcb, dpr);
(void) pthread_mutex_unlock(&dpr->dpr_lock);
dt_proc_release(dtp, P);
@@ -809,7 +702,6 @@ dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
int
dt_pid_create_probes_module(dtrace_hdl_t *dtp, dt_proc_t *dpr)
{
- dtrace_enable_io_t args;
dtrace_prog_t *pgp;
dt_stmt_t *stp;
dtrace_probedesc_t *pdp, pd;
@@ -854,9 +746,7 @@ dt_pid_create_probes_module(dtrace_hdl_t *dtp, dt_proc_t *dpr)
* Give DTrace a shot to the ribs to get it to check
* out the newly created probes.
*/
- args.dof = NULL;
- args.n_matched = 0;
- (void) dt_ioctl(dtp, DTRACEIOC_ENABLE, &args);
+ (void) dt_ioctl(dtp, DTRACEIOC_ENABLE, NULL);
}
return (ret);
diff --git a/lib/libdtrace/common/dt_pragma.c b/lib/libdtrace/common/dt_pragma.c
index a9328ab067b9..00b826978f37 100644
--- a/lib/libdtrace/common/dt_pragma.c
+++ b/lib/libdtrace/common/dt_pragma.c
@@ -18,9 +18,8 @@
*
* CDDL HEADER END
*/
-
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -28,9 +27,7 @@
#include <assert.h>
#include <strings.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <stdlib.h>
#include <stdio.h>
@@ -213,7 +210,6 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
dt_node_t *nnp = cnp ? cnp->dn_list : NULL;
int found;
dt_lib_depend_t *dld;
- char lib[MAXPATHLEN];
if (cnp == NULL || nnp == NULL ||
cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) {
@@ -227,53 +223,29 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
} else if (strcmp(cnp->dn_string, "library") == 0) {
+
+ /*
+ * We have the file we are working on in dtp->dt_filetag
+ * so find that node and add the dependency in.
+ */
if (yypcb->pcb_cflags & DTRACE_C_CTL) {
- assert(dtp->dt_filetag != NULL);
+ char lib[MAXPATHLEN];
- /*
- * We have the file we are working on in dtp->dt_filetag
- * so find that node and add the dependency in.
- */
dld = dt_lib_depend_lookup(&dtp->dt_lib_dep,
dtp->dt_filetag);
assert(dld != NULL);
- (void) snprintf(lib, sizeof (lib), "%s%s",
+ (void) snprintf(lib, MAXPATHLEN, "%s%s",
dld->dtld_libpath, nnp->dn_string);
if ((dt_lib_depend_add(dtp, &dld->dtld_dependencies,
lib)) != 0) {
xyerror(D_PRAGMA_DEPEND,
- "failed to add dependency %s:%s\n", lib,
+ "failed to add dependency %s:%s\n",
+ lib,
dtrace_errmsg(dtp, dtrace_errno(dtp)));
}
- } else {
- /*
- * By this point we have already performed a topological
- * sort of the dependencies; we process this directive
- * as satisfied as long as the dependency was properly
- * loaded.
- */
- if (dtp->dt_filetag == NULL)
- xyerror(D_PRAGMA_DEPEND, "main program may "
- "not explicitly depend on a library");
-
- dld = dt_lib_depend_lookup(&dtp->dt_lib_dep,
- dtp->dt_filetag);
- assert(dld != NULL);
-
- (void) snprintf(lib, sizeof (lib), "%s%s",
- dld->dtld_libpath, nnp->dn_string);
- dld = dt_lib_depend_lookup(&dtp->dt_lib_dep_sorted,
- lib);
- assert(dld != NULL);
-
- if (!dld->dtld_loaded)
- xyerror(D_PRAGMA_DEPEND, "program requires "
- "library \"%s\" which failed to load",
- lib);
}
-
- found = B_TRUE;
+ found = 1;
} else {
xyerror(D_PRAGMA_INVAL, "invalid class %s "
"specified by #pragma %s\n", cnp->dn_string, prname);
diff --git a/lib/libdtrace/common/dt_printf.c b/lib/libdtrace/common/dt_printf.c
index 209b10a13ba8..953511b1d029 100644
--- a/lib/libdtrace/common/dt_printf.c
+++ b/lib/libdtrace/common/dt_printf.c
@@ -26,17 +26,10 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#if defined(sun)
#include <sys/sysmacros.h>
-#else
-#define ABS(a) ((a) < 0 ? -(a) : (a))
-#endif
-#include <string.h>
#include <strings.h>
#include <stdlib.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -306,11 +299,9 @@ pfprint_fp(dtrace_hdl_t *dtp, FILE *fp, const char *format,
case sizeof (double):
return (dt_printf(dtp, fp, format,
*((double *)addr) / n));
-#if !defined(__arm__) && !defined(__powerpc__)
case sizeof (long double):
return (dt_printf(dtp, fp, format,
*((long double *)addr) / ldn));
-#endif
default:
return (dt_set_errno(dtp, EDT_DMISMATCH));
}
@@ -463,11 +454,7 @@ pfprint_time(dtrace_hdl_t *dtp, FILE *fp, const char *format,
* Below, we turn this into the canonical adb/mdb /[yY] format,
* "1973 Dec 3 17:20:00".
*/
-#if defined(sun)
(void) ctime_r(&sec, src, sizeof (src));
-#else
- (void) ctime_r(&sec, src);
-#endif
/*
* Place the 4-digit year at the head of the string...
@@ -1566,7 +1553,6 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
if (rval == -1 || fp == NULL)
return (rval);
-#if defined(sun)
if (pfd->pfd_preflen != 0 &&
strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 0) {
/*
@@ -1611,8 +1597,7 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
* fails, we can fail the operation without destroying stdout.
*/
if ((nfp = fopen(filename, "aF")) == NULL) {
- char *msg = strerror(errno);
- char *faultstr;
+ char *msg = strerror(errno), *faultstr;
int len = 80;
len += strlen(msg) + strlen(filename);
@@ -1648,82 +1633,6 @@ dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
}
(void) fclose(nfp);
-#else
- /*
- * The 'standard output' (which is not necessarily stdout)
- * treatment on FreeBSD is implemented differently than on
- * Solaris because FreeBSD's freopen() will attempt to re-use
- * the current file descriptor, causing the previous file to
- * be closed and thereby preventing it from be re-activated
- * later.
- *
- * For FreeBSD we use the concept of setting an output file
- * pointer in the DTrace handle if a dtrace_freopen() has
- * enabled another output file and we leave the caller's
- * file pointer untouched. If it was actually stdout, then
- * stdout remains open. If it was another file, then that
- * file remains open. While a dtrace_freopen() has activated
- * another file, we keep a pointer to that which we use in
- * the output functions by preference and only use the caller's
- * file pointer if no dtrace_freopen() call has been made.
- *
- * The check to see if we're re-activating the caller's
- * output file is much the same as on Solaris.
- */
- if (pfd->pfd_preflen != 0 &&
- strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 0) {
- /*
- * The only way to have the format string set to the value
- * DT_FREOPEN_RESTORE is via the empty freopen() string --
- * denoting that we should restore the old stdout.
- */
- assert(strcmp(dtp->dt_sprintf_buf, DT_FREOPEN_RESTORE) == 0);
-
- if (dtp->dt_freopen_fp == NULL) {
- /*
- * We could complain here by generating an error,
- * but it seems like overkill: it seems that calling
- * freopen() to restore stdout when freopen() has
- * never before been called should just be a no-op,
- * so we just return in this case.
- */
- return (rval);
- }
-
- /*
- * At this point, to re-active the original output file,
- * on FreeBSD we only code the current file that this
- * function opened previously.
- */
- (void) fclose(dtp->dt_freopen_fp);
- dtp->dt_freopen_fp = NULL;
-
- return (rval);
- }
-
- if ((nfp = fopen(dtp->dt_sprintf_buf, "a")) == NULL) {
- char *msg = strerror(errno);
- char *faultstr;
- int len = 80;
-
- len += strlen(msg) + strlen(dtp->dt_sprintf_buf);
- faultstr = alloca(len);
-
- (void) snprintf(faultstr, len, "couldn't freopen() \"%s\": %s",
- dtp->dt_sprintf_buf, strerror(errno));
-
- if ((errval = dt_handle_liberr(dtp, data, faultstr)) == 0)
- return (rval);
-
- return (errval);
- }
-
- if (dtp->dt_freopen_fp != NULL)
- (void) fclose(dtp->dt_freopen_fp);
-
- /* Remember that the output has been redirected to the new file. */
- dtp->dt_freopen_fp = nfp;
-#endif
return (rval);
}
diff --git a/lib/libdtrace/common/dt_proc.c b/lib/libdtrace/common/dt_proc.c
index b8662bf67f34..419f13b8474c 100644
--- a/lib/libdtrace/common/dt_proc.c
+++ b/lib/libdtrace/common/dt_proc.c
@@ -79,9 +79,7 @@
*/
#include <sys/wait.h>
-#if defined(sun)
#include <sys/lwp.h>
-#endif
#include <strings.h>
#include <signal.h>
#include <assert.h>
@@ -95,7 +93,6 @@
#define IS_SYS_FORK(w) (w == SYS_vfork || w == SYS_fork1 || \
w == SYS_forkall || w == SYS_forksys)
-#ifdef DOODAD
static dt_bkpt_t *
dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data)
{
@@ -117,36 +114,27 @@ dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data)
return (dbp);
}
-#endif
static void
dt_proc_bpdestroy(dt_proc_t *dpr, int delbkpts)
{
-#if defined(sun)
int state = Pstate(dpr->dpr_proc);
-#else
- int state = proc_state(dpr->dpr_proc);
-#endif
dt_bkpt_t *dbp, *nbp;
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps); dbp != NULL; dbp = nbp) {
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
if (delbkpts && dbp->dbp_active &&
state != PS_LOST && state != PS_UNDEAD) {
(void) Pdelbkpt(dpr->dpr_proc,
dbp->dbp_addr, dbp->dbp_instr);
}
-#endif
nbp = dt_list_next(dbp);
dt_list_delete(&dpr->dpr_bps, dbp);
dt_free(dpr->dpr_hdl, dbp);
}
}
-#ifdef DOODAD
static void
dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
{
@@ -173,7 +161,6 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
dbp->dbp_func(dtp, dpr, dbp->dbp_data);
(void) Pxecbkpt(dpr->dpr_proc, dbp->dbp_instr);
}
-#endif
static void
dt_proc_bpenable(dt_proc_t *dpr)
@@ -184,12 +171,9 @@ dt_proc_bpenable(dt_proc_t *dpr)
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
if (!dbp->dbp_active && Psetbkpt(dpr->dpr_proc,
dbp->dbp_addr, &dbp->dbp_instr) == 0)
dbp->dbp_active = B_TRUE;
-#endif
}
dt_dprintf("breakpoints enabled\n");
@@ -204,12 +188,9 @@ dt_proc_bpdisable(dt_proc_t *dpr)
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
if (dbp->dbp_active && Pdelbkpt(dpr->dpr_proc,
dbp->dbp_addr, dbp->dbp_instr) == 0)
dbp->dbp_active = B_FALSE;
-#endif
}
dt_dprintf("breakpoints disabled\n");
@@ -282,7 +263,6 @@ dt_proc_bpmain(dtrace_hdl_t *dtp, dt_proc_t *dpr, const char *fname)
dt_proc_stop(dpr, DT_PROC_STOP_MAIN);
}
-#if defined(sun)
static void
dt_proc_rdevent(dtrace_hdl_t *dtp, dt_proc_t *dpr, const char *evname)
{
@@ -459,7 +439,6 @@ dt_proc_waitrun(dt_proc_t *dpr)
(void) pthread_mutex_lock(&dpr->dpr_lock);
}
-#endif
typedef struct dt_proc_control_data {
dtrace_hdl_t *dpcd_hdl; /* DTrace handle */
@@ -486,13 +465,11 @@ dt_proc_control(void *arg)
dt_proc_t *dpr = datap->dpcd_proc;
dt_proc_hash_t *dph = dpr->dpr_hdl->dt_procs;
struct ps_prochandle *P = dpr->dpr_proc;
- int pid = dpr->dpr_pid;
-#if defined(sun)
int pfd = Pctlfd(P);
+ int pid = dpr->dpr_pid;
const long wstop = PCWSTOP;
-#endif
int notify = B_FALSE;
/*
@@ -510,7 +487,6 @@ dt_proc_control(void *arg)
*/
(void) pthread_mutex_lock(&dpr->dpr_lock);
-#if defined(sun)
(void) Punsetflags(P, PR_ASYNC); /* require synchronous mode */
(void) Psetflags(P, PR_BPTADJ); /* always adjust eip on x86 */
(void) Punsetflags(P, PR_FORK); /* do not inherit on fork */
@@ -556,20 +532,6 @@ dt_proc_control(void *arg)
dt_dprintf("pid %d: failed to set running: %s\n",
(int)dpr->dpr_pid, strerror(errno));
}
-#else
- /*
- * If PR_KLC is set, we created the process; otherwise we grabbed it.
- * Check for an appropriate stop request and wait for dt_proc_continue.
- */
- if (proc_getflags(P) & PR_KLC)
- dt_proc_stop(dpr, DT_PROC_STOP_CREATE);
- else
- dt_proc_stop(dpr, DT_PROC_STOP_GRAB);
-
- if (proc_continue(P) != 0)
- dt_dprintf("pid %d: failed to set running: %s\n",
- (int)dpr->dpr_pid, strerror(errno));
-#endif
(void) pthread_mutex_unlock(&dpr->dpr_lock);
@@ -583,33 +545,20 @@ dt_proc_control(void *arg)
* Pwait() (which will return immediately) and do our processing.
*/
while (!dpr->dpr_quit) {
-#if defined(sun)
const lwpstatus_t *psp;
if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR)
continue; /* check dpr_quit and continue waiting */
-#else
- /* Wait for the process to report status. */
- proc_wait(P);
-#endif
(void) pthread_mutex_lock(&dpr->dpr_lock);
-
-#if defined(sun)
pwait_locked:
if (Pstopstatus(P, PCNULL, 0) == -1 && errno == EINTR) {
(void) pthread_mutex_unlock(&dpr->dpr_lock);
continue; /* check dpr_quit and continue waiting */
}
-#endif
-#if defined(sun)
switch (Pstate(P)) {
-#else
- switch (proc_state(P)) {
-#endif
case PS_STOP:
-#ifdef DOODAD
psp = &Pstatus(P)->pr_lwp;
dt_dprintf("pid %d: proc stopped showing %d/%d\n",
@@ -652,14 +601,11 @@ pwait_locked:
else if (psp->pr_why == PR_SYSEXIT &&
IS_SYS_EXEC(psp->pr_what))
dt_proc_attach(dpr, B_TRUE);
-#endif
break;
case PS_LOST:
-#if defined(sun)
if (Preopen(P) == 0)
goto pwait_locked;
-#endif
dt_dprintf("pid %d: proc lost: %s\n",
pid, strerror(errno));
@@ -675,12 +621,10 @@ pwait_locked:
break;
}
-#if defined(sun)
if (Pstate(P) != PS_UNDEAD && Psetrun(P, 0, 0) == -1) {
dt_dprintf("pid %d: failed to set running: %s\n",
(int)dpr->dpr_pid, strerror(errno));
}
-#endif
(void) pthread_mutex_unlock(&dpr->dpr_lock);
}
@@ -720,11 +664,7 @@ dt_proc_error(dtrace_hdl_t *dtp, dt_proc_t *dpr, const char *format, ...)
va_end(ap);
if (dpr->dpr_proc != NULL)
-#if defined(sun)
Prelease(dpr->dpr_proc, 0);
-#else
- proc_detach(dpr->dpr_proc);
-#endif
dt_free(dtp, dpr);
(void) dt_set_errno(dtp, EDT_COMPILER);
@@ -735,11 +675,7 @@ dt_proc_t *
dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove)
{
dt_proc_hash_t *dph = dtp->dt_procs;
-#if defined(sun)
pid_t pid = Pstatus(P)->pr_pid;
-#else
- pid_t pid = proc_getpid(P);
-#endif
dt_proc_t *dpr, **dpp = &dph->dph_hash[pid & (dph->dph_hashlen - 1)];
for (dpr = *dpp; dpr != NULL; dpr = dpr->dpr_hash) {
@@ -773,17 +709,9 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
* an external debugger and we were waiting in dt_proc_waitrun().
* Leave the process in this condition using PRELEASE_HANG.
*/
-#if defined(sun)
if (!(Pstatus(dpr->dpr_proc)->pr_flags & (PR_KLC | PR_RLC))) {
-#else
- if (!(proc_getflags(dpr->dpr_proc) & (PR_KLC | PR_RLC))) {
-#endif
dt_dprintf("abandoning pid %d\n", (int)dpr->dpr_pid);
-#if defined(sun)
rflag = PRELEASE_HANG;
-#else
- rflag = 0 /* XXX */;
-#endif
} else {
dt_dprintf("releasing pid %d\n", (int)dpr->dpr_pid);
rflag = 0; /* apply kill or run-on-last-close */
@@ -806,11 +734,7 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
*/
(void) pthread_mutex_lock(&dpr->dpr_lock);
dpr->dpr_quit = B_TRUE;
-#if defined(sun)
(void) _lwp_kill(dpr->dpr_tid, SIGCANCEL);
-#else
- (void) pthread_kill(dpr->dpr_tid, SIGUSR1);
-#endif
/*
* If the process is currently idling in dt_proc_stop(), re-
@@ -858,11 +782,7 @@ dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
}
dt_list_delete(&dph->dph_lrulist, dpr);
-#if defined(sun)
Prelease(dpr->dpr_proc, rflag);
-#else
- proc_detach(dpr->dpr_proc);
-#endif
dt_free(dtp, dpr);
}
@@ -882,11 +802,7 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
(void) sigfillset(&nset);
(void) sigdelset(&nset, SIGABRT); /* unblocked for assert() */
-#if defined(sun)
(void) sigdelset(&nset, SIGCANCEL); /* see dt_proc_destroy() */
-#else
- (void) sigdelset(&nset, SIGUSR1); /* see dt_proc_destroy() */
-#endif
data.dpcd_hdl = dtp;
data.dpcd_proc = dpr;
@@ -914,21 +830,14 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
* small amount of useful information to help figure it out.
*/
if (dpr->dpr_done) {
-#if defined(sun)
const psinfo_t *prp = Ppsinfo(dpr->dpr_proc);
int stat = prp ? prp->pr_wstat : 0;
-#endif
int pid = dpr->dpr_pid;
-#if defined(sun)
if (Pstate(dpr->dpr_proc) == PS_LOST) {
-#else
- if (proc_state(dpr->dpr_proc) == PS_LOST) {
-#endif
(void) dt_proc_error(dpr->dpr_hdl, dpr,
"failed to control pid %d: process exec'd "
"set-id or unobservable program\n", pid);
-#if defined(sun)
} else if (WIFSIGNALED(stat)) {
(void) dt_proc_error(dpr->dpr_hdl, dpr,
"failed to control pid %d: process died "
@@ -937,7 +846,6 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
(void) dt_proc_error(dpr->dpr_hdl, dpr,
"failed to control pid %d: process exited "
"with status %d\n", pid, WEXITSTATUS(stat));
-#endif
}
err = ESRCH; /* cause grab() or create() to fail */
@@ -967,7 +875,6 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
(void) pthread_mutex_init(&dpr->dpr_lock, NULL);
(void) pthread_cond_init(&dpr->dpr_cv, NULL);
-#if defined(sun)
if ((dpr->dpr_proc = Pcreate(file, argv, &err, NULL, 0)) == NULL) {
return (dt_proc_error(dtp, dpr,
"failed to execute %s: %s\n", file, Pcreate_error(err)));
@@ -978,21 +885,8 @@ dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
(void) Punsetflags(dpr->dpr_proc, PR_RLC);
(void) Psetflags(dpr->dpr_proc, PR_KLC);
-#else
- (void) proc_clearflags(dpr->dpr_proc, PR_RLC);
- (void) proc_setflags(dpr->dpr_proc, PR_KLC);
- if ((err = proc_create(file, argv, &dpr->dpr_proc)) != 0)
- return (dt_proc_error(dtp, dpr,
- "failed to execute %s: %s\n", file, strerror(err)));
- dpr->dpr_hdl = dtp;
- dpr->dpr_pid = proc_getpid(dpr->dpr_proc);
-#endif
-#if defined(sun)
if (dt_proc_create_thread(dtp, dpr, dtp->dt_prcmode) != 0)
-#else
- if (dt_proc_create_thread(dtp, dpr, DT_PROC_STOP_IDLE) != 0)
-#endif
return (NULL); /* dt_proc_error() has been called for us */
dpr->dpr_hash = dph->dph_hash[dpr->dpr_pid & (dph->dph_hashlen - 1)];
@@ -1048,27 +942,16 @@ dt_proc_grab(dtrace_hdl_t *dtp, pid_t pid, int flags, int nomonitor)
(void) pthread_mutex_init(&dpr->dpr_lock, NULL);
(void) pthread_cond_init(&dpr->dpr_cv, NULL);
-#if defined(sun)
if ((dpr->dpr_proc = Pgrab(pid, flags, &err)) == NULL) {
return (dt_proc_error(dtp, dpr,
"failed to grab pid %d: %s\n", (int)pid, Pgrab_error(err)));
}
-#else
- if ((err = proc_attach(pid, flags, &dpr->dpr_proc)) != 0)
- return (dt_proc_error(dtp, dpr,
- "failed to grab pid %d: %s\n", (int) pid, strerror(err)));
-#endif
dpr->dpr_hdl = dtp;
dpr->dpr_pid = pid;
-#if defined(sun)
(void) Punsetflags(dpr->dpr_proc, PR_KLC);
(void) Psetflags(dpr->dpr_proc, PR_RLC);
-#else
- (void) proc_clearflags(dpr->dpr_proc, PR_KLC);
- (void) proc_setflags(dpr->dpr_proc, PR_RLC);
-#endif
/*
* If we are attempting to grab the process without a monitor
@@ -1189,11 +1072,7 @@ dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
struct ps_prochandle *P = dt_proc_create(dtp, file, argv);
if (P != NULL && idp != NULL && idp->di_id == 0)
-#if defined(sun)
idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
-#else
- idp->di_id = proc_getpid(P); /* $target = created pid */
-#endif
return (P);
}
diff --git a/lib/libdtrace/common/dt_proc.h b/lib/libdtrace/common/dt_proc.h
index a6c43826ac7c..a3236694b2b7 100644
--- a/lib/libdtrace/common/dt_proc.h
+++ b/lib/libdtrace/common/dt_proc.h
@@ -44,9 +44,7 @@ typedef struct dt_proc {
dtrace_hdl_t *dpr_hdl; /* back pointer to libdtrace handle */
struct ps_prochandle *dpr_proc; /* proc handle for libproc calls */
char dpr_errmsg[BUFSIZ]; /* error message */
-#if defined(sun)
rd_agent_t *dpr_rtld; /* rtld handle for librtld_db calls */
-#endif
pthread_mutex_t dpr_lock; /* lock for manipulating dpr_hdl */
pthread_cond_t dpr_cv; /* cond for dpr_stop/quit/done */
pid_t dpr_pid; /* pid of process */
diff --git a/lib/libdtrace/common/dt_program.c b/lib/libdtrace/common/dt_program.c
index 17856686bd3a..8497dab01e05 100644
--- a/lib/libdtrace/common/dt_program.c
+++ b/lib/libdtrace/common/dt_program.c
@@ -32,9 +32,7 @@
#include <errno.h>
#include <assert.h>
#include <ctype.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <dt_impl.h>
#include <dt_program.h>
@@ -153,7 +151,6 @@ int
dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
dtrace_proginfo_t *pip)
{
- dtrace_enable_io_t args;
void *dof;
int n, err;
@@ -162,9 +159,7 @@ dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
if ((dof = dtrace_dof_create(dtp, pgp, DTRACE_D_STRIP)) == NULL)
return (-1);
- args.dof = dof;
- args.n_matched = 0;
- n = dt_ioctl(dtp, DTRACEIOC_ENABLE, &args);
+ n = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
dtrace_dof_destroy(dtp, dof);
if (n == -1) {
@@ -186,7 +181,7 @@ dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
}
if (pip != NULL)
- pip->dpi_matches += args.n_matched;
+ pip->dpi_matches += n;
return (0);
}
diff --git a/lib/libdtrace/common/dt_provider.c b/lib/libdtrace/common/dt_provider.c
index 188ce0e05796..86e1204e630c 100644
--- a/lib/libdtrace/common/dt_provider.c
+++ b/lib/libdtrace/common/dt_provider.c
@@ -27,17 +27,13 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
-#if defined(sun)
#include <sys/sysmacros.h>
-#endif
#include <assert.h>
#include <limits.h>
#include <strings.h>
#include <stdlib.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <unistd.h>
#include <errno.h>
diff --git a/lib/libdtrace/common/dt_subr.c b/lib/libdtrace/common/dt_subr.c
index 12f186ae51fd..b2163e69e9a6 100644
--- a/lib/libdtrace/common/dt_subr.c
+++ b/lib/libdtrace/common/dt_subr.c
@@ -26,9 +26,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#if defined(sun)
#include <sys/sysmacros.h>
-#endif
#include <strings.h>
#include <unistd.h>
@@ -38,11 +36,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
-#if defined(sun)
#include <alloca.h>
-#else
-#include <sys/sysctl.h>
-#endif
#include <assert.h>
#include <libgen.h>
#include <limits.h>
@@ -473,19 +467,10 @@ dt_dprintf(const char *format, ...)
}
int
-#if defined(sun)
dt_ioctl(dtrace_hdl_t *dtp, int val, void *arg)
-#else
-dt_ioctl(dtrace_hdl_t *dtp, u_long val, void *arg)
-#endif
{
const dtrace_vector_t *v = dtp->dt_vector;
-#if !defined(sun)
- /* Avoid sign extension. */
- val &= 0xffffffff;
-#endif
-
if (v != NULL)
return (v->dtv_ioctl(dtp->dt_varg, val, arg));
@@ -501,18 +486,8 @@ dt_status(dtrace_hdl_t *dtp, processorid_t cpu)
{
const dtrace_vector_t *v = dtp->dt_vector;
- if (v == NULL) {
-#if defined(sun)
+ if (v == NULL)
return (p_online(cpu, P_STATUS));
-#else
- int maxid = 0;
- size_t len = sizeof(maxid);
- if (sysctlbyname("kern.smp.maxid", &maxid, &len, NULL, 0) != 0)
- return (cpu == 0 ? 1 : -1);
- else
- return (cpu <= maxid ? 1 : -1);
-#endif
- }
return (v->dtv_status(dtp->dt_varg, cpu));
}
@@ -579,16 +554,6 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
va_list ap;
int n;
-#if !defined(sun)
- /*
- * On FreeBSD, check if output is currently being re-directed
- * to another file. If so, output to that file instead of the
- * one the caller has specified.
- */
- if (dtp->dt_freopen_fp != NULL)
- fp = dtp->dt_freopen_fp;
-#endif
-
va_start(ap, format);
if (dtp->dt_sprintf_buflen != 0) {
@@ -679,7 +644,6 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
}
n = vfprintf(fp, format, ap);
- fflush(fp);
va_end(ap);
if (n < 0) {
@@ -729,11 +693,6 @@ dt_zalloc(dtrace_hdl_t *dtp, size_t size)
{
void *data;
- if (size > 16 * 1024 * 1024) {
- (void) dt_set_errno(dtp, EDT_NOMEM);
- return (NULL);
- }
-
if ((data = malloc(size)) == NULL)
(void) dt_set_errno(dtp, EDT_NOMEM);
else
@@ -747,11 +706,6 @@ dt_alloc(dtrace_hdl_t *dtp, size_t size)
{
void *data;
- if (size > 16 * 1024 * 1024) {
- (void) dt_set_errno(dtp, EDT_NOMEM);
- return (NULL);
- }
-
if ((data = malloc(size)) == NULL)
(void) dt_set_errno(dtp, EDT_NOMEM);
@@ -849,7 +803,6 @@ dt_popcb(const ulong_t *bp, ulong_t n)
return (popc + dt_popc(bp[maxw] & ((1UL << maxb) - 1)));
}
-#if defined(sun)
struct _rwlock;
struct _lwp_mutex;
@@ -866,17 +819,12 @@ dt_rw_write_held(pthread_rwlock_t *lock)
extern int _rw_write_held(struct _rwlock *);
return (_rw_write_held((struct _rwlock *)lock));
}
-#endif
int
dt_mutex_held(pthread_mutex_t *lock)
{
-#if defined(sun)
extern int _mutex_held(struct _lwp_mutex *);
return (_mutex_held((struct _lwp_mutex *)lock));
-#else
- return (1);
-#endif
}
static int
@@ -963,13 +911,8 @@ dtrace_uaddr2str(dtrace_hdl_t *dtp, pid_t pid,
dt_proc_lock(dtp, P);
-#if defined(sun)
if (Plookup_by_addr(P, addr, name, sizeof (name), &sym) == 0) {
(void) Pobjname(P, addr, objname, sizeof (objname));
-#else
- if (proc_addr2sym(P, addr, name, sizeof (name), &sym) == 0) {
- (void) proc_objname(P, addr, objname, sizeof (objname));
-#endif
obj = dt_basename(objname);
@@ -979,11 +922,7 @@ dtrace_uaddr2str(dtrace_hdl_t *dtp, pid_t pid,
} else {
(void) snprintf(c, sizeof (c), "%s`%s", obj, name);
}
-#if defined(sun)
- } else if (Pobjname(P, addr, objname, sizeof (objname)) != 0) {
-#else
- } else if (proc_objname(P, addr, objname, sizeof (objname)) != 0) {
-#endif
+ } else if (Pobjname(P, addr, objname, sizeof (objname)) != NULL) {
(void) snprintf(c, sizeof (c), "%s`0x%llx",
dt_basename(objname), addr);
} else {
diff --git a/lib/libdtrace/common/dt_work.c b/lib/libdtrace/common/dt_work.c
index 68e64bb1970c..97a7f62d697c 100644
--- a/lib/libdtrace/common/dt_work.c
+++ b/lib/libdtrace/common/dt_work.c
@@ -82,7 +82,6 @@ dtrace_sleep(dtrace_hdl_t *dtp)
return; /* sleep duration has already past */
}
-#if defined(sun)
tv.tv_sec = (earliest - now) / NANOSEC;
tv.tv_nsec = (earliest - now) % NANOSEC;
@@ -92,23 +91,6 @@ dtrace_sleep(dtrace_hdl_t *dtp)
* awaken, iterate over any pending notifications and process them.
*/
(void) pthread_cond_reltimedwait_np(&dph->dph_cv, &dph->dph_lock, &tv);
-#else
- earliest -= now;
- clock_gettime(CLOCK_REALTIME,&tv);
- tv.tv_sec += earliest / NANOSEC;
- tv.tv_nsec += earliest % NANOSEC;
- while (tv.tv_nsec > NANOSEC) {
- tv.tv_sec += 1;
- tv.tv_nsec -= NANOSEC;
- }
-
- /*
- * Wait for either 'tv' nanoseconds to pass or to receive notification
- * that a process is in an interesting state. Regardless of why we
- * awaken, iterate over any pending notifications and process them.
- */
- (void) pthread_cond_timedwait(&dph->dph_cv, &dph->dph_lock, &tv);
-#endif
while ((dprn = dph->dph_notify) != NULL) {
if (dtp->dt_prochdlr != NULL) {
@@ -182,7 +164,6 @@ dtrace_status(dtrace_hdl_t *dtp)
int
dtrace_go(dtrace_hdl_t *dtp)
{
- dtrace_enable_io_t args;
void *dof;
int err;
@@ -204,9 +185,7 @@ dtrace_go(dtrace_hdl_t *dtp)
if ((dof = dtrace_getopt_dof(dtp)) == NULL)
return (-1); /* dt_errno has been set for us */
- args.dof = dof;
- args.n_matched = 0;
- err = dt_ioctl(dtp, DTRACEIOC_ENABLE, &args);
+ err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
dtrace_dof_destroy(dtp, dof);
if (err == -1 && (errno != ENOTTY || dtp->dt_vector == NULL))
diff --git a/lib/libdtrace/common/dtrace.h b/lib/libdtrace/common/dtrace.h
index 895f776f7deb..1c041207c0ae 100644
--- a/lib/libdtrace/common/dtrace.h
+++ b/lib/libdtrace/common/dtrace.h
@@ -148,7 +148,7 @@ typedef struct dtrace_stmtdesc {
dtrace_actdesc_t *dtsd_action_last; /* last action in action list */
void *dtsd_aggdata; /* aggregation data */
void *dtsd_fmtdata; /* type-specific output data */
- void (*dtsd_callback)(void); /* callback function for EPID */
+ void (*dtsd_callback)(); /* callback function for EPID */
void *dtsd_data; /* callback data pointer */
dtrace_attribute_t dtsd_descattr; /* probedesc attributes */
dtrace_attribute_t dtsd_stmtattr; /* statement attributes */
@@ -521,11 +521,7 @@ extern int dtrace_probe_info(dtrace_hdl_t *,
* entry point to obtain a library handle.
*/
struct dtrace_vector {
-#if defined(sun)
int (*dtv_ioctl)(void *, int, void *);
-#else
- int (*dtv_ioctl)(void *, u_long, void *);
-#endif
int (*dtv_lookup_by_addr)(void *, GElf_Addr, GElf_Sym *,
dtrace_syminfo_t *);
int (*dtv_status)(void *, processorid_t);
@@ -572,9 +568,4 @@ extern int _dtrace_debug;
}
#endif
-#if !defined(sun)
-#define _SC_CPUID_MAX _SC_NPROCESSORS_CONF
-#define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF
-#endif
-
#endif /* _DTRACE_H */
diff --git a/lib/libdtrace/common/mkerrtags.sh b/lib/libdtrace/common/mkerrtags.sh
index d5651ff727fc..67a696fed5d2 100644
--- a/lib/libdtrace/common/mkerrtags.sh
+++ b/lib/libdtrace/common/mkerrtags.sh
@@ -26,9 +26,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
-BSDECHO=-e
-
-echo ${BSDECHO} "\
+echo "\
/*\n\
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\
* Use is subject to license terms.\n\
@@ -45,7 +43,7 @@ replace=' "\1",'
sed -n "s/$pattern/$replace/p" || exit 1
-echo ${BSDECHO} "\
+echo "\
};\n\
\n\
static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]);\n\
diff --git a/lib/libdtrace/common/mknames.sh b/lib/libdtrace/common/mknames.sh
index 2fdc2fa636d5..7f90b7dd3705 100644
--- a/lib/libdtrace/common/mknames.sh
+++ b/lib/libdtrace/common/mknames.sh
@@ -26,9 +26,7 @@
#
#ident "%Z%%M% %I% %E% SMI"
-BSDECHO=-e
-
-echo ${BSDECHO} "\
+echo "\
/*\n\
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.\n\
* Use is subject to license terms.\n\
@@ -49,7 +47,7 @@ nawk '
printf("\tcase %s: return (\"%s\");\n", $2, tolower(substr($2, 10)));
}'
-echo ${BSDECHO} "\
+echo "\
default: return (\"unknown\");\n\
}\n\
}"
diff --git a/lib/libgen/common/gmatch.c b/lib/libgen/common/gmatch.c
index cfd66e862657..dc47f7ec3f01 100644
--- a/lib/libgen/common/gmatch.c
+++ b/lib/libgen/common/gmatch.c
@@ -32,28 +32,15 @@
/*LINTLIBRARY*/
-#if defined(sun)
#pragma weak gmatch = _gmatch
-#endif
-#if defined(sun)
#include "gen_synonyms.h"
-#endif
#include <sys/types.h>
#include <libgen.h>
#include <stdlib.h>
#include <limits.h>
-#if defined(sun)
#include <widec.h>
#include "_range.h"
-#else
-/* DOODAD */ static int multibyte = 0;
-#define WCHAR_CSMASK 0x30000000
-#define valid_range(c1, c2) \
- (((c1) & WCHAR_CSMASK) == ((c2) & WCHAR_CSMASK) && \
- ((c1) > 0xff || !iscntrl((int)c1)) && ((c2) > 0xff || \
- !iscntrl((int)c2)))
-#endif
#define Popwchar(p, c) \
n = mbtowc(&cl, p, MB_LEN_MAX); \
diff --git a/tools/ctf/common/list.c b/tools/ctf/common/list.c
index 4958f270a994..c01de9b9241d 100644
--- a/tools/ctf/common/list.c
+++ b/tools/ctf/common/list.c
@@ -70,7 +70,7 @@ slist_add(list_t **list, void *data, int (*cmp)(void *, void *))
/*ARGSUSED2*/
static int
-list_defcmp(void *d1, void *d2, void *private __unused)
+list_defcmp(void *d1, void *d2, void *private)
{
return (d1 != d2);
}
@@ -135,7 +135,7 @@ list_iter(list_t *list, int (*func)(void *, void *), void *private)
/*ARGSUSED*/
static int
-list_count_cb(void *data __unused, void *private __unused)
+list_count_cb(void *data, void *private)
{
return (1);
}
diff --git a/tools/ctf/common/memory.c b/tools/ctf/common/memory.c
index e16044a8b672..390ff128e433 100644
--- a/tools/ctf/common/memory.c
+++ b/tools/ctf/common/memory.c
@@ -35,7 +35,6 @@
#include <stdlib.h>
#include <string.h>
#include <strings.h>
-#include "memory.h"
static void
memory_bailout(void)
diff --git a/tools/ctf/cvt/alist.c b/tools/ctf/cvt/alist.c
index 8e776dc08a7f..415a6cd3335b 100644
--- a/tools/ctf/cvt/alist.c
+++ b/tools/ctf/cvt/alist.c
@@ -52,19 +52,16 @@ typedef struct alist_el {
} alist_el_t;
static int
-alist_hash(int nbuckets, void *arg)
+alist_hash(int nbuckets, alist_el_t *el)
{
- alist_el_t *el = arg;
uintptr_t num = (uintptr_t)el->ale_name;
return (num % nbuckets);
}
static int
-alist_cmp(void *arg1, void *arg2)
+alist_cmp(alist_el_t *el1, alist_el_t *el2)
{
- alist_el_t *el1 = arg1;
- alist_el_t *el2 = arg2;
return ((uintptr_t)el1->ale_name != (uintptr_t)el2->ale_name);
}
@@ -87,14 +84,12 @@ alist_t *
alist_new(void (*namefree)(void *), void (*valfree)(void *))
{
return (alist_xnew(ALIST_HASH_SIZE, namefree, valfree,
- alist_hash, alist_cmp));
+ (int (*)())alist_hash, (int (*)())alist_cmp));
}
static void
-alist_free_cb(void *arg1, void *arg2)
+alist_free_cb(alist_el_t *el, alist_t *alist)
{
- alist_el_t *el = arg1;
- alist_t *alist = arg2;
if (alist->al_namefree)
alist->al_namefree(el->ale_name);
if (alist->al_valfree)
@@ -105,7 +100,7 @@ alist_free_cb(void *arg1, void *arg2)
void
alist_free(alist_t *alist)
{
- hash_free(alist->al_elements, alist_free_cb, alist);
+ hash_free(alist->al_elements, (void (*)())alist_free_cb, alist);
free(alist);
}
@@ -123,17 +118,14 @@ alist_add(alist_t *alist, void *name, void *value)
int
alist_find(alist_t *alist, void *name, void **value)
{
- alist_el_t template, *retx;
- void *ret;
+ alist_el_t template, *ret;
template.ale_name = name;
- if (!hash_find(alist->al_elements, &template, &ret))
+ if (!hash_find(alist->al_elements, &template, (void **)&ret))
return (0);
- if (value) {
- retx = ret;
- *value = retx->ale_value;
- }
+ if (value)
+ *value = ret->ale_value;
return (1);
}
@@ -144,10 +136,8 @@ typedef struct alist_iter_data {
} alist_iter_data_t;
static int
-alist_iter_cb(void *arg1, void *arg2)
+alist_iter_cb(alist_el_t *el, alist_iter_data_t *aid)
{
- alist_el_t *el = arg1;
- alist_iter_data_t *aid = arg2;
return (aid->aid_func(el->ale_name, el->ale_value, aid->aid_priv));
}
@@ -159,7 +149,7 @@ alist_iter(alist_t *alist, int (*func)(void *, void *, void *), void *private)
aid.aid_func = func;
aid.aid_priv = private;
- return (hash_iter(alist->al_elements, alist_iter_cb, &aid));
+ return (hash_iter(alist->al_elements, (int (*)())alist_iter_cb, &aid));
}
/*
@@ -181,13 +171,13 @@ alist_def_print_cb(void *key, void *value)
{
printf("Key: ");
if (alist_def_print_cb_key_int == 1)
- printf("%5lu ", (ulong_t)key);
+ printf("%5d ", (int)key);
else
printf("%s\n", (char *)key);
printf("Value: ");
if (alist_def_print_cb_value_int == 1)
- printf("%5lu\n", (ulong_t)value);
+ printf("%5d\n", (int)value);
else
printf("%s\n", (char *)key);
@@ -197,7 +187,7 @@ alist_def_print_cb(void *key, void *value)
static int
alist_dump_cb(void *node, void *private)
{
- int (*printer)(void *, void *) = private;
+ int (*printer)(void *, void *) = (int (*)())private;
alist_el_t *el = node;
printer(el->ale_name, el->ale_value);
diff --git a/tools/ctf/cvt/alist.h b/tools/ctf/cvt/alist.h
index 629e0290e7ce..ec49df1a35e6 100644
--- a/tools/ctf/cvt/alist.h
+++ b/tools/ctf/cvt/alist.h
@@ -48,7 +48,6 @@ void alist_add(alist_t *, void *, void *);
int alist_find(alist_t *, void *, void **);
int alist_iter(alist_t *, int (*)(void *, void *, void *), void *);
void alist_stats(alist_t *, int);
-int alist_dump(alist_t *, int (*)(void *, void *));
#ifdef __cplusplus
}
diff --git a/tools/ctf/cvt/barrier.c b/tools/ctf/cvt/barrier.c
index bc278b063de1..d91fbf44db07 100644
--- a/tools/ctf/cvt/barrier.c
+++ b/tools/ctf/cvt/barrier.c
@@ -38,9 +38,7 @@
*/
#include <pthread.h>
-#if defined(sun)
#include <synch.h>
-#endif
#include <stdio.h>
#include "barrier.h"
@@ -49,11 +47,7 @@ void
barrier_init(barrier_t *bar, int nthreads)
{
pthread_mutex_init(&bar->bar_lock, NULL);
-#if defined(sun)
sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL);
-#else
- sem_init(&bar->bar_sem, 0, 0);
-#endif
bar->bar_numin = 0;
bar->bar_nthr = nthreads;
@@ -66,11 +60,7 @@ barrier_wait(barrier_t *bar)
if (++bar->bar_numin < bar->bar_nthr) {
pthread_mutex_unlock(&bar->bar_lock);
-#if defined(sun)
sema_wait(&bar->bar_sem);
-#else
- sem_wait(&bar->bar_sem);
-#endif
return (0);
@@ -80,11 +70,7 @@ barrier_wait(barrier_t *bar)
/* reset for next use */
bar->bar_numin = 0;
for (i = 1; i < bar->bar_nthr; i++)
-#if defined(sun)
sema_post(&bar->bar_sem);
-#else
- sem_post(&bar->bar_sem);
-#endif
pthread_mutex_unlock(&bar->bar_lock);
return (1);
diff --git a/tools/ctf/cvt/barrier.h b/tools/ctf/cvt/barrier.h
index c7e6212a69c5..3a62f3082ed9 100644
--- a/tools/ctf/cvt/barrier.h
+++ b/tools/ctf/cvt/barrier.h
@@ -33,12 +33,7 @@
* APIs for the barrier synchronization primitive.
*/
-#if defined(sun)
#include <synch.h>
-#else
-#include <semaphore.h>
-typedef sem_t sema_t;
-#endif
#ifdef __cplusplus
extern "C" {
diff --git a/tools/ctf/cvt/ctf.c b/tools/ctf/cvt/ctf.c
index 6a9d67aa3002..91e0f611cbb9 100644
--- a/tools/ctf/cvt/ctf.c
+++ b/tools/ctf/cvt/ctf.c
@@ -66,7 +66,7 @@ struct ctf_buf {
/*PRINTFLIKE1*/
static void
-parseterminate(const char *fmt, ...)
+parseterminate(char *fmt, ...)
{
static char msgbuf[1024]; /* sigh */
va_list ap;
@@ -78,7 +78,7 @@ parseterminate(const char *fmt, ...)
terminate("%s: %s\n", curfile, msgbuf);
}
-static void
+void
ctf_buf_grow(ctf_buf_t *b)
{
off_t ptroff = b->ctb_ptr - b->ctb_base;
@@ -89,7 +89,7 @@ ctf_buf_grow(ctf_buf_t *b)
b->ctb_ptr = b->ctb_base + ptroff;
}
-static ctf_buf_t *
+ctf_buf_t *
ctf_buf_new(void)
{
ctf_buf_t *b = xcalloc(sizeof (ctf_buf_t));
@@ -100,7 +100,7 @@ ctf_buf_new(void)
return (b);
}
-static void
+void
ctf_buf_free(ctf_buf_t *b)
{
strtab_destroy(&b->ctb_strtab);
@@ -108,14 +108,14 @@ ctf_buf_free(ctf_buf_t *b)
free(b);
}
-static uint_t
+uint_t
ctf_buf_cur(ctf_buf_t *b)
{
return (b->ctb_ptr - b->ctb_base);
}
-static void
-ctf_buf_write(ctf_buf_t *b, void const *p, size_t n)
+void
+ctf_buf_write(ctf_buf_t *b, const void *p, size_t n)
{
size_t len;
@@ -127,16 +127,14 @@ ctf_buf_write(ctf_buf_t *b, void const *p, size_t n)
bcopy(p, b->ctb_ptr, len);
b->ctb_ptr += len;
- p = (char const *)p + len;
+ p = (char *)p + len;
n -= len;
}
}
static int
-write_label(void *arg1, void *arg2)
+write_label(labelent_t *le, ctf_buf_t *b)
{
- labelent_t *le = arg1;
- ctf_buf_t *b = arg2;
ctf_lblent_t ctl;
ctl.ctl_label = strtab_insert(&b->ctb_strtab, le->le_name);
@@ -222,10 +220,8 @@ write_unsized_type_rec(ctf_buf_t *b, ctf_type_t *ctt)
}
static int
-write_type(void *arg1, void *arg2)
+write_type(tdesc_t *tp, ctf_buf_t *b)
{
- tdesc_t *tp = arg1;
- ctf_buf_t *b = arg2;
elist_t *ep;
mlist_t *mp;
intr_t *ip;
@@ -396,7 +392,7 @@ write_type(void *arg1, void *arg2)
ctt.ctt_type = tp->t_fndef->fn_ret->t_id;
write_unsized_type_rec(b, &ctt);
- for (i = 0; i < (int) tp->t_fndef->fn_nargs; i++) {
+ for (i = 0; i < tp->t_fndef->fn_nargs; i++) {
id = tp->t_fndef->fn_args[i]->t_id;
ctf_buf_write(b, &id, sizeof (id));
}
@@ -461,14 +457,14 @@ compress_start(resbuf_t *rb)
}
static ssize_t
-compress_buffer(void *buf, size_t n, void *data)
+compress_buffer(const void *buf, size_t n, void *data)
{
resbuf_t *rb = (resbuf_t *)data;
int rc;
rb->rb_zstr.next_out = (Bytef *)rb->rb_ptr;
rb->rb_zstr.avail_out = rb->rb_size - (rb->rb_ptr - rb->rb_base);
- rb->rb_zstr.next_in = buf;
+ rb->rb_zstr.next_in = (Bytef *)buf;
rb->rb_zstr.avail_in = n;
while (rb->rb_zstr.avail_in) {
@@ -530,7 +526,7 @@ pad_buffer(ctf_buf_t *buf, int align)
}
static ssize_t
-bcopy_data(void *buf, size_t n, void *data)
+bcopy_data(const void *buf, size_t n, void *data)
{
caddr_t *posp = (caddr_t *)data;
bcopy(buf, *posp, n);
@@ -605,7 +601,7 @@ ctf_gen(iiburst_t *iiburst, size_t *resszp, int do_compress)
iiburst->iib_td->td_parname);
h.cth_lbloff = 0;
- (void) list_iter(iiburst->iib_td->td_labels, write_label,
+ (void) list_iter(iiburst->iib_td->td_labels, (int (*)())write_label,
buf);
pad_buffer(buf, 2);
@@ -620,7 +616,7 @@ ctf_gen(iiburst_t *iiburst, size_t *resszp, int do_compress)
pad_buffer(buf, 4);
h.cth_typeoff = ctf_buf_cur(buf);
- (void) list_iter(iiburst->iib_types, write_type, buf);
+ (void) list_iter(iiburst->iib_types, (int (*)())write_type, buf);
debug(2, "CTF wrote %d types\n", list_count(iiburst->iib_types));
@@ -641,7 +637,7 @@ ctf_gen(iiburst_t *iiburst, size_t *resszp, int do_compress)
return (outbuf);
}
-static void
+void
get_ctt_size(ctf_type_t *ctt, size_t *sizep, size_t *incrementp)
{
if (ctt->ctt_size == CTF_LSIZE_SENT) {
@@ -661,8 +657,8 @@ count_types(ctf_header_t *h, caddr_t data)
dptr = data + h->cth_typeoff;
while (dptr < data + h->cth_stroff) {
- void *v = (void *) dptr;
- ctf_type_t *ctt = v;
+ /* LINTED - pointer alignment */
+ ctf_type_t *ctt = (ctf_type_t *)dptr;
size_t vlen = CTF_INFO_VLEN(ctt->ctt_info);
size_t size, increment;
@@ -731,11 +727,11 @@ resurrect_labels(ctf_header_t *h, tdata_t *td, caddr_t ctfdata, char *matchlbl)
caddr_t sbuf = ctfdata + h->cth_stroff;
size_t bufsz = h->cth_objtoff - h->cth_lbloff;
int lastidx = 0, baseidx = -1;
- char *baselabel = NULL;
+ char *baselabel;
ctf_lblent_t *ctl;
- void *v = (void *) buf;
- for (ctl = v; (caddr_t)ctl < buf + bufsz; ctl++) {
+ /* LINTED - pointer alignment */
+ for (ctl = (ctf_lblent_t *)buf; (caddr_t)ctl < buf + bufsz; ctl++) {
char *label = sbuf + ctl->ctl_label;
lastidx = ctl->ctl_typeidx;
@@ -779,8 +775,8 @@ resurrect_objects(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
symit_reset(si);
for (dptr = buf; dptr < buf + bufsz; dptr += 2) {
- void *v = (void *) dptr;
- ushort_t id = *((ushort_t *)v);
+ /* LINTED - pointer alignment */
+ ushort_t id = *((ushort_t *)dptr);
iidesc_t *ii;
GElf_Sym *sym;
@@ -827,8 +823,8 @@ resurrect_functions(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
symit_reset(si);
while (dptr < buf + bufsz) {
- void *v = (void *) dptr;
- info = *((ushort_t *)v);
+ /* LINTED - pointer alignment */
+ info = *((ushort_t *)dptr);
dptr += 2;
if (!(sym = symit_next(si, STT_FUNC)) && info != 0)
@@ -840,8 +836,8 @@ resurrect_functions(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
continue;
}
- v = (void *) dptr;
- retid = *((ushort_t *)v);
+ /* LINTED - pointer alignment */
+ retid = *((ushort_t *)dptr);
dptr += 2;
if (retid >= tdsize)
@@ -860,8 +856,8 @@ resurrect_functions(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
xmalloc(sizeof (tdesc_t *) * ii->ii_nargs);
for (i = 0; i < ii->ii_nargs; i++, dptr += 2) {
- v = (void *) dptr;
- ushort_t id = *((ushort_t *)v);
+ /* LINTED - pointer alignment */
+ ushort_t id = *((ushort_t *)dptr);
if (id >= tdsize)
parseterminate("Reference to invalid type %d",
id);
@@ -921,8 +917,8 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
if (tid >= tdsize)
parseterminate("Reference to invalid type %d", tid);
- void *v = (void *) dptr;
- ctt = v;
+ /* LINTED - pointer alignment */
+ ctt = (ctf_type_t *)dptr;
get_ctt_size(ctt, &size, &increment);
dptr += increment;
@@ -946,8 +942,8 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
tdp->t_type = INTRINSIC;
tdp->t_size = size;
- v = (void *) dptr;
- data = *((uint_t *)v);
+ /* LINTED - pointer alignment */
+ data = *((uint_t *)dptr);
dptr += sizeof (uint_t);
encoding = CTF_INT_ENCODING(data);
@@ -973,8 +969,8 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
tdp->t_type = INTRINSIC;
tdp->t_size = size;
- v = (void *) dptr;
- data = *((uint_t *)v);
+ /* LINTED - pointer alignment */
+ data = *((uint_t *)dptr);
dptr += sizeof (uint_t);
ip = xcalloc(sizeof (intr_t));
@@ -994,8 +990,8 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
tdp->t_type = ARRAY;
tdp->t_size = size;
- v = (void *) dptr;
- cta = v;
+ /* LINTED - pointer alignment */
+ cta = (ctf_array_t *)dptr;
dptr += sizeof (ctf_array_t);
tdp->t_ardef = xmalloc(sizeof (ardef_t));
@@ -1012,8 +1008,9 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
if (size < CTF_LSTRUCT_THRESH) {
for (i = 0, mpp = &tdp->t_members; i < vlen;
i++, mpp = &((*mpp)->ml_next)) {
- v = (void *) dptr;
- ctf_member_t *ctm = v;
+ /* LINTED - pointer alignment */
+ ctf_member_t *ctm = (ctf_member_t *)
+ dptr;
dptr += sizeof (ctf_member_t);
*mpp = xmalloc(sizeof (mlist_t));
@@ -1026,8 +1023,9 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
} else {
for (i = 0, mpp = &tdp->t_members; i < vlen;
i++, mpp = &((*mpp)->ml_next)) {
- v = (void *) dptr;
- ctf_lmember_t *ctlm = v;
+ /* LINTED - pointer alignment */
+ ctf_lmember_t *ctlm = (ctf_lmember_t *)
+ dptr;
dptr += sizeof (ctf_lmember_t);
*mpp = xmalloc(sizeof (mlist_t));
@@ -1050,8 +1048,8 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
for (i = 0, epp = &tdp->t_emem; i < vlen;
i++, epp = &((*epp)->el_next)) {
- v = (void *) dptr;
- cte = v;
+ /* LINTED - pointer alignment */
+ cte = (ctf_enum_t *)dptr;
dptr += sizeof (ctf_enum_t);
*epp = xmalloc(sizeof (elist_t));
@@ -1086,8 +1084,9 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
tdp->t_fndef = xcalloc(sizeof (fndef_t));
tdp->t_fndef->fn_ret = tdarr[ctt->ctt_type];
- v = (void *) (dptr + (sizeof (ushort_t) * (vlen - 1)));
- if (vlen > 0 && *(ushort_t *)v == 0)
+ /* LINTED - pointer alignment */
+ if (vlen > 0 && *(ushort_t *)(dptr +
+ (sizeof (ushort_t) * (vlen - 1))) == 0)
tdp->t_fndef->fn_vargs = 1;
tdp->t_fndef->fn_nargs = vlen - tdp->t_fndef->fn_vargs;
@@ -1095,8 +1094,8 @@ resurrect_types(ctf_header_t *h, tdata_t *td, tdesc_t **tdarr, int tdsize,
vlen - tdp->t_fndef->fn_vargs);
for (i = 0; i < vlen; i++) {
- v = (void *) dptr;
- argid = *(ushort_t *)v;
+ /* LINTED - pointer alignment */
+ argid = *(ushort_t *)dptr;
dptr += sizeof (ushort_t);
if (argid != 0)
@@ -1197,7 +1196,7 @@ decompress_ctf(caddr_t cbuf, size_t cbufsz, caddr_t dbuf, size_t dbufsz)
(rc = inflate(&zstr, Z_NO_FLUSH)) != Z_STREAM_END ||
(rc = inflateEnd(&zstr)) != Z_OK) {
warning("CTF decompress zlib error %s\n", zError(rc));
- return (0);
+ return (NULL);
}
debug(3, "reflated %lu bytes to %lu, pointer at %d\n",
@@ -1226,8 +1225,8 @@ ctf_load(char *file, caddr_t buf, size_t bufsz, symit_data_t *si, char *label)
if (bufsz < sizeof (ctf_header_t))
parseterminate("Corrupt CTF - short header");
- void *v = (void *) buf;
- h = v;
+ /* LINTED - pointer alignment */
+ h = (ctf_header_t *)buf;
buf += sizeof (ctf_header_t);
bufsz -= sizeof (ctf_header_t);
diff --git a/tools/ctf/cvt/ctfconvert.c b/tools/ctf/cvt/ctfconvert.c
index efe6c279a0b7..756549e54511 100644
--- a/tools/ctf/cvt/ctfconvert.c
+++ b/tools/ctf/cvt/ctfconvert.c
@@ -46,7 +46,7 @@
const char *progname;
int debug_level = DEBUG_LEVEL;
-static char *infile = NULL;
+static const char *infile = NULL;
static const char *outfile = NULL;
static int dynsym;
@@ -64,12 +64,10 @@ usage(void)
static void
terminate_cleanup(void)
{
-#if !defined(__FreeBSD__)
if (!outfile) {
fprintf(stderr, "Removing %s\n", infile);
unlink(infile);
}
-#endif
}
static void
@@ -79,10 +77,10 @@ handle_sig(int sig)
}
static int
-file_read(tdata_t *td, char *filename, int ignore_non_c)
+file_read(tdata_t *td, const char *filename, int ignore_non_c)
{
- typedef int (*reader_f)(tdata_t *, Elf *, char *);
- static reader_f readers[] = {
+ typedef int (*reader_f)(tdata_t *, Elf *, const char *);
+ static const reader_f readers[] = {
stabs_read,
dw_read,
NULL
@@ -149,17 +147,15 @@ int
main(int argc, char **argv)
{
tdata_t *filetd, *mstrtd;
- const char *label = NULL;
+ char *label = NULL;
int verbose = 0;
int ignore_non_c = 0;
int keep_stabs = 0;
int c;
-#if defined(sun)
sighold(SIGINT);
sighold(SIGQUIT);
sighold(SIGTERM);
-#endif
progname = basename(argv[0]);
@@ -221,15 +217,9 @@ main(int argc, char **argv)
*/
set_terminate_cleanup(terminate_cleanup);
-#if defined(sun)
sigset(SIGINT, handle_sig);
sigset(SIGQUIT, handle_sig);
sigset(SIGTERM, handle_sig);
-#else
- signal(SIGINT, handle_sig);
- signal(SIGQUIT, handle_sig);
- signal(SIGTERM, handle_sig);
-#endif
filetd = tdata_new();
@@ -253,6 +243,7 @@ main(int argc, char **argv)
write_ctf(mstrtd, infile, outfile, dynsym | keep_stabs);
} else {
char *tmpname = mktmpname(infile, ".ctf");
+
write_ctf(mstrtd, infile, tmpname, dynsym | keep_stabs);
if (rename(tmpname, infile) != 0)
terminate("Couldn't rename temp file %s", tmpname);
diff --git a/tools/ctf/cvt/ctfmerge.c b/tools/ctf/cvt/ctfmerge.c
index 546dcdfc9386..2def4904a6fe 100644
--- a/tools/ctf/cvt/ctfmerge.c
+++ b/tools/ctf/cvt/ctfmerge.c
@@ -176,22 +176,16 @@
#include <unistd.h>
#include <pthread.h>
#include <assert.h>
-#if defined(sun)
#include <synch.h>
-#endif
#include <signal.h>
#include <libgen.h>
#include <string.h>
#include <errno.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mman.h>
-#if defined(sun)
#include <sys/sysconf.h>
-#endif
#include "ctf_headers.h"
#include "ctftools.h"
@@ -232,7 +226,6 @@ usage(void)
progname, progname);
}
-#if defined(sun)
static void
bigheap(void)
{
@@ -280,7 +273,6 @@ bigheap(void)
(void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0);
}
-#endif
static void
finalize_phase_one(workqueue_t *wq)
@@ -603,12 +595,10 @@ terminate_cleanup(void)
if (outfile == NULL)
return;
-#if !defined(__FreeBSD__)
if (dounlink) {
fprintf(stderr, "Removing %s\n", outfile);
unlink(outfile);
}
-#endif
}
static void
@@ -707,15 +697,9 @@ start_threads(workqueue_t *wq)
wq);
}
-#if defined(sun)
sigset(SIGINT, handle_sig);
sigset(SIGQUIT, handle_sig);
sigset(SIGTERM, handle_sig);
-#else
- signal(SIGINT, handle_sig);
- signal(SIGQUIT, handle_sig);
- signal(SIGTERM, handle_sig);
-#endif
pthread_sigmask(SIG_UNBLOCK, &sets, NULL);
}
diff --git a/tools/ctf/cvt/ctftools.h b/tools/ctf/cvt/ctftools.h
index 52bbf44e1690..991f3bc9219b 100644
--- a/tools/ctf/cvt/ctftools.h
+++ b/tools/ctf/cvt/ctftools.h
@@ -91,7 +91,7 @@ extern "C" {
extern const char *progname;
extern int debug_level;
extern int debug_parse;
-extern char *curhdr;
+extern const char *curhdr;
/*
* This is a partial copy of the stab.h that DevPro includes with their
@@ -354,11 +354,11 @@ tdata_t *ctf_load(char *, caddr_t, size_t, symit_data_t *, char *);
iidesc_t *iidesc_new(char *);
int iidesc_hash(int, void *);
void iter_iidescs_by_name(tdata_t *, const char *,
- int (*)(void *, void *), void *);
+ int (*)(iidesc_t *, void *), void *);
iidesc_t *iidesc_dup(iidesc_t *);
iidesc_t *iidesc_dup_rename(iidesc_t *, char const *, char const *);
void iidesc_add(hash_t *, iidesc_t *);
-void iidesc_free(void *, void *);
+void iidesc_free(iidesc_t *, void *);
int iidesc_count_type(void *, void *);
void iidesc_stats(hash_t *);
int iidesc_dump(iidesc_t *);
@@ -404,10 +404,10 @@ void check_hash(void);
void resolve_typed_bitfields(void);
/* stabs.c */
-int stabs_read(tdata_t *, Elf *, char *);
+int stabs_read(tdata_t *, Elf *, const char *);
/* dwarf.c */
-int dw_read(tdata_t *, Elf *, char *);
+int dw_read(tdata_t *, Elf *, const char *);
const char *dw_tag2str(uint_t);
/* tdata.c */
@@ -422,7 +422,7 @@ int tdesc_namecmp(void *, void *);
int tdesc_layouthash(int, void *);
int tdesc_layoutcmp(void *, void *);
void tdesc_free(tdesc_t *);
-void tdata_label_add(tdata_t *, const char *, int);
+void tdata_label_add(tdata_t *, char *, int);
labelent_t *tdata_label_top(tdata_t *);
int tdata_label_find(tdata_t *, char *);
void tdata_label_free(tdata_t *);
@@ -434,17 +434,13 @@ int streq(const char *, const char *);
int findelfsecidx(Elf *, const char *, const char *);
size_t elf_ptrsz(Elf *);
char *mktmpname(const char *, const char *);
-void terminate(const char *, ...);
-void aborterr(const char *, ...);
-void set_terminate_cleanup(void (*)(void));
+void terminate(char *, ...);
+void aborterr(char *, ...);
+void set_terminate_cleanup(void (*)());
void elfterminate(const char *, const char *, ...);
-void warning(const char *, ...);
-void vadebug(int, const char *, va_list);
-void debug(int, const char *, ...);
-
-
-void watch_dump(int);
-void watch_set(void *, int);
+void warning(char *, ...);
+void vadebug(int, char *, va_list);
+void debug(int, char *, ...);
#ifdef __cplusplus
}
diff --git a/tools/ctf/cvt/dwarf.c b/tools/ctf/cvt/dwarf.c
index 19aeff2c7942..a7e97dfb23a1 100644
--- a/tools/ctf/cvt/dwarf.c
+++ b/tools/ctf/cvt/dwarf.c
@@ -84,7 +84,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <strings.h>
#include <errno.h>
#include <libelf.h>
@@ -129,7 +128,7 @@
typedef struct dwarf {
Dwarf_Debug dw_dw; /* for libdwarf */
Dwarf_Error dw_err; /* for libdwarf */
- Dwarf_Off dw_maxoff; /* highest legal offset in this cu */
+ Dwarf_Unsigned dw_maxoff; /* highest legal offset in this cu */
tdata_t *dw_td; /* root of the tdesc/iidesc tree */
hash_t *dw_tidhash; /* hash of tdescs by t_id */
hash_t *dw_fwdhash; /* hash of fwd decls by name */
@@ -160,12 +159,11 @@ tdesc_add(dwarf_t *dw, tdesc_t *tdp)
static tdesc_t *
tdesc_lookup(dwarf_t *dw, int tid)
{
- tdesc_t tmpl;
- void *tdp;
+ tdesc_t tmpl, *tdp;
tmpl.t_id = tid;
- if (hash_find(dw->dw_tidhash, &tmpl, &tdp))
+ if (hash_find(dw->dw_tidhash, &tmpl, (void **)&tdp))
return (tdp);
else
return (NULL);
@@ -273,7 +271,7 @@ die_off(dwarf_t *dw, Dwarf_Die die)
return (off);
terminate("failed to get offset for die: %s\n",
- dwarf_errmsg(&dw->dw_err));
+ dwarf_errmsg(dw->dw_err));
/*NOTREACHED*/
return (0);
}
@@ -291,7 +289,7 @@ die_sibling(dwarf_t *dw, Dwarf_Die die)
return (NULL);
terminate("die %llu: failed to find type sibling: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
+ die_off(dw, die), dwarf_errmsg(dw->dw_err));
/*NOTREACHED*/
return (NULL);
}
@@ -308,7 +306,7 @@ die_child(dwarf_t *dw, Dwarf_Die die)
return (NULL);
terminate("die %llu: failed to find type child: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
+ die_off(dw, die), dwarf_errmsg(dw->dw_err));
/*NOTREACHED*/
return (NULL);
}
@@ -322,7 +320,7 @@ die_tag(dwarf_t *dw, Dwarf_Die die)
return (tag);
terminate("die %llu: failed to get tag for type: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
+ die_off(dw, die), dwarf_errmsg(dw->dw_err));
/*NOTREACHED*/
return (0);
}
@@ -345,23 +343,43 @@ die_attr(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, int req)
}
terminate("die %llu: failed to get attribute for type: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
+ die_off(dw, die), dwarf_errmsg(dw->dw_err));
/*NOTREACHED*/
return (NULL);
}
+static Dwarf_Half
+die_attr_form(dwarf_t *dw, Dwarf_Attribute attr)
+{
+ Dwarf_Half form;
+
+ if (dwarf_whatform(attr, &form, &dw->dw_err) == DW_DLV_OK)
+ return (form);
+
+ terminate("failed to get attribute form for type: %s\n",
+ dwarf_errmsg(dw->dw_err));
+ /*NOTREACHED*/
+ return (0);
+}
+
static int
die_signed(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, Dwarf_Signed *valp,
int req)
{
- *valp = 0;
- if (dwarf_attrval_signed(die, name, valp, &dw->dw_err) != DWARF_E_NONE) {
- if (req)
- terminate("die %llu: failed to get signed: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
- return (0);
+ Dwarf_Attribute attr;
+ Dwarf_Signed val;
+
+ if ((attr = die_attr(dw, die, name, req)) == NULL)
+ return (0); /* die_attr will terminate for us if necessary */
+
+ if (dwarf_formsdata(attr, &val, &dw->dw_err) != DW_DLV_OK) {
+ terminate("die %llu: failed to get signed (form 0x%x)\n",
+ die_off(dw, die), die_attr_form(dw, attr));
}
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
+
+ *valp = val;
return (1);
}
@@ -369,47 +387,59 @@ static int
die_unsigned(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, Dwarf_Unsigned *valp,
int req)
{
- *valp = 0;
- if (dwarf_attrval_unsigned(die, name, valp, &dw->dw_err) != DWARF_E_NONE) {
- if (req)
- terminate("die %llu: failed to get unsigned: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
- return (0);
+ Dwarf_Attribute attr;
+ Dwarf_Unsigned val;
+
+ if ((attr = die_attr(dw, die, name, req)) == NULL)
+ return (0); /* die_attr will terminate for us if necessary */
+
+ if (dwarf_formudata(attr, &val, &dw->dw_err) != DW_DLV_OK) {
+ terminate("die %llu: failed to get unsigned (form 0x%x)\n",
+ die_off(dw, die), die_attr_form(dw, attr));
}
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
+
+ *valp = val;
return (1);
}
static int
die_bool(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, Dwarf_Bool *valp, int req)
{
- *valp = 0;
+ Dwarf_Attribute attr;
+ Dwarf_Bool val;
+
+ if ((attr = die_attr(dw, die, name, req)) == NULL)
+ return (0); /* die_attr will terminate for us if necessary */
- if (dwarf_attrval_flag(die, name, valp, &dw->dw_err) != DWARF_E_NONE) {
- if (req)
- terminate("die %llu: failed to get flag: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
- return (0);
+ if (dwarf_formflag(attr, &val, &dw->dw_err) != DW_DLV_OK) {
+ terminate("die %llu: failed to get bool (form 0x%x)\n",
+ die_off(dw, die), die_attr_form(dw, attr));
}
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
+
+ *valp = val;
return (1);
}
static int
die_string(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, char **strp, int req)
{
- const char *str = NULL;
+ Dwarf_Attribute attr;
+ char *str;
- if (dwarf_attrval_string(die, name, &str, &dw->dw_err) != DWARF_E_NONE ||
- str == NULL) {
- if (req)
- terminate("die %llu: failed to get string: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
- else
- *strp = NULL;
- return (0);
- } else
- *strp = xstrdup(str);
+ if ((attr = die_attr(dw, die, name, req)) == NULL)
+ return (0); /* die_attr will terminate for us if necessary */
+
+ if (dwarf_formstring(attr, &str, &dw->dw_err) != DW_DLV_OK) {
+ terminate("die %llu: failed to get string (form 0x%x)\n",
+ die_off(dw, die), die_attr_form(dw, attr));
+ }
+
+ *strp = xstrdup(str);
+ dwarf_dealloc(dw->dw_dw, str, DW_DLA_STRING);
return (1);
}
@@ -417,13 +447,18 @@ die_string(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name, char **strp, int req)
static Dwarf_Off
die_attr_ref(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name)
{
+ Dwarf_Attribute attr;
Dwarf_Off off;
- if (dwarf_attrval_unsigned(die, name, &off, &dw->dw_err) != DWARF_E_NONE) {
- terminate("die %llu: failed to get ref: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
+ attr = die_attr(dw, die, name, DW_ATTR_REQ);
+
+ if (dwarf_formref(attr, &off, &dw->dw_err) != DW_DLV_OK) {
+ terminate("die %llu: failed to get ref (form 0x%x)\n",
+ die_off(dw, die), die_attr_form(dw, attr));
}
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
+
return (off);
}
@@ -487,13 +522,21 @@ die_lookup_pass1(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name)
static int
die_mem_offset(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name,
- Dwarf_Unsigned *valp, int req __unused)
+ Dwarf_Unsigned *valp, int req)
{
- Dwarf_Locdesc *loc = NULL;
- Dwarf_Signed locnum = 0;
+ Dwarf_Attribute attr;
+ Dwarf_Locdesc *loc;
+ Dwarf_Signed locnum;
+
+ if ((attr = die_attr(dw, die, name, req)) == NULL)
+ return (0); /* die_attr will terminate for us if necessary */
+
+ if (dwarf_loclist(attr, &loc, &locnum, &dw->dw_err) != DW_DLV_OK) {
+ terminate("die %llu: failed to get mem offset location list\n",
+ die_off(dw, die));
+ }
- if (dwarf_locdesc(die, name, &loc, &locnum, &dw->dw_err) != DW_DLV_OK)
- return (0);
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
if (locnum != 1 || loc->ld_s->lr_atom != DW_OP_plus_uconst) {
terminate("die %llu: cannot parse member offset\n",
@@ -502,10 +545,8 @@ die_mem_offset(dwarf_t *dw, Dwarf_Die die, Dwarf_Half name,
*valp = loc->ld_s->lr_number;
- if (loc != NULL)
- if (dwarf_locdesc_free(loc, &dw->dw_err) != DW_DLV_OK)
- terminate("die %llu: cannot free location descriptor: %s\n",
- die_off(dw, die), dwarf_errmsg(&dw->dw_err));
+ dwarf_dealloc(dw->dw_dw, loc->ld_s, DW_DLA_LOC_BLOCK);
+ dwarf_dealloc(dw->dw_dw, loc, DW_DLA_LOCDESC);
return (1);
}
@@ -599,7 +640,7 @@ tdesc_array_create(dwarf_t *dw, Dwarf_Die dim, tdesc_t *arrtdp,
{
Dwarf_Unsigned uval;
Dwarf_Signed sval;
- tdesc_t *ctdp = NULL;
+ tdesc_t *ctdp;
Dwarf_Die dim2;
ardef_t *ar;
@@ -662,7 +703,7 @@ die_array_create(dwarf_t *dw, Dwarf_Die arr, Dwarf_Off off, tdesc_t *tdp)
Dwarf_Unsigned uval;
Dwarf_Die dim;
- debug(3, "die %llu <%llx>: creating array\n", off, off);
+ debug(3, "die %llu: creating array\n", off);
if ((dim = die_child(dw, arr)) == NULL ||
die_tag(dw, dim) != DW_TAG_subrange_type)
@@ -693,13 +734,13 @@ die_array_create(dwarf_t *dw, Dwarf_Die arr, Dwarf_Off off, tdesc_t *tdp)
tdp->t_flags |= flags;
}
- debug(3, "die %llu <%llx>: array nelems %u size %u\n", off, off,
+ debug(3, "die %llu: array nelems %u size %u\n", off,
tdp->t_ardef->ad_nelems, tdp->t_size);
}
/*ARGSUSED1*/
static int
-die_array_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
+die_array_resolve(tdesc_t *tdp, tdesc_t **tdpp, void *private)
{
dwarf_t *dw = private;
size_t sz;
@@ -729,7 +770,7 @@ die_array_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
/*ARGSUSED1*/
static int
-die_array_failed(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private __unused)
+die_array_failed(tdesc_t *tdp, tdesc_t **tdpp, void *private)
{
tdesc_t *cont = tdp->t_ardef->ad_contents;
@@ -825,7 +866,7 @@ die_enum_match(void *arg1, void *arg2)
/*ARGSUSED1*/
static int
-die_enum_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
+die_enum_resolve(tdesc_t *tdp, tdesc_t **tdpp, void *private)
{
dwarf_t *dw = private;
tdesc_t *full = NULL;
@@ -897,9 +938,8 @@ die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
/*
* GCC allows empty SOUs as an extension.
*/
- if ((mem = die_child(dw, str)) == NULL) {
+ if ((mem = die_child(dw, str)) == NULL)
goto out;
- }
mlastp = &tdp->t_members;
@@ -926,7 +966,7 @@ die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
* bug 11816).
*/
if ((ml->ml_name = die_name(dw, mem)) == NULL)
- ml->ml_name = NULL;
+ ml->ml_name = "";
ml->ml_type = die_lookup_pass1(dw, mem, DW_AT_type);
@@ -943,7 +983,7 @@ die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
ml->ml_size = tdesc_bitsize(ml->ml_type);
if (die_unsigned(dw, mem, DW_AT_bit_offset, &bitoff, 0)) {
-#if BYTE_ORDER == _BIG_ENDIAN
+#ifdef _BIG_ENDIAN
ml->ml_offset += bitoff;
#else
ml->ml_offset += tdesc_bitsize(ml->ml_type) - bitoff -
@@ -1017,7 +1057,7 @@ die_union_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
/*ARGSUSED1*/
static int
-die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
+die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp, void *private)
{
dwarf_t *dw = private;
mlist_t *ml;
@@ -1076,7 +1116,7 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
/*ARGSUSED1*/
static int
-die_sou_failed(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private __unused)
+die_sou_failed(tdesc_t *tdp, tdesc_t **tdpp, void *private)
{
const char *typename = (tdp->t_type == STRUCT ? "struct" : "union");
mlist_t *ml;
@@ -1086,11 +1126,10 @@ die_sou_failed(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private __unused)
for (ml = tdp->t_members; ml != NULL; ml = ml->ml_next) {
if (ml->ml_size == 0) {
- fprintf(stderr, "%s %d <%x>: failed to size member \"%s\" "
- "of type %s (%d <%x>)\n", typename, tdp->t_id,
- tdp->t_id,
+ fprintf(stderr, "%s %d: failed to size member \"%s\" "
+ "of type %s (%d)\n", typename, tdp->t_id,
ml->ml_name, tdesc_name(ml->ml_type),
- ml->ml_type->t_id, ml->ml_type->t_id);
+ ml->ml_type->t_id);
}
}
@@ -1106,7 +1145,7 @@ die_funcptr_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
fndef_t *fn;
int i;
- debug(3, "die %llu <%llx>: creating function pointer\n", off, off);
+ debug(3, "die %llu: creating function pointer\n", off);
/*
* We'll begin by processing any type definition nodes that may be
@@ -1136,6 +1175,7 @@ die_funcptr_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
tdp->t_type = FUNCTION;
if ((attr = die_attr(dw, die, DW_AT_type, 0)) != NULL) {
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
fn->fn_ret = die_lookup_pass1(dw, die, DW_AT_type);
} else {
fn->fn_ret = tdesc_intr_void(dw);
@@ -1159,7 +1199,7 @@ die_funcptr_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
fn->fn_args = xcalloc(sizeof (tdesc_t *) * fn->fn_nargs);
for (i = 0, arg = die_child(dw, die);
- arg != NULL && i < (int) fn->fn_nargs;
+ arg != NULL && i < fn->fn_nargs;
arg = die_sibling(dw, arg)) {
if (die_tag(dw, arg) != DW_TAG_formal_parameter)
continue;
@@ -1184,8 +1224,7 @@ static intr_t *
die_base_name_parse(const char *name, char **newp)
{
char buf[100];
- char const *base;
- char *c;
+ char *base, *c;
int nlong = 0, nshort = 0, nchar = 0, nint = 0;
int sign = 1;
char fmt = '\0';
@@ -1269,7 +1308,7 @@ static const fp_size_map_t fp_encodings[] = {
#else
{ { 12, 16 }, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } },
#endif
- { { 0, 0 }, { 0, 0, 0 } }
+ { { 0, 0 } }
};
static uint_t
@@ -1282,11 +1321,8 @@ die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Signed enc, size_t sz)
if (enc == DW_ATE_complex_float) {
mult = 2;
col = 1;
- } else if (enc == DW_ATE_imaginary_float
-#if defined(sun)
- || enc == DW_ATE_SUN_imaginary_float
-#endif
- )
+ } else if (enc == DW_ATE_imaginary_float ||
+ enc == DW_ATE_SUN_imaginary_float)
col = 2;
while (map->fsm_typesz[szidx] != 0) {
@@ -1334,10 +1370,8 @@ die_base_from_dwarf(dwarf_t *dw, Dwarf_Die base, Dwarf_Off off, size_t sz)
case DW_ATE_float:
case DW_ATE_complex_float:
case DW_ATE_imaginary_float:
-#if defined(sun)
case DW_ATE_SUN_imaginary_float:
case DW_ATE_SUN_interval_float:
-#endif
intr->intr_type = INTR_REAL;
intr->intr_signed = 1;
intr->intr_fformat = die_base_type2enc(dw, off, enc, sz);
@@ -1407,11 +1441,12 @@ die_through_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp,
{
Dwarf_Attribute attr;
- debug(3, "die %llu <%llx>: creating %s type %d\n", off, off, typename, type);
+ debug(3, "die %llu: creating %s\n", off, typename);
tdp->t_type = type;
if ((attr = die_attr(dw, die, DW_AT_type, 0)) != NULL) {
+ dwarf_dealloc(dw->dw_dw, attr, DW_DLA_ATTR);
tdp->t_tdesc = die_lookup_pass1(dw, die, DW_AT_type);
} else {
tdp->t_tdesc = tdesc_intr_void(dw);
@@ -1464,14 +1499,14 @@ die_volatile_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
/*ARGSUSED3*/
static void
-die_function_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp __unused)
+die_function_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
{
Dwarf_Die arg;
Dwarf_Half tag;
iidesc_t *ii;
char *name;
- debug(3, "die %llu <%llx>: creating function definition\n", off, off);
+ debug(3, "die %llu: creating function definition\n", off);
/*
* We'll begin by processing any type definition nodes that may be
@@ -1510,7 +1545,7 @@ die_function_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp __un
for (arg = die_child(dw, die); arg != NULL;
arg = die_sibling(dw, arg)) {
- char *name1;
+ char *name;
debug(3, "die %llu: looking at sub member at %llu\n",
off, die_off(dw, die));
@@ -1518,13 +1553,13 @@ die_function_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp __un
if (die_tag(dw, arg) != DW_TAG_formal_parameter)
continue;
- if ((name1 = die_name(dw, arg)) == NULL) {
+ if ((name = die_name(dw, arg)) == NULL) {
terminate("die %llu: func arg %d has no name\n",
off, ii->ii_nargs + 1);
}
- if (strcmp(name1, "...") == 0) {
- free(name1);
+ if (strcmp(name, "...") == 0) {
+ free(name);
ii->ii_vargs = 1;
continue;
}
@@ -1556,7 +1591,7 @@ die_function_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp __un
/*ARGSUSED3*/
static void
-die_variable_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp __unused)
+die_variable_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
{
iidesc_t *ii;
char *name;
@@ -1578,7 +1613,7 @@ die_variable_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp __un
/*ARGSUSED2*/
static int
-die_fwd_resolve(tdesc_t *fwd, tdesc_t **fwdp, void *private __unused)
+die_fwd_resolve(tdesc_t *fwd, tdesc_t **fwdp, void *private)
{
if (fwd->t_flags & TDESC_F_RESOLVED)
return (1);
@@ -1596,7 +1631,7 @@ die_fwd_resolve(tdesc_t *fwd, tdesc_t **fwdp, void *private __unused)
/*ARGSUSED*/
static void
-die_lexblk_descend(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off __unused, tdesc_t *tdp __unused)
+die_lexblk_descend(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
{
Dwarf_Die child = die_child(dw, die);
@@ -1634,7 +1669,7 @@ static const die_creator_t die_creators[] = {
{ DW_TAG_variable, DW_F_NOTDP, die_variable_create },
{ DW_TAG_volatile_type, 0, die_volatile_create },
{ DW_TAG_restrict_type, 0, die_restrict_create },
- { 0, 0, NULL }
+ { 0, NULL }
};
static const die_creator_t *
@@ -1658,7 +1693,7 @@ die_create_one(dwarf_t *dw, Dwarf_Die die)
Dwarf_Half tag;
tdesc_t *tdp;
- debug(3, "die %llu <%llx>: create_one\n", off, off);
+ debug(3, "die %llu: create_one\n", off);
if (off > dw->dw_maxoff) {
terminate("illegal die offset %llu (max %llu)\n", off,
@@ -1742,7 +1777,7 @@ die_resolve(dwarf_t *dw)
debug(3, "resolve: pass %d, %u left\n", pass, dw->dw_nunres);
- if ((int) dw->dw_nunres == last) {
+ if (dw->dw_nunres == last) {
fprintf(stderr, "%s: failed to resolve the following "
"types:\n", progname);
@@ -1760,12 +1795,11 @@ die_resolve(dwarf_t *dw)
/*ARGSUSED*/
int
-dw_read(tdata_t *td, Elf *elf, char *filename __unused)
+dw_read(tdata_t *td, Elf *elf, const char *filename)
{
Dwarf_Unsigned abboff, hdrlen, nxthdr;
Dwarf_Half vers, addrsz;
- Dwarf_Die cu = 0;
- Dwarf_Die child = 0;
+ Dwarf_Die cu, child;
dwarf_t dw;
char *prod = NULL;
int rc;
@@ -1780,12 +1814,12 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused)
dw.dw_enumhash = hash_new(TDESC_HASH_BUCKETS, tdesc_namehash,
tdesc_namecmp);
- if ((rc = dwarf_elf_init(elf, DW_DLC_READ, &dw.dw_dw,
+ if ((rc = dwarf_elf_init(elf, DW_DLC_READ, NULL, NULL, &dw.dw_dw,
&dw.dw_err)) == DW_DLV_NO_ENTRY) {
errno = ENOENT;
return (-1);
} else if (rc != DW_DLV_OK) {
- if (dwarf_errno(&dw.dw_err) == DW_DLE_DEBUG_INFO_NULL) {
+ if (dwarf_errno(dw.dw_err) == DW_DLE_DEBUG_INFO_NULL) {
/*
* There's no type data in the DWARF section, but
* libdwarf is too clever to handle that properly.
@@ -1794,14 +1828,13 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused)
}
terminate("failed to initialize DWARF: %s\n",
- dwarf_errmsg(&dw.dw_err));
+ dwarf_errmsg(dw.dw_err));
}
if ((rc = dwarf_next_cu_header(dw.dw_dw, &hdrlen, &vers, &abboff,
- &addrsz, &nxthdr, &dw.dw_err)) != DW_DLV_OK)
- terminate("rc = %d %s\n", rc, dwarf_errmsg(&dw.dw_err));
-
- if ((cu = die_sibling(&dw, NULL)) == NULL)
+ &addrsz, &nxthdr, &dw.dw_err)) != DW_DLV_OK ||
+ (cu = die_sibling(&dw, NULL)) == NULL ||
+ (child = die_child(&dw, cu)) == NULL)
terminate("file does not contain dwarf type data "
"(try compiling with -g)\n");
@@ -1829,14 +1862,13 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused)
debug(1, "CU name: %s\n", dw.dw_cuname);
}
- if ((child = die_child(&dw, cu)) != NULL)
- die_create(&dw, child);
+ die_create(&dw, child);
if ((rc = dwarf_next_cu_header(dw.dw_dw, &hdrlen, &vers, &abboff,
&addrsz, &nxthdr, &dw.dw_err)) != DW_DLV_NO_ENTRY)
terminate("multiple compilation units not supported\n");
- (void) dwarf_finish(&dw.dw_dw, &dw.dw_err);
+ (void) dwarf_finish(dw.dw_dw, &dw.dw_err);
die_resolve(&dw);
diff --git a/tools/ctf/cvt/fixup_tdescs.c b/tools/ctf/cvt/fixup_tdescs.c
index b239a62dc53b..8524693d02fd 100644
--- a/tools/ctf/cvt/fixup_tdescs.c
+++ b/tools/ctf/cvt/fixup_tdescs.c
@@ -52,17 +52,17 @@
static void
fix_ptrptr_to_struct(tdata_t *td)
{
- const char *strs[2] = { "as", "fdbuffer" };
- const char *mems[2] = { "a_objectdir", "fd_shadow" };
- const char *acts[2] = { "vnode", "page" };
- const char *tgts[2] = { "vnode_t", "page_t" };
+ char *strs[2] = { "as", "fdbuffer" };
+ char *mems[2] = { "a_objectdir", "fd_shadow" };
+ char *acts[2] = { "vnode", "page" };
+ char *tgts[2] = { "vnode_t", "page_t" };
tdesc_t *str;
tdesc_t *act, *tgt;
tdesc_t *p1, *p2;
mlist_t *ml;
int i;
- for (i = 0; i < (int) (sizeof (strs) / sizeof (strs[0])); i++) {
+ for (i = 0; i < sizeof (strs) / sizeof (strs[0]); i++) {
if (!(str = lookupname(strs[i])) || str->t_type != STRUCT)
continue;
@@ -106,8 +106,8 @@ fix_ptrptr_to_struct(tdata_t *td)
static void
fix_ptr_to_struct(tdata_t *td)
{
- const char *strs[2] = { "vmem", "id_space" };
- const char *mems[2] = { NULL, "is_vmem" };
+ char *strs[2] = { "vmem", "id_space" };
+ char *mems[2] = { NULL, "is_vmem" };
tdesc_t *ptr = NULL;
tdesc_t *str, *vmt;
mlist_t *ml;
@@ -116,7 +116,7 @@ fix_ptr_to_struct(tdata_t *td)
if ((vmt = lookupname("vmem_t")) == NULL || vmt->t_type != TYPEDEF)
return;
- for (i = 0; i < (int) (sizeof (strs) / sizeof (strs[0])); i++) {
+ for (i = 0; i < sizeof (strs) / sizeof (strs[0]); i++) {
if (!(str = lookupname(strs[i])) || str->t_type != STRUCT)
continue;
@@ -163,10 +163,8 @@ struct match {
};
static int
-matching_iidesc(void *arg1, void *arg2)
+matching_iidesc(iidesc_t *iidesc, struct match *match)
{
- iidesc_t *iidesc = arg1;
- struct match *match = arg2;
if (!streq(iidesc->ii_name, match->m_name))
return (0);
@@ -178,10 +176,10 @@ matching_iidesc(void *arg1, void *arg2)
}
static tdesc_t *
-lookup_tdesc(tdata_t *td, char const *name)
+lookup_tdesc(tdata_t *td, const char *name)
{
struct match match = { NULL, name };
- iter_iidescs_by_name(td, name, matching_iidesc, &match);
+ iter_iidescs_by_name(td, name, (int (*)())matching_iidesc, &match);
return (match.m_ret);
}
diff --git a/tools/ctf/cvt/hash.c b/tools/ctf/cvt/hash.c
index 36ed45a30f0a..e3c2978f6ed3 100644
--- a/tools/ctf/cvt/hash.c
+++ b/tools/ctf/cvt/hash.c
@@ -50,7 +50,7 @@ struct hash {
struct hash_data {
hash_t *hd_hash;
- int (*hd_fun)(void *, void *);
+ int (*hd_fun)();
void *hd_key;
void *hd_private;
@@ -58,14 +58,13 @@ struct hash_data {
};
static int
-hash_def_hash(int nbuckets, void *arg)
+hash_def_hash(int nbuckets, uintptr_t data)
{
- uintptr_t data = (uintptr_t) arg;
return (data % nbuckets);
}
static int
-hash_def_cmp(void *d1, void *d2)
+hash_def_cmp(uintptr_t d1, uintptr_t d2)
{
return (d1 != d2);
}
@@ -97,8 +96,8 @@ hash_new(int nbuckets, int (*hashfn)(int, void *), int (*cmp)(void *, void *))
hash = xmalloc(sizeof (hash_t));
hash->h_buckets = xcalloc(sizeof (list_t *) * nbuckets);
hash->h_nbuckets = nbuckets;
- hash->h_hashfn = hashfn ? hashfn : hash_def_hash;
- hash->h_cmp = cmp ? cmp : hash_def_cmp;
+ hash->h_hashfn = hashfn ? hashfn : (int (*)())hash_def_hash;
+ hash->h_cmp = cmp ? cmp : (int (*)())hash_def_cmp;
return (hash);
}
@@ -125,9 +124,8 @@ hash_merge(hash_t *to, hash_t *from)
}
static int
-hash_remove_cb(void *key1, void *key2, void *arg)
+hash_remove_cb(void *key1, void *key2, hash_t *hash)
{
- hash_t *hash = arg;
return (hash->h_cmp(key1, key2));
}
@@ -137,7 +135,7 @@ hash_remove(hash_t *hash, void *key)
int bucket = hash->h_hashfn(hash->h_nbuckets, key);
(void) list_remove(&hash->h_buckets[bucket], key,
- hash_remove_cb, hash);
+ (int (*)())hash_remove_cb, hash);
}
int
@@ -150,9 +148,8 @@ hash_match(hash_t *hash, void *key, int (*fun)(void *, void *),
}
static int
-hash_find_list_cb(void *node, void *arg)
+hash_find_list_cb(void *node, struct hash_data *hd)
{
- struct hash_data *hd = arg;
int cbrc;
int rc = 0;
@@ -177,15 +174,14 @@ hash_find_iter(hash_t *hash, void *key, int (*fun)(void *, void *),
hd.hd_key = key;
hd.hd_private = private;
- return (list_iter(hash->h_buckets[bucket], hash_find_list_cb,
+ return (list_iter(hash->h_buckets[bucket], (int (*)())hash_find_list_cb,
&hd));
}
/* stop on first match */
static int
-hash_find_first_cb(void *node, void *arg)
+hash_find_first_cb(void *node, struct hash_data *hd)
{
- struct hash_data *hd = arg;
if (hd->hd_hash->h_cmp(hd->hd_key, node) == 0) {
hd->hd_ret = node;
return (-1);
@@ -204,7 +200,7 @@ hash_find(hash_t *hash, void *key, void **value)
hd.hd_fun = hash_find_first_cb;
hd.hd_key = key;
- ret = hash_match(hash, key, hash_find_first_cb, &hd);
+ ret = hash_match(hash, key, (int (*)())hash_find_first_cb, &hd);
if (ret && value)
*value = hd.hd_ret;
diff --git a/tools/ctf/cvt/iidesc.c b/tools/ctf/cvt/iidesc.c
index fc1cefc9321b..b6b9a0c7f235 100644
--- a/tools/ctf/cvt/iidesc.c
+++ b/tools/ctf/cvt/iidesc.c
@@ -68,10 +68,8 @@ iidesc_hash(int nbuckets, void *arg)
}
static int
-iidesc_cmp(void *arg1, void *arg2)
+iidesc_cmp(iidesc_t *src, iidesc_find_t *find)
{
- iidesc_t *src = arg1;
- iidesc_find_t *find = arg2;
iidesc_t *tgt = find->iif_tgt;
if (src->ii_type != tgt->ii_type ||
@@ -91,7 +89,7 @@ iidesc_add(hash_t *hash, iidesc_t *new)
find.iif_tgt = new;
find.iif_ret = NULL;
- (void) hash_match(hash, new, iidesc_cmp, &find);
+ (void) hash_match(hash, new, (int (*)())iidesc_cmp, &find);
if (find.iif_ret != NULL) {
iidesc_t *old = find.iif_ret;
@@ -109,14 +107,13 @@ iidesc_add(hash_t *hash, iidesc_t *new)
}
void
-iter_iidescs_by_name(tdata_t *td, char const *name,
- int (*func)(void *, void *), void *data)
+iter_iidescs_by_name(tdata_t *td, const char *name,
+ int (*func)(iidesc_t *, void *), void *data)
{
iidesc_t tmpdesc;
- bzero(&tmpdesc, sizeof(tmpdesc));
- tmpdesc.ii_name = xstrdup(name);
- (void) hash_match(td->td_iihash, &tmpdesc, func, data);
- free(tmpdesc.ii_name);
+ bzero(&tmpdesc, sizeof (iidesc_t));
+ tmpdesc.ii_name = (char *)name;
+ (void) hash_match(td->td_iihash, &tmpdesc, (int (*)())func, data);
}
iidesc_t *
@@ -154,9 +151,8 @@ iidesc_dup_rename(iidesc_t *src, char const *name, char const *owner)
/*ARGSUSED*/
void
-iidesc_free(void *arg, void *private __unused)
+iidesc_free(iidesc_t *idp, void *private)
{
- iidesc_t *idp = arg;
if (idp->ii_name)
free(idp->ii_name);
if (idp->ii_nargs)
diff --git a/tools/ctf/cvt/input.c b/tools/ctf/cvt/input.c
index 67ebde702298..d901e5340b57 100644
--- a/tools/ctf/cvt/input.c
+++ b/tools/ctf/cvt/input.c
@@ -71,7 +71,6 @@ built_source_types(Elf *elf, char const *file)
/* ignore */
break;
case 's':
- case 'S':
types |= SOURCE_S;
break;
default:
@@ -88,7 +87,7 @@ read_file(Elf *elf, char *file, char *label, read_cb_f *func, void *arg,
int require_ctf)
{
Elf_Scn *ctfscn;
- Elf_Data *ctfdata = NULL;
+ Elf_Data *ctfdata;
symit_data_t *si = NULL;
int ctfscnidx;
tdata_t *td;
@@ -221,7 +220,7 @@ read_ctf_common(char *file, char *label, read_cb_f *func, void *arg,
/*ARGSUSED*/
int
-read_ctf_save_cb(tdata_t *td, char *name __unused, void *retp)
+read_ctf_save_cb(tdata_t *td, char *name, void *retp)
{
tdata_t **tdp = retp;
diff --git a/tools/ctf/cvt/merge.c b/tools/ctf/cvt/merge.c
index 2ef37d460b36..2af28b65a2f9 100644
--- a/tools/ctf/cvt/merge.c
+++ b/tools/ctf/cvt/merge.c
@@ -132,7 +132,7 @@ typedef struct merge_cb_data merge_cb_data_t;
* own traversal mechanism and ops vector here for those two cases.
*/
typedef struct tdesc_ops {
- const char *name;
+ char *name;
int (*equiv)(tdesc_t *, tdesc_t *, equiv_data_t *);
tdesc_t *(*conjure)(tdesc_t *, int, merge_cb_data_t *);
} tdesc_ops_t;
@@ -179,21 +179,21 @@ struct merge_cb_data {
static void
add_mapping(alist_t *ta, tid_t srcid, tid_t tgtid)
{
- debug(3, "Adding mapping %u <%x> => %u <%x>\n", srcid, srcid, tgtid, tgtid);
+ debug(3, "Adding mapping %u => %u\n", srcid, tgtid);
- assert(!alist_find(ta, (void *)(uintptr_t)srcid, NULL));
+ assert(!alist_find(ta, (void *)srcid, NULL));
assert(srcid != 0 && tgtid != 0);
- alist_add(ta, (void *)(uintptr_t)srcid, (void *)(uintptr_t)tgtid);
+ alist_add(ta, (void *)srcid, (void *)tgtid);
}
static tid_t
get_mapping(alist_t *ta, int srcid)
{
- void *ltgtid;
+ long ltgtid;
- if (alist_find(ta, (void *)(uintptr_t)srcid, (void **)&ltgtid))
- return ((uintptr_t)ltgtid);
+ if (alist_find(ta, (void *)srcid, (void **)&ltgtid))
+ return ((int)ltgtid);
else
return (0);
}
@@ -216,7 +216,7 @@ static int equiv_node(tdesc_t *, tdesc_t *, equiv_data_t *);
/*ARGSUSED2*/
static int
-equiv_intrinsic(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed __unused)
+equiv_intrinsic(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
{
intr_t *si = stdp->t_intr;
intr_t *ti = ttdp->t_intr;
@@ -256,7 +256,7 @@ equiv_function(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
if (!equiv_node(fn1->fn_ret, fn2->fn_ret, ed))
return (0);
- for (i = 0; i < (int) fn1->fn_nargs; i++) {
+ for (i = 0; i < fn1->fn_nargs; i++) {
if (!equiv_node(fn1->fn_args[i], fn2->fn_args[i], ed))
return (0);
}
@@ -313,7 +313,7 @@ equiv_su(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
/*ARGSUSED2*/
static int
-equiv_enum(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed __unused)
+equiv_enum(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
{
elist_t *el1 = stdp->t_emem;
elist_t *el2 = ttdp->t_emem;
@@ -335,7 +335,7 @@ equiv_enum(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed __unused)
/*ARGSUSED*/
static int
-equiv_assert(tdesc_t *stdp __unused, tdesc_t *ttdp __unused, equiv_data_t *ed __unused)
+equiv_assert(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
{
/* foul, evil, and very bad - this is a "shouldn't happen" */
assert(1 == 0);
@@ -354,7 +354,7 @@ fwd_equiv(tdesc_t *ctdp, tdesc_t *mtdp)
static int
equiv_node(tdesc_t *ctdp, tdesc_t *mtdp, equiv_data_t *ed)
{
- int (*equiv)(tdesc_t *, tdesc_t *, equiv_data_t *);
+ int (*equiv)();
int mapping;
if (ctdp->t_emark > ed->ed_clear_mark ||
@@ -418,8 +418,7 @@ equiv_cb(void *bucket, void *arg)
ed->ed_cur_mark = ed->ed_clear_mark + 1;
if (equiv_node(ctdp, mtdp, ed)) {
- debug(3, "equiv_node matched %d <%x> %d <%x>\n",
- ctdp->t_id, ctdp->t_id, mtdp->t_id, mtdp->t_id);
+ debug(3, "equiv_node matched %d %d\n", ctdp->t_id, mtdp->t_id);
ed->ed_tgt = mtdp;
/* matched. stop looking */
return (-1);
@@ -430,7 +429,7 @@ equiv_cb(void *bucket, void *arg)
/*ARGSUSED1*/
static int
-map_td_tree_pre(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
+map_td_tree_pre(tdesc_t *ctdp, tdesc_t **ctdpp, void *private)
{
merge_cb_data_t *mcd = private;
@@ -442,7 +441,7 @@ map_td_tree_pre(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
/*ARGSUSED1*/
static int
-map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
+map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp, void *private)
{
merge_cb_data_t *mcd = private;
equiv_data_t ed;
@@ -453,7 +452,7 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
ed.ed_node = ctdp;
ed.ed_selfuniquify = 0;
- debug(3, "map_td_tree_post on %d <%x> %s\n", ctdp->t_id, ctdp->t_id,tdesc_name(ctdp));
+ debug(3, "map_td_tree_post on %d %s\n", ctdp->t_id, tdesc_name(ctdp));
if (hash_find_iter(mcd->md_parent->td_layouthash, ctdp,
equiv_cb, &ed) < 0) {
@@ -461,7 +460,7 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
if (ed.ed_tgt->t_type == FORWARD && ctdp->t_type != FORWARD) {
int id = mcd->md_tgt->td_nextid++;
- debug(3, "Creating new defn type %d <%x>\n", id, id);
+ debug(3, "Creating new defn type %d\n", id);
add_mapping(mcd->md_ta, ctdp->t_id, id);
alist_add(mcd->md_fdida, (void *)(ulong_t)ed.ed_tgt,
(void *)(ulong_t)id);
@@ -482,7 +481,7 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
} else {
int id = mcd->md_tgt->td_nextid++;
- debug(3, "Creating new type %d <%x>\n", id, id);
+ debug(3, "Creating new type %d\n", id);
add_mapping(mcd->md_ta, ctdp->t_id, id);
hash_add(mcd->md_tdtba, ctdp);
}
@@ -494,7 +493,7 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
/*ARGSUSED1*/
static int
-map_td_tree_self_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
+map_td_tree_self_post(tdesc_t *ctdp, tdesc_t **ctdpp, void *private)
{
merge_cb_data_t *mcd = private;
equiv_data_t ed;
@@ -507,8 +506,8 @@ map_td_tree_self_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
ed.ed_tgt = NULL;
if (hash_find_iter(mcd->md_tdtba, ctdp, equiv_cb, &ed) < 0) {
- debug(3, "Self check found %d <%x> in %d <%x>\n", ctdp->t_id,
- ctdp->t_id, ed.ed_tgt->t_id, ed.ed_tgt->t_id);
+ debug(3, "Self check found %d in %d\n", ctdp->t_id,
+ ed.ed_tgt->t_id);
add_mapping(mcd->md_ta, ctdp->t_id,
get_mapping(mcd->md_ta, ed.ed_tgt->t_id));
} else if (debug_level > 1 && hash_iter(mcd->md_tdtba,
@@ -519,13 +518,12 @@ map_td_tree_self_post(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
* through the entire hash. This usually means that the hash
* function is broken.
*/
- aborterr("Self-unique second pass for %d <%x> (%s) == %d <%x>\n",
- ctdp->t_id, ctdp->t_id, tdesc_name(ctdp), ed.ed_tgt->t_id,
- ed.ed_tgt->t_id);
+ aborterr("Self-unique second pass for %d (%s) == %d\n",
+ ctdp->t_id, tdesc_name(ctdp), ed.ed_tgt->t_id);
} else {
int id = mcd->md_tgt->td_nextid++;
- debug(3, "Creating new type %d <%x>\n", id, id);
+ debug(3, "Creating new type %d\n", id);
add_mapping(mcd->md_ta, ctdp->t_id, id);
hash_add(mcd->md_tdtba, ctdp);
}
@@ -698,14 +696,14 @@ remap_node(tdesc_t **tgtp, tdesc_t *oldtgt, int selftid, tdesc_t *newself,
}
if ((template.t_id = get_mapping(mcd->md_ta, oldid)) == 0)
- aborterr("failed to get mapping for tid %d <%x>\n", oldid, oldid);
+ aborterr("failed to get mapping for tid %d\n", oldid);
if (!hash_find(mcd->md_parent->td_idhash, (void *)&template,
(void *)&tgt) && (!(mcd->md_flags & MCD_F_REFMERGE) ||
!hash_find(mcd->md_tgt->td_idhash, (void *)&template,
(void *)&tgt))) {
- debug(3, "Remap couldn't find %d <%x> (from %d <%x>)\n", template.t_id,
- template.t_id, oldid, oldid);
+ debug(3, "Remap couldn't find %d (from %d)\n", template.t_id,
+ oldid);
*tgtp = oldtgt;
list_add(mcd->md_tdtbr, tgtp);
return (0);
@@ -731,7 +729,7 @@ conjure_template(tdesc_t *old, int newselfid)
/*ARGSUSED2*/
static tdesc_t *
-conjure_intrinsic(tdesc_t *old, int newselfid, merge_cb_data_t *mcd __unused)
+conjure_intrinsic(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
{
tdesc_t *new = conjure_template(old, newselfid);
@@ -767,7 +765,7 @@ conjure_function(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
if (nfn->fn_nargs > 0)
nfn->fn_args = xcalloc(sizeof (tdesc_t *) * ofn->fn_nargs);
- for (i = 0; i < (int) ofn->fn_nargs; i++) {
+ for (i = 0; i < ofn->fn_nargs; i++) {
(void) remap_node(&nfn->fn_args[i], ofn->fn_args[i], old->t_id,
new, mcd);
}
@@ -807,7 +805,7 @@ conjure_su(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
*nmemp = xmalloc(sizeof (mlist_t));
(*nmemp)->ml_offset = omem->ml_offset;
(*nmemp)->ml_size = omem->ml_size;
- (*nmemp)->ml_name = xstrdup(omem->ml_name ? omem->ml_name : "empty omem->ml_name");
+ (*nmemp)->ml_name = xstrdup(omem->ml_name);
(void) remap_node(&((*nmemp)->ml_type), omem->ml_type,
old->t_id, new, mcd);
}
@@ -818,7 +816,7 @@ conjure_su(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
/*ARGSUSED2*/
static tdesc_t *
-conjure_enum(tdesc_t *old, int newselfid, merge_cb_data_t *mcd __unused)
+conjure_enum(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
{
tdesc_t *new = conjure_template(old, newselfid);
elist_t *oel, **nelp;
@@ -847,7 +845,7 @@ conjure_forward(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
/*ARGSUSED*/
static tdesc_t *
-conjure_assert(tdesc_t *old __unused, int newselfid __unused, merge_cb_data_t *mcd __unused)
+conjure_assert(tdesc_t *old, int newselfid, merge_cb_data_t *mcd)
{
assert(1 == 0);
return (NULL);
@@ -872,7 +870,7 @@ static int
fwd_redir(tdesc_t *fwd, tdesc_t **fwdp, void *private)
{
alist_t *map = private;
- void *defn;
+ tdesc_t *defn;
if (!alist_find(map, (void *)fwd, (void **)&defn))
return (0);
@@ -910,7 +908,7 @@ static int
redir_mstr_fwd_cb(void *name, void *value, void *arg)
{
tdesc_t *fwd = name;
- int defnid = (uintptr_t)value;
+ int defnid = (int)value;
redir_mstr_data_t *rmd = arg;
tdesc_t template;
tdesc_t *defn;
@@ -989,9 +987,8 @@ add_tdesc(tdesc_t *oldtdp, int newid, merge_cb_data_t *mcd)
assert(hash_find(mcd->md_parent->td_idhash,
(void *)&template, NULL) == 0);
- debug(3, "trying to conjure %d %s (%d, <%x>) as %d, <%x>\n",
- oldtdp->t_type, tdesc_name(oldtdp), oldtdp->t_id,
- oldtdp->t_id, newid, newid);
+ debug(3, "trying to conjure %d %s (%d) as %d\n",
+ oldtdp->t_type, tdesc_name(oldtdp), oldtdp->t_id, newid);
if ((newtdp = tdesc_ops[oldtdp->t_type].conjure(oldtdp, newid,
mcd)) == NULL)
@@ -1052,16 +1049,16 @@ merge_types(hash_t *src, merge_cb_data_t *mcd)
(void) hash_iter(src, merge_type_cb, mcd);
- tdrc = hash_iter(mcd->md_tdtba, add_tdtba_cb, mcd);
+ tdrc = hash_iter(mcd->md_tdtba, add_tdtba_cb, (void *)mcd);
debug(3, "add_tdtba_cb added %d items\n", tdrc);
- iirc = list_iter(*mcd->md_iitba, add_iitba_cb, mcd);
+ iirc = list_iter(*mcd->md_iitba, add_iitba_cb, (void *)mcd);
debug(3, "add_iitba_cb added %d items\n", iirc);
assert(list_count(*mcd->md_iitba) == 0 &&
hash_count(mcd->md_tdtba) == 0);
- tdrc = list_iter(*mcd->md_tdtbr, add_tdtbr_cb, mcd);
+ tdrc = list_iter(*mcd->md_tdtbr, add_tdtbr_cb, (void *)mcd);
debug(3, "add_tdtbr_cb added %d items\n", tdrc);
if (list_count(*mcd->md_tdtbr) != 0)
diff --git a/tools/ctf/cvt/output.c b/tools/ctf/cvt/output.c
index ae8c5945c8ef..f699fbf6d30f 100644
--- a/tools/ctf/cvt/output.c
+++ b/tools/ctf/cvt/output.c
@@ -79,7 +79,7 @@ burst_iitypes(void *data, void *arg)
/*ARGSUSED1*/
static int
-save_type_by_id(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
+save_type_by_id(tdesc_t *tdp, tdesc_t **tdpp, void *private)
{
iiburst_t *iiburst = private;
@@ -159,10 +159,8 @@ iiburst_free(iiburst_t *iiburst)
* a global type description.
*/
static int
-matching_iidesc(void *arg1, void *arg2)
+matching_iidesc(iidesc_t *iidesc, iidesc_match_t *match)
{
- iidesc_t *iidesc = arg1;
- iidesc_match_t *match = arg2;
if (streq(iidesc->ii_name, match->iim_name) == 0)
return (0);
@@ -187,8 +185,6 @@ matching_iidesc(void *arg1, void *arg2)
return (-1);
}
break;
- default:
- break;
}
return (0);
}
@@ -198,7 +194,7 @@ find_iidesc(tdata_t *td, iidesc_match_t *match)
{
match->iim_ret = NULL;
iter_iidescs_by_name(td, match->iim_name,
- matching_iidesc, match);
+ (int (*)())matching_iidesc, match);
return (match->iim_ret);
}
@@ -243,12 +239,10 @@ check_for_weak(GElf_Sym *weak, char const *weakfile,
GElf_Sym *retsym, char **curfilep)
{
char *curfile = NULL;
- char *tmpfile1 = NULL;
+ char *tmpfile;
GElf_Sym tmpsym;
int candidate = 0;
int i;
- tmpsym.st_info = 0;
- tmpsym.st_name = 0;
if (GELF_ST_BIND(weak->st_info) != STB_WEAK)
return (0);
@@ -282,7 +276,7 @@ check_for_weak(GElf_Sym *weak, char const *weakfile,
(curfile == NULL || weakfile == NULL ||
strcmp(curfile, weakfile) != 0)) {
candidate = 1;
- tmpfile1 = curfile;
+ tmpfile = curfile;
tmpsym = sym;
continue;
}
@@ -293,7 +287,7 @@ check_for_weak(GElf_Sym *weak, char const *weakfile,
}
if (candidate) {
- *curfilep = tmpfile1;
+ *curfilep = tmpfile;
*retsym = tmpsym;
return (1);
}
@@ -502,14 +496,14 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
secxlate = xmalloc(sizeof (int) * sehdr.e_shnum);
for (srcidx = dstidx = 0; srcidx < sehdr.e_shnum; srcidx++) {
Elf_Scn *scn = elf_getscn(src, srcidx);
- GElf_Shdr shdr1;
+ GElf_Shdr shdr;
char *sname;
- gelf_getshdr(scn, &shdr1);
- sname = elf_strptr(src, sehdr.e_shstrndx, shdr1.sh_name);
+ gelf_getshdr(scn, &shdr);
+ sname = elf_strptr(src, sehdr.e_shstrndx, shdr.sh_name);
if (sname == NULL) {
elfterminate(srcname, "Can't find string at %u",
- shdr1.sh_name);
+ shdr.sh_name);
}
if (strcmp(sname, CTF_ELF_SCN_NAME) == 0) {
@@ -520,7 +514,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
strncmp(sname, ".rel.debug", 10) == 0 ||
strncmp(sname, ".rela.debug", 11) == 0)) {
secxlate[srcidx] = -1;
- } else if (dynsym && shdr1.sh_type == SHT_SYMTAB) {
+ } else if (dynsym && shdr.sh_type == SHT_SYMTAB) {
/*
* If we're building CTF against the dynsym,
* we'll rip out the symtab so debuggers aren't
@@ -573,31 +567,11 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
elfterminate(srcname, "Can't find string at %u",
shdr.sh_name);
}
-
-#if !defined(sun)
- if (gelf_update_shdr(dscn, &shdr) == 0)
- elfterminate(dstname, "Cannot update sect %s", sname);
-#endif
-
if ((sdata = elf_getdata(sscn, NULL)) == NULL)
elfterminate(srcname, "Cannot get sect %s data", sname);
if ((ddata = elf_newdata(dscn)) == NULL)
elfterminate(dstname, "Can't make sect %s data", sname);
-#if defined(sun)
bcopy(sdata, ddata, sizeof (Elf_Data));
-#else
- /*
- * FreeBSD's Elf_Data has private fields which the
- * elf_* routines manage. Simply copying the
- * entire structure corrupts the data. So we need
- * to copy the public fields explictly.
- */
- ddata->d_align = sdata->d_align;
- ddata->d_off = sdata->d_off;
- ddata->d_size = sdata->d_size;
- ddata->d_type = sdata->d_type;
- ddata->d_version = sdata->d_version;
-#endif
if (srcidx == sehdr.e_shstrndx) {
char seclen = strlen(CTF_ELF_SCN_NAME);
@@ -627,8 +601,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
GElf_Sym sym;
short newscn;
- if (gelf_getsym(ddata, i, &sym) == NULL)
- printf("Could not get symbol %d\n",i);
+ (void) gelf_getsym(ddata, i, &sym);
if (sym.st_shndx >= SHN_LORESERVE)
continue;
@@ -643,14 +616,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
}
}
-#if !defined(sun)
- if (ddata->d_buf == NULL) {
- ddata->d_buf = xmalloc(shdr.sh_size);
- bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size);
- }
-#endif
-
- if (gelf_update_shdr(dscn, &shdr) == 0)
+ if (gelf_update_shdr(dscn, &shdr) == NULL)
elfterminate(dstname, "Cannot update sect %s", sname);
new_offset = (off_t)shdr.sh_offset;
@@ -685,7 +651,6 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname,
ddata->d_buf = ctfdata;
ddata->d_size = ctfsize;
ddata->d_align = shdr.sh_addralign;
- ddata->d_off = 0;
gelf_update_shdr(dscn, &shdr);
diff --git a/tools/ctf/cvt/st_parse.c b/tools/ctf/cvt/st_parse.c
index 53643204c1c6..d4d492132128 100644
--- a/tools/ctf/cvt/st_parse.c
+++ b/tools/ctf/cvt/st_parse.c
@@ -76,11 +76,12 @@ static char *tdefdecl(char *cp, int h, tdesc_t **rtdp);
static char *intrinsic(char *cp, tdesc_t **rtdp);
static char *arraydef(char *cp, tdesc_t **rtdp);
+extern int debug_level;
int debug_parse = DEBUG_PARSE;
/*PRINTFLIKE3*/
static void
-parse_debug(int level, char *cp, const char *fmt, ...)
+parse_debug(int level, char *cp, char *fmt, ...)
{
va_list ap;
char buf[1024];
@@ -112,9 +113,9 @@ parse_debug(int level, char *cp, const char *fmt, ...)
/* Report unexpected syntax in stabs. */
static void
_expected(
- const char *who, /* what function, or part thereof, is reporting */
- const char *what, /* what was expected */
- const char *where, /* where we were in the line of input */
+ char *who, /* what function, or part thereof, is reporting */
+ char *what, /* what was expected */
+ char *where, /* where we were in the line of input */
int line)
{
fprintf(stderr, "%s, expecting \"%s\" at \"%s\"\n", who, what, where);
@@ -125,7 +126,7 @@ _expected(
/*ARGSUSED*/
void
-parse_init(tdata_t *td __unused)
+parse_init(tdata_t *td)
{
int i;
@@ -158,7 +159,7 @@ unres_new(int tid)
return (tdp);
}
-static char *
+char *
read_tid(char *cp, tdesc_t **tdpp)
{
tdesc_t *tdp;
@@ -189,7 +190,7 @@ read_tid(char *cp, tdesc_t **tdpp)
static iitype_t
parse_fun(char *cp, iidesc_t *ii)
{
- iitype_t iitype = 0;
+ iitype_t iitype;
tdesc_t *tdp;
tdesc_t **args = NULL;
int nargs = 0;
@@ -249,7 +250,7 @@ static iitype_t
parse_sym(char *cp, iidesc_t *ii)
{
tdesc_t *tdp;
- iitype_t iitype = 0;
+ iitype_t iitype;
/*
* name:G global variable
@@ -1037,14 +1038,14 @@ enumdef(char *cp, tdesc_t **rtdp)
}
}
-static tdesc_t *
-lookup_name(tdesc_t **hash, const char *name1)
+tdesc_t *
+lookup_name(tdesc_t **hash, const char *name)
{
- int bucket = compute_sum(name1);
+ int bucket = compute_sum(name);
tdesc_t *tdp, *ttdp = NULL;
for (tdp = hash[bucket]; tdp != NULL; tdp = tdp->t_next) {
- if (tdp->t_name != NULL && strcmp(tdp->t_name, name1) == 0) {
+ if (tdp->t_name != NULL && strcmp(tdp->t_name, name) == 0) {
if (tdp->t_type == STRUCT || tdp->t_type == UNION ||
tdp->t_type == ENUM || tdp->t_type == INTRINSIC)
return (tdp);
@@ -1056,9 +1057,9 @@ lookup_name(tdesc_t **hash, const char *name1)
}
tdesc_t *
-lookupname(const char *name1)
+lookupname(const char *name)
{
- return (lookup_name(name_table, name1));
+ return (lookup_name(name_table, name));
}
/*
@@ -1150,9 +1151,8 @@ check_hash(void)
/*ARGSUSED1*/
static int
-resolve_typed_bitfields_cb(void *arg, void *private __unused)
+resolve_typed_bitfields_cb(mlist_t *ml, void *private)
{
- mlist_t *ml = arg;
tdesc_t *tdp = ml->ml_type;
debug(3, "Resolving typed bitfields (member %s)\n",
@@ -1194,5 +1194,5 @@ void
resolve_typed_bitfields(void)
{
(void) list_iter(typedbitfldmems,
- resolve_typed_bitfields_cb, NULL);
+ (int (*)())resolve_typed_bitfields_cb, NULL);
}
diff --git a/tools/ctf/cvt/stabs.c b/tools/ctf/cvt/stabs.c
index c0c68b53e030..f7b3034c6406 100644
--- a/tools/ctf/cvt/stabs.c
+++ b/tools/ctf/cvt/stabs.c
@@ -47,7 +47,7 @@
#include "memory.h"
#include "traverse.h"
-char *curhdr;
+const char *curhdr;
/*
* The stabs generator will sometimes reference types before they've been
@@ -59,7 +59,7 @@ char *curhdr;
*/
/*ARGSUSED2*/
static int
-resolve_tou_node(tdesc_t *node, tdesc_t **nodep, void *private __unused)
+resolve_tou_node(tdesc_t *node, tdesc_t **nodep, void *private)
{
tdesc_t *new;
@@ -79,7 +79,7 @@ resolve_tou_node(tdesc_t *node, tdesc_t **nodep, void *private __unused)
/*ARGSUSED*/
static int
-resolve_fwd_node(tdesc_t *node, tdesc_t **nodep, void *private __unused)
+resolve_fwd_node(tdesc_t *node, tdesc_t **nodep, void *private)
{
tdesc_t *new = lookupname(node->t_name);
@@ -174,7 +174,7 @@ fnarg_free(iidesc_t *ii)
* assembled under an iidesc list.
*/
int
-stabs_read(tdata_t *td, Elf *elf, char *file)
+stabs_read(tdata_t *td, Elf *elf, const char *file)
{
Elf_Scn *scn;
Elf_Data *data;
@@ -200,7 +200,7 @@ stabs_read(tdata_t *td, Elf *elf, char *file)
file_stack = stack_new(free);
- stack_push(file_stack, file);
+ stack_push(file_stack, (void *)file);
curhdr = file;
debug(3, "Found stabs in %d, strings in %d\n", stabidx, stabstridx);
@@ -255,7 +255,7 @@ stabs_read(tdata_t *td, Elf *elf, char *file)
if (stab->n_type == N_BINCL) {
curhdr = xstrdup(str);
- stack_push(file_stack, curhdr);
+ stack_push(file_stack, (void *)curhdr);
continue;
} else if (stab->n_type == N_SO) {
if (str[strlen(str) - 1] != '/') {
diff --git a/tools/ctf/cvt/strtab.c b/tools/ctf/cvt/strtab.c
index d8b2bf0e8176..ba6b7d86d0a8 100644
--- a/tools/ctf/cvt/strtab.c
+++ b/tools/ctf/cvt/strtab.c
@@ -205,7 +205,7 @@ strtab_size(const strtab_t *sp)
ssize_t
strtab_write(const strtab_t *sp,
- ssize_t (*func)(void *, size_t, void *), void *priv)
+ ssize_t (*func)(const void *, size_t, void *), void *priv)
{
ssize_t res, total = 0;
ulong_t i;
diff --git a/tools/ctf/cvt/strtab.h b/tools/ctf/cvt/strtab.h
index 13c1e59cd916..7176e0737825 100644
--- a/tools/ctf/cvt/strtab.h
+++ b/tools/ctf/cvt/strtab.h
@@ -59,7 +59,7 @@ extern void strtab_destroy(strtab_t *);
extern size_t strtab_insert(strtab_t *, const char *);
extern size_t strtab_size(const strtab_t *);
extern ssize_t strtab_write(const strtab_t *,
- ssize_t (*)(void *, size_t, void *), void *);
+ ssize_t (*)(const void *, size_t, void *), void *);
extern void strtab_print(const strtab_t *);
#ifdef __cplusplus
diff --git a/tools/ctf/cvt/tdata.c b/tools/ctf/cvt/tdata.c
index 4a0cc79600e7..32d84829d70e 100644
--- a/tools/ctf/cvt/tdata.c
+++ b/tools/ctf/cvt/tdata.c
@@ -174,10 +174,9 @@ tdesc_namecmp(void *arg1, void *arg2)
return (!streq(tdp1->t_name, tdp2->t_name));
}
-#if defined(sun)
/*ARGSUSED1*/
-static int
-tdesc_print(void *data, void *private __unused)
+int
+tdesc_print(void *data, void *private)
{
tdesc_t *tdp = data;
@@ -185,7 +184,6 @@ tdesc_print(void *data, void *private __unused)
return (1);
}
-#endif
static void
free_intr(tdesc_t *tdp)
@@ -249,42 +247,39 @@ static void (*free_cbs[])(tdesc_t *) = {
};
/*ARGSUSED1*/
-static void
-tdesc_free_cb(void *arg, void *private __unused)
+static int
+tdesc_free_cb(tdesc_t *tdp, void *private)
{
- tdesc_t *tdp = arg;
if (tdp->t_name)
free(tdp->t_name);
if (free_cbs[tdp->t_type])
free_cbs[tdp->t_type](tdp);
free(tdp);
- return;
+ return (1);
}
void
tdesc_free(tdesc_t *tdp)
{
- tdesc_free_cb(tdp, NULL);
+ (void) tdesc_free_cb(tdp, NULL);
}
static int
-tdata_label_cmp(void *arg1, void *arg2)
+tdata_label_cmp(labelent_t *le1, labelent_t *le2)
{
- labelent_t *le1 = arg1;
- labelent_t *le2 = arg2;
return (le1->le_idx - le2->le_idx);
}
void
-tdata_label_add(tdata_t *td, const char *label, int idx)
+tdata_label_add(tdata_t *td, char *label, int idx)
{
labelent_t *le = xmalloc(sizeof (*le));
le->le_name = xstrdup(label);
le->le_idx = (idx == -1 ? td->td_nextid - 1 : idx);
- slist_add(&td->td_labels, le, tdata_label_cmp);
+ slist_add(&td->td_labels, le, (int (*)())tdata_label_cmp);
}
static int
@@ -309,10 +304,8 @@ tdata_label_top(tdata_t *td)
}
static int
-tdata_label_find_cb(void *arg1, void *arg2)
+tdata_label_find_cb(labelent_t *le, labelent_t *tmpl)
{
- labelent_t *le = arg1;
- labelent_t *tmpl = arg2;
return (streq(le->le_name, tmpl->le_name));
}
@@ -330,7 +323,7 @@ tdata_label_find(tdata_t *td, char *label)
let.le_name = label;
if (!(ret = (labelent_t *)list_find(td->td_labels, &let,
- tdata_label_find_cb)))
+ (int (*)())tdata_label_find_cb)))
return (-1);
return (ret->le_idx);
@@ -358,9 +351,8 @@ tdata_label_newmax(tdata_t *td, int newmax)
/*ARGSUSED1*/
static void
-tdata_label_free_cb(void *arg, void *private __unused)
+tdata_label_free_cb(labelent_t *le, void *private)
{
- labelent_t *le = arg;
if (le->le_name)
free(le->le_name);
free(le);
@@ -369,7 +361,7 @@ tdata_label_free_cb(void *arg, void *private __unused)
void
tdata_label_free(tdata_t *td)
{
- list_free(td->td_labels, tdata_label_free_cb, NULL);
+ list_free(td->td_labels, (void (*)())tdata_label_free_cb, NULL);
td->td_labels = NULL;
}
@@ -399,8 +391,8 @@ tdata_new(void)
void
tdata_free(tdata_t *td)
{
- hash_free(td->td_iihash, iidesc_free, NULL);
- hash_free(td->td_layouthash, tdesc_free_cb, NULL);
+ hash_free(td->td_iihash, (void (*)())iidesc_free, NULL);
+ hash_free(td->td_layouthash, (void (*)())tdesc_free_cb, NULL);
hash_free(td->td_idhash, NULL, NULL);
list_free(td->td_fwdlist, NULL, NULL);
@@ -416,7 +408,7 @@ tdata_free(tdata_t *td)
/*ARGSUSED1*/
static int
-build_hashes(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
+build_hashes(tdesc_t *ctdp, tdesc_t **ctdpp, void *private)
{
tdata_t *td = private;
@@ -473,7 +465,7 @@ tdata_merge(tdata_t *td1, tdata_t *td2)
td2->td_fwdlist = NULL;
slist_merge(&td1->td_labels, td2->td_labels,
- tdata_label_cmp);
+ (int (*)())tdata_label_cmp);
td2->td_labels = NULL;
/* free the td2 hashes (data is now part of td1) */
diff --git a/tools/ctf/cvt/traverse.c b/tools/ctf/cvt/traverse.c
index feb9908638af..b415b35af6a5 100644
--- a/tools/ctf/cvt/traverse.c
+++ b/tools/ctf/cvt/traverse.c
@@ -37,8 +37,10 @@
#include "traverse.h"
#include "memory.h"
-int (*tddescenders[])(tdesc_t *, tdtrav_data_t *);
-tdtrav_cb_f tdnops[];
+int (*tddescenders[])();
+int (*tdnops[])();
+
+int tdtraverse(tdesc_t *, tdesc_t **, tdtrav_data_t *);
void
tdtrav_init(tdtrav_data_t *tdtd, int *vgenp, tdtrav_cb_f *firstops,
@@ -66,7 +68,7 @@ tdtrav_func(tdesc_t *this, tdtrav_data_t *tdtd)
if ((rc = tdtraverse(fn->fn_ret, &fn->fn_ret, tdtd)) < 0)
return (rc);
- for (i = 0; i < (int) fn->fn_nargs; i++) {
+ for (i = 0; i < fn->fn_nargs; i++) {
if ((rc = tdtraverse(fn->fn_args[i], &fn->fn_args[i],
tdtd)) < 0)
return (rc);
@@ -104,7 +106,7 @@ tdtrav_su(tdesc_t *this, tdtrav_data_t *tdtd)
/*ARGSUSED*/
int
-tdtrav_assert(tdesc_t *node __unused, tdesc_t **nodep __unused, void *private __unused)
+tdtrav_assert(tdesc_t *node, tdesc_t **nodep, void *private)
{
assert(1 == 0);
@@ -149,7 +151,7 @@ int
tdtraverse(tdesc_t *this, tdesc_t **thisp, tdtrav_data_t *tdtd)
{
tdtrav_cb_f travcb;
- int (*descender)(tdesc_t *, tdtrav_data_t *);
+ int (*descender)();
int descend = 1;
int rc;
@@ -185,10 +187,8 @@ tdtraverse(tdesc_t *this, tdesc_t **thisp, tdtrav_data_t *tdtd)
}
int
-iitraverse_td(void *arg1, void *arg2)
+iitraverse_td(iidesc_t *ii, tdtrav_data_t *tdtd)
{
- iidesc_t *ii = arg1;
- tdtrav_data_t *tdtd = arg2;
int i, rc;
if ((rc = tdtraverse(ii->ii_dtype, &ii->ii_dtype, tdtd)) < 0)
@@ -222,5 +222,5 @@ iitraverse_hash(hash_t *iihash, int *vgenp, tdtrav_cb_f *firstops,
tdtrav_init(&tdtd, vgenp, firstops, preops, postops, private);
- return (hash_iter(iihash, iitraverse_td, &tdtd));
+ return (hash_iter(iihash, (int (*)())iitraverse_td, &tdtd));
}
diff --git a/tools/ctf/cvt/traverse.h b/tools/ctf/cvt/traverse.h
index 6a56370abc40..0f8396f308e0 100644
--- a/tools/ctf/cvt/traverse.h
+++ b/tools/ctf/cvt/traverse.h
@@ -60,7 +60,7 @@ int iitraverse(iidesc_t *, int *, tdtrav_cb_f *, tdtrav_cb_f *, tdtrav_cb_f *,
void *);
int iitraverse_hash(hash_t *, int *, tdtrav_cb_f *, tdtrav_cb_f *,
tdtrav_cb_f *, void *);
-int iitraverse_td(void *, void *);
+int iitraverse_td(iidesc_t *ii, tdtrav_data_t *);
int tdtrav_assert(tdesc_t *, tdesc_t **, void *);
diff --git a/tools/ctf/cvt/util.c b/tools/ctf/cvt/util.c
index 0f36fa02decf..799ca1279c29 100644
--- a/tools/ctf/cvt/util.c
+++ b/tools/ctf/cvt/util.c
@@ -43,7 +43,7 @@
#include "ctftools.h"
#include "memory.h"
-static void (*terminate_cleanup)(void) = NULL;
+static void (*terminate_cleanup)() = NULL;
/* returns 1 if s1 == s2, 0 otherwise */
int
@@ -116,7 +116,7 @@ elf_ptrsz(Elf *elf)
/*PRINTFLIKE2*/
static void
-whine(const char *type, const char *format, va_list ap)
+whine(char *type, char *format, va_list ap)
{
int error = errno;
@@ -128,14 +128,14 @@ whine(const char *type, const char *format, va_list ap)
}
void
-set_terminate_cleanup(void (*cleanup)(void))
+set_terminate_cleanup(void (*cleanup)())
{
terminate_cleanup = cleanup;
}
/*PRINTFLIKE1*/
void
-terminate(const char *format, ...)
+terminate(char *format, ...)
{
va_list ap;
@@ -148,22 +148,12 @@ terminate(const char *format, ...)
if (getenv("CTF_ABORT_ON_TERMINATE") != NULL)
abort();
-#if defined(__FreeBSD__)
-/*
- * For the time being just output the termination message, but don't
- * return an exit status that would cause the build to fail. We need
- * to get as much stuff built as possible before going back and
- * figuring out what is wrong with certain files.
- */
- exit(0);
-#else
exit(1);
-#endif
}
/*PRINTFLIKE1*/
void
-aborterr(const char *format, ...)
+aborterr(char *format, ...)
{
va_list ap;
@@ -171,16 +161,12 @@ aborterr(const char *format, ...)
whine("ERROR", format, ap);
va_end(ap);
-#if defined(sun)
abort();
-#else
- exit(0);
-#endif
}
/*PRINTFLIKE1*/
void
-warning(const char *format, ...)
+warning(char *format, ...)
{
va_list ap;
@@ -194,7 +180,7 @@ warning(const char *format, ...)
/*PRINTFLIKE2*/
void
-vadebug(int level, const char *format, va_list ap)
+vadebug(int level, char *format, va_list ap)
{
if (level > debug_level)
return;
@@ -206,7 +192,7 @@ vadebug(int level, const char *format, va_list ap)
/*PRINTFLIKE2*/
void
-debug(int level, const char *format, ...)
+debug(int level, char *format, ...)
{
va_list ap;
@@ -248,36 +234,3 @@ tdesc_name(tdesc_t *tdp)
{
return (tdp->t_name == NULL ? "(anon)" : tdp->t_name);
}
-
-char *watch_address = NULL;
-int watch_length = 0;
-
-void
-watch_set(void *addr, int len)
-{
- watch_address = addr;
- watch_length = len;
-}
-
-void
-watch_dump(int v)
-{
- char *p = watch_address;
- int i;
-
- if (watch_address == NULL || watch_length == 0)
- return;
-
- printf("%d: watch %p len %d\n",v,watch_address,watch_length);
- for (i = 0; i < watch_length; i++) {
- if (*p >= 0x20 && *p < 0x7f) {
- printf(" %c",*p++ & 0xff);
- } else {
- printf(" %02x",*p++ & 0xff);
- }
- }
- printf("\n");
-
-}
-
-
diff --git a/tools/ctf/dump/dump.c b/tools/ctf/dump/dump.c
index 740485ddff03..5579bae596e7 100644
--- a/tools/ctf/dump/dump.c
+++ b/tools/ctf/dump/dump.c
@@ -203,8 +203,9 @@ print_header(const ctf_header_t *hp, const ctf_data_t *cd)
static int
print_labeltable(const ctf_header_t *hp, const ctf_data_t *cd)
{
- void *v = (void *) (cd->cd_ctfdata + hp->cth_lbloff);
- const ctf_lblent_t *ctl = v;
+ /* LINTED - pointer alignment */
+ const ctf_lblent_t *ctl = (ctf_lblent_t *)(cd->cd_ctfdata +
+ hp->cth_lbloff);
ulong_t i, n = (hp->cth_objtoff - hp->cth_lbloff) / sizeof (*ctl);
print_line("- Label Table ");
@@ -266,8 +267,8 @@ next_sym(const ctf_data_t *cd, const int symidx, const uchar_t matchtype,
static int
read_data(const ctf_header_t *hp, const ctf_data_t *cd)
{
- void *v = (void *) (cd->cd_ctfdata + hp->cth_objtoff);
- const ushort_t *idp = v;
+ /* LINTED - pointer alignment */
+ const ushort_t *idp = (ushort_t *)(cd->cd_ctfdata + hp->cth_objtoff);
ulong_t n = (hp->cth_funcoff - hp->cth_objtoff) / sizeof (ushort_t);
if (flags != F_STATS)
@@ -286,7 +287,7 @@ read_data(const ctf_header_t *hp, const ctf_data_t *cd)
int symidx, len, i;
char *name = NULL;
- for (symidx = -1, i = 0; i < (int) n; i++) {
+ for (symidx = -1, i = 0; i < n; i++) {
int nextsym;
if (cd->cd_symdata == NULL || (nextsym = next_sym(cd,
@@ -310,11 +311,11 @@ read_data(const ctf_header_t *hp, const ctf_data_t *cd)
static int
read_funcs(const ctf_header_t *hp, const ctf_data_t *cd)
{
- void *v = (void *) (cd->cd_ctfdata + hp->cth_funcoff);
- const ushort_t *fp = v;
+ /* LINTED - pointer alignment */
+ const ushort_t *fp = (ushort_t *)(cd->cd_ctfdata + hp->cth_funcoff);
- v = (void *) (cd->cd_ctfdata + hp->cth_typeoff);
- const ushort_t *end = v;
+ /* LINTED - pointer alignment */
+ const ushort_t *end = (ushort_t *)(cd->cd_ctfdata + hp->cth_typeoff);
ulong_t id;
int symidx;
@@ -387,11 +388,11 @@ read_funcs(const ctf_header_t *hp, const ctf_data_t *cd)
static int
read_types(const ctf_header_t *hp, const ctf_data_t *cd)
{
- void *v = (void *) (cd->cd_ctfdata + hp->cth_typeoff);
- const ctf_type_t *tp = v;
+ /* LINTED - pointer alignment */
+ const ctf_type_t *tp = (ctf_type_t *)(cd->cd_ctfdata + hp->cth_typeoff);
- v = (void *) (cd->cd_ctfdata + hp->cth_stroff);
- const ctf_type_t *end = v;
+ /* LINTED - pointer alignment */
+ const ctf_type_t *end = (ctf_type_t *)(cd->cd_ctfdata + hp->cth_stroff);
ulong_t id;
@@ -418,7 +419,7 @@ read_types(const ctf_header_t *hp, const ctf_data_t *cd)
union {
const void *ptr;
- ctf_array_t *ap;
+ const ctf_array_t *ap;
const ctf_member_t *mp;
const ctf_lmember_t *lmp;
const ctf_enum_t *ep;
@@ -438,7 +439,7 @@ read_types(const ctf_header_t *hp, const ctf_data_t *cd)
increment = sizeof (ctf_stype_t);
size = tp->ctt_size;
}
- u.ptr = (const char *)tp + increment;
+ u.ptr = (caddr_t)tp + increment;
switch (kind) {
case CTF_K_INTEGER:
@@ -526,7 +527,7 @@ read_types(const ctf_header_t *hp, const ctf_data_t *cd)
}
if (flags != F_STATS) {
- (void) printf(" %s (%zd bytes)\n",
+ (void) printf(" %s (%d bytes)\n",
ref_to_str(tp->ctt_name, hp, cd), size);
if (size >= CTF_LSTRUCT_THRESH) {
@@ -535,7 +536,6 @@ read_types(const ctf_header_t *hp, const ctf_data_t *cd)
"\t%s type=%u off=%llu\n",
ref_to_str(u.lmp->ctlm_name,
hp, cd), u.lmp->ctlm_type,
- (unsigned long long)
CTF_LMEM_OFFSET(u.lmp));
}
} else {
@@ -785,7 +785,7 @@ print_usage(FILE *fp, int verbose)
}
static Elf_Scn *
-findelfscn(Elf *elf, GElf_Ehdr *ehdr, const char *secname)
+findelfscn(Elf *elf, GElf_Ehdr *ehdr, char *secname)
{
GElf_Shdr shdr;
Elf_Scn *scn;
@@ -811,7 +811,7 @@ main(int argc, char *argv[])
ctf_data_t cd;
const ctf_preamble_t *pp;
- ctf_header_t *hp = NULL;
+ ctf_header_t *hp;
Elf *elf;
GElf_Ehdr ehdr;
@@ -871,7 +871,7 @@ main(int argc, char *argv[])
if ((elf = elf_begin(fd, ELF_C_READ, NULL)) != NULL &&
gelf_getehdr(elf, &ehdr) != NULL) {
- Elf_Data *dp = NULL;
+ Elf_Data *dp;
Elf_Scn *ctfscn = findelfscn(elf, &ehdr, ".SUNW_ctf");
Elf_Scn *symscn;
GElf_Shdr ctfshdr;
@@ -929,15 +929,15 @@ main(int argc, char *argv[])
if (cd.cd_ctflen < sizeof (ctf_preamble_t))
die("%s does not contain a CTF preamble\n", filename);
- void *v = (void *) cd.cd_ctfdata;
- pp = v;
+ /* LINTED - pointer alignment */
+ pp = (const ctf_preamble_t *)cd.cd_ctfdata;
if (pp->ctp_magic != CTF_MAGIC)
die("%s does not appear to contain CTF data\n", filename);
if (pp->ctp_version == CTF_VERSION) {
- v = (void *) cd.cd_ctfdata;
- hp = v;
+ /* LINTED - pointer alignment */
+ hp = (ctf_header_t *)cd.cd_ctfdata;
cd.cd_ctfdata = (caddr_t)cd.cd_ctfdata + sizeof (ctf_header_t);
if (cd.cd_ctflen < sizeof (ctf_header_t)) {
@@ -1012,7 +1012,7 @@ main(int argc, char *argv[])
if ((ufd = open(ufile, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0 ||
write(ufd, &h, sizeof (h)) != sizeof (h) ||
- write(ufd, cd.cd_ctfdata, cd.cd_ctflen) != (int) cd.cd_ctflen) {
+ write(ufd, cd.cd_ctfdata, cd.cd_ctflen) != cd.cd_ctflen) {
warn("failed to write CTF data to '%s'", ufile);
error |= E_ERROR;
}