PERFORCE change 95313 for review
John Birrell
jb at FreeBSD.org
Sat Apr 15 05:24:23 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=95313
Change 95313 by jb at jb_freebsd2 on 2006/04/15 05:23:58
#ifdef a lot of code out so that libdtrace builds and dtrace links.
<status_update>
At this point, a 'make buildworld && make installworld' will do the right
thing. sgsmsg gets installed in /usr/bin. It's a build tool. dtrace (the
program) gets installed in /usr/sbin and the libdtrace, libelf, libctf
and libavl libraries get installed in /usr/lib. So far, that's all that
affects an installed FreeBSD system.
Next up there are a few extra build tools which will be required to add the
'C Type Format' symbols to executables.
Then it's back to fleshing out the dtrace problem to fill in the bits of
code DOODADed out. At the point where a dtrace_open() tries to open the
dtrace device, obviously that's the point where kernel functionality is
added.
</status_update> 8-)
Affected files ...
.. //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/dtrace.c#1 add
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/drti.c#2 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_consume.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_dof.c#2 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_impl.h#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_lex.l#2 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_link.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_module.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pid.c#2 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pid.h#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_printf.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_proc.c#2 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_proc.h#2 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_subr.c#3 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_work.c#3 edit
Differences ...
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/drti.c#2 (text) ====
@@ -55,7 +55,7 @@
* DTRACE_DOF_INIT_DEVNAME set the path to the helper node
*/
-static const char *devname = "/dev/dtrace/helper";
+static const char *devnamep = "/dev/dtrace/helper";
static const char *olddevname = "/devices/pseudo/dtrace at 0:helper";
static const char *modname; /* Name of this load object */
@@ -89,6 +89,7 @@
static void
dtrace_dof_init(void)
{
+#ifdef DOODAD
dof_hdr_t *dof = &__SUNW_dof;
#ifdef _LP64
Elf64_Ehdr *elf;
@@ -141,10 +142,10 @@
}
if ((p = getenv("DTRACE_DOF_INIT_DEVNAME")) != NULL)
- devname = p;
+ devnamep = p;
- if ((fd = open64(devname, O_RDWR)) < 0) {
- dprintf(1, "failed to open helper device %s", devname);
+ if ((fd = open64(devnamep, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devnamep);
/*
* If the device path wasn't explicitly set, try again with
@@ -153,10 +154,10 @@
if (p != NULL)
return;
- devname = olddevname;
+ devnamep = olddevname;
- if ((fd = open64(devname, O_RDWR)) < 0) {
- dprintf(1, "failed to open helper device %s", devname);
+ if ((fd = open64(devnamep, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devnamep);
return;
}
}
@@ -167,16 +168,18 @@
dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof);
(void) close(fd);
+#endif
}
#pragma fini(dtrace_dof_fini)
static void
dtrace_dof_fini(void)
{
+#ifdef DOODAD
int fd;
- if ((fd = open64(devname, O_RDWR)) < 0) {
- dprintf(1, "failed to open helper device %s", devname);
+ if ((fd = open64(devnamep, O_RDWR)) < 0) {
+ dprintf(1, "failed to open helper device %s", devnamep);
return;
}
@@ -186,4 +189,5 @@
dprintf(1, "DTrace ioctl removed DOF (%d)\n", gen);
(void) close(fd);
+#endif
}
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c#3 (text) ====
@@ -233,6 +233,7 @@
static void
dt_aggregate_usym(dtrace_hdl_t *dtp, uint64_t *data)
{
+#ifdef DOODAD
uint64_t pid = data[0];
uint64_t *pc = &data[1];
struct ps_prochandle *P;
@@ -251,6 +252,7 @@
dt_proc_unlock(dtp, P);
dt_proc_release(dtp, P);
+#endif
}
static void
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#3 (text) ====
@@ -29,6 +29,8 @@
#include <sys/types.h>
#if defined(sun)
#include <sys/sysmacros.h>
+#else
+#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
#endif
#include <sys/isa_defs.h>
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_consume.c#3 (text) ====
@@ -568,6 +568,7 @@
dt_print_ustack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
caddr_t addr, uint64_t arg)
{
+#ifdef DOODAD
/* LINTED - alignment */
uint64_t *pc = (uint64_t *)addr;
uint32_t depth = DTRACE_USTACK_NFRAMES(arg);
@@ -699,11 +700,15 @@
}
return (err);
+#else
+return 0;
+#endif
}
static int
dt_print_usym(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, dtrace_actkind_t act)
{
+#ifdef DOODAD
/* LINTED - alignment */
uint64_t pid = ((uint64_t *)addr)[0];
/* LINTED - alignment */
@@ -735,11 +740,15 @@
} while ((len = dtrace_uaddr2str(dtp, pid, pc, s, n)) >= n);
return (dt_printf(dtp, fp, format, s));
+#else
+return 0;
+#endif
}
int
dt_print_umod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
{
+#ifdef DOODAD
/* LINTED - alignment */
uint64_t pid = ((uint64_t *)addr)[0];
/* LINTED - alignment */
@@ -778,6 +787,9 @@
}
return (err);
+#else
+return 0;
+#endif
}
static int
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_dof.c#2 (text) ====
@@ -27,10 +27,14 @@
#pragma ident "@(#)dt_dof.c 1.11 06/03/30 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>
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_impl.h#3 (text) ====
@@ -32,6 +32,10 @@
#if defined(sun)
#include <sys/objfs.h>
#else
+#include <opensolaris/compat/fcntl.h>
+#include <opensolaris/compat/stdio.h>
+#include <opensolaris/compat/thread.h>
+#include <opensolaris/compat/unistd.h>
#include <opensolaris/compat/sys/time.h>
#include <opensolaris/compat/sys/bitmap.h>
#include <sys/utsname.h>
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_lex.l#2 (text) ====
@@ -42,12 +42,19 @@
* 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
+#undef yyinput
+#define yyinput input
+#endif
static int id_or_type(const char *);
static int input(void);
+#if defined(sun)
static void unput(int);
+#endif
/*
* We first define a set of labeled states for use in the D lexer and then a
@@ -689,7 +696,9 @@
yypcb = pcb;
yylineno = 1;
yypragma = NULL;
+#if defined(sun)
yysptr = yysbuf;
+#endif
}
/*
@@ -786,13 +795,16 @@
}
static int
-input(void)
+dtinput(void)
{
int c;
+#if defined(sun)
if (yysptr > yysbuf)
c = *--yysptr;
- else if (yypcb->pcb_fileptr != NULL)
+ else
+#endif
+ if (yypcb->pcb_fileptr != NULL)
c = fgetc(yypcb->pcb_fileptr);
else if (yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen)
c = *yypcb->pcb_strptr++;
@@ -817,6 +829,7 @@
return (0); /* EOF */
}
+#if defined(sun)
static void
unput(int c)
{
@@ -826,3 +839,4 @@
*yysptr++ = c;
yytchar = c;
}
+#endif
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_link.c#3 (text) ====
@@ -32,6 +32,8 @@
#include <sys/types.h>
#if defined(sun)
#include <sys/sysmacros.h>
+#else
+#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
#endif
#include <unistd.h>
@@ -47,6 +49,8 @@
#include <errno.h>
#if defined(sun)
#include <wait.h>
+#else
+#include <sys/wait.h>
#endif
#include <assert.h>
#include <sys/ipc.h>
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_module.c#3 (text) ====
@@ -30,16 +30,19 @@
#if !defined(sun)
#include <opensolaris/compat/sys/types.h>
#endif
-#ifdef DOODAD
+#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>
+#endif
#include <unistd.h>
+#if defined(sun)
#include <project.h>
+#endif
#include <strings.h>
#include <stdlib.h>
#include <libelf.h>
@@ -47,7 +50,6 @@
#include <assert.h>
#include <errno.h>
#include <dirent.h>
-#endif
#include <dt_strtab.h>
#include <dt_module.h>
@@ -72,6 +74,7 @@
static uint_t
dt_module_syminit32(dt_module_t *dmp)
{
+#ifdef DOODAD
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;
@@ -96,11 +99,15 @@
}
return (asrsv);
+#else
+return 0;
+#endif
}
static uint_t
dt_module_syminit64(dt_module_t *dmp)
{
+#ifdef DOODAD
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;
@@ -125,6 +132,9 @@
}
return (asrsv);
+#else
+return 0;
+#endif
}
/*
@@ -668,6 +678,7 @@
void
dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
{
+#ifdef DOODAD
ctf_close(dmp->dm_ctfp);
dmp->dm_ctfp = NULL;
@@ -712,6 +723,7 @@
dmp->dm_elf = NULL;
dmp->dm_flags &= ~DT_DM_LOADED;
+#endif
}
void
@@ -791,6 +803,7 @@
static void
dt_module_update(dtrace_hdl_t *dtp, const char *name)
{
+#ifdef DOODAD
char fname[MAXPATHLEN];
struct stat64 st;
int fd, err, bits;
@@ -882,6 +895,7 @@
dt_dprintf("opened %d-bit module %s (%s) [%d]\n",
bits, dmp->dm_name, dmp->dm_file, dmp->dm_modid);
+#endif
}
/*
@@ -891,6 +905,7 @@
void
dtrace_update(dtrace_hdl_t *dtp)
{
+#ifdef DOODAD
dt_module_t *dmp;
DIR *dirp;
@@ -950,6 +965,7 @@
dt_list_delete(&dtp->dt_modlist, dtp->dt_exec);
dt_list_prepend(&dtp->dt_modlist, dtp->dt_exec);
}
+#endif
}
static dt_module_t *
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pid.c#2 (text) ====
@@ -32,7 +32,9 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
+#if defined(sun)
#include <alloca.h>
+#endif
#include <libgen.h>
#include <stddef.h>
@@ -41,6 +43,7 @@
#include <dt_pid.h>
#include <dt_string.h>
+#ifdef DOODAD
typedef struct dt_pid_probe {
dtrace_hdl_t *dpp_dtp;
dt_pcb_t *dpp_pcb;
@@ -58,11 +61,13 @@
GElf_Sym dpp_last;
uint_t dpp_last_taken;
} dt_pid_probe_t;
+#endif
/*
* Compose the lmid and object name into the canonical representation. We
* omit the lmid for the default link map for convenience.
*/
+#ifdef DOODAD
static void
dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj)
{
@@ -71,6 +76,7 @@
else
(void) snprintf(buf, len, "LM%lx`%s", lmid, obj);
}
+#endif
static int
dt_pid_error(dtrace_hdl_t *dtp, dt_pcb_t *pcb, dt_proc_t *dpr,
@@ -99,6 +105,7 @@
return (1);
}
+#ifdef DOODAD
static int
dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
{
@@ -206,7 +213,9 @@
return (0);
}
+#endif
+#ifdef DOODAD
static int
dt_pid_sym_filt(void *arg, const GElf_Sym *symp, const char *func)
{
@@ -241,7 +250,9 @@
return (0);
}
+#endif
+#ifdef DOODAD
static int
dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
{
@@ -363,7 +374,9 @@
return (0);
}
+#endif
+#ifdef DOODAD
static int
dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
{
@@ -387,7 +400,9 @@
return (0);
}
+#endif
+#ifdef DOODAD
static const prmap_t *
dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P)
{
@@ -431,12 +446,14 @@
return (pmp);
}
+#endif
static int
dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
dt_pcb_t *pcb, dt_proc_t *dpr)
{
+#ifdef DOODAD
dt_pid_probe_t pp;
int ret = 0;
@@ -519,8 +536,12 @@
dt_proc_bpenable(dpr);
return (ret);
+#else
+return 0;
+#endif
}
+#ifdef DOODAD
static int
dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
{
@@ -580,11 +601,13 @@
return (0);
}
+#endif
static int
dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
dt_pcb_t *pcb, dt_proc_t *dpr)
{
+#ifdef DOODAD
struct ps_prochandle *P = dpr->dpr_proc;
int ret = 0;
@@ -604,6 +627,9 @@
(void) dt_pid_fix_mod(pdp, P);
return (ret);
+#else
+return 0;
+#endif
}
static pid_t
@@ -639,6 +665,7 @@
int
dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
{
+#ifdef DOODAD
char provname[DTRACE_PROVNAMELEN];
struct ps_prochandle *P;
dt_proc_t *dpr;
@@ -703,6 +730,9 @@
}
return (err ? -1 : 0);
+#else
+return 0;
+#endif
}
int
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_pid.h#3 (text) ====
@@ -30,10 +30,10 @@
#pragma ident "@(#)dt_pid.h 1.7 06/02/08 SMI"
+#if defined(sun)
#include <libproc.h>
-#if defined(sun)
+#endif
#include <sys/fasttrap.h>
-#endif
#include <dt_impl.h>
#ifdef __cplusplus
@@ -47,7 +47,6 @@
dt_pcb_t *pcb);
extern int dt_pid_create_probes_module(dtrace_hdl_t *, dt_proc_t *);
-#ifdef DOODAD
extern int dt_pid_create_entry_probe(struct ps_prochandle *, dtrace_hdl_t *,
fasttrap_probe_spec_t *, const GElf_Sym *);
@@ -59,7 +58,6 @@
extern int dt_pid_create_glob_offset_probes(struct ps_prochandle *,
dtrace_hdl_t *, fasttrap_probe_spec_t *, const GElf_Sym *, const char *);
-#endif
#ifdef __cplusplus
}
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_printf.c#3 (text) ====
@@ -29,7 +29,10 @@
#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)
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_proc.c#2 (text) ====
@@ -80,7 +80,9 @@
*/
#include <sys/wait.h>
+#if defined(sun)
#include <sys/lwp.h>
+#endif
#include <strings.h>
#include <signal.h>
#include <assert.h>
@@ -93,6 +95,7 @@
#define IS_SYS_EXEC(w) (w == SYS_exec || w == SYS_execve)
#define IS_SYS_FORK(w) (w == SYS_vfork || w == SYS_fork1 || w == SYS_forkall)
+#ifdef DOODAD
static dt_bkpt_t *
dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data)
{
@@ -161,10 +164,12 @@
dbp->dbp_func(dtp, dpr, dbp->dbp_data);
(void) Pxecbkpt(dpr->dpr_proc, dbp->dbp_instr);
}
+#endif
void
dt_proc_bpenable(dt_proc_t *dpr)
{
+#ifdef DOODAD
dt_bkpt_t *dbp;
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
@@ -177,11 +182,13 @@
}
dt_dprintf("breakpoints enabled\n");
+#endif
}
void
dt_proc_bpdisable(dt_proc_t *dpr)
{
+#ifdef DOODAD
dt_bkpt_t *dbp;
assert(DT_MUTEX_HELD(&dpr->dpr_lock));
@@ -194,8 +201,10 @@
}
dt_dprintf("breakpoints disabled\n");
+#endif
}
+#ifdef DOODAD
static void
dt_proc_notify(dtrace_hdl_t *dtp, dt_proc_hash_t *dph, dt_proc_t *dpr,
const char *msg)
@@ -659,10 +668,12 @@
(void) dt_set_errno(dtp, EDT_COMPILER);
return (NULL);
}
+#endif
dt_proc_t *
dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove)
{
+#ifdef DOODAD
dt_proc_hash_t *dph = dtp->dt_procs;
pid_t pid = Pstatus(P)->pr_pid;
dt_proc_t *dpr, **dpp = &dph->dph_hash[pid & (dph->dph_hashlen - 1)];
@@ -681,11 +692,15 @@
*dpp = dpr->dpr_hash; /* remove from pid hash chain */
return (dpr);
+#else
+return NULL;
+#endif
}
static void
dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
{
+#ifdef DOODAD
dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
dt_proc_hash_t *dph = dtp->dt_procs;
dt_proc_notify_t *npr, **npp;
@@ -773,8 +788,10 @@
dt_list_delete(&dph->dph_lrulist, dpr);
Prelease(dpr->dpr_proc, rflag);
dt_free(dtp, dpr);
+#endif
}
+#ifdef DOODAD
static int
dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
{
@@ -850,10 +867,12 @@
return (err);
}
+#endif
struct ps_prochandle *
dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
{
+#ifdef DOODAD
dt_proc_hash_t *dph = dtp->dt_procs;
dt_proc_t *dpr;
int err;
@@ -886,11 +905,15 @@
dpr->dpr_refs++;
return (dpr->dpr_proc);
+#else
+return NULL;
+#endif
}
struct ps_prochandle *
dt_proc_grab(dtrace_hdl_t *dtp, pid_t pid, int flags, int nomonitor)
{
+#ifdef DOODAD
dt_proc_hash_t *dph = dtp->dt_procs;
uint_t h = pid & (dph->dph_hashlen - 1);
dt_proc_t *dpr, *opr;
@@ -980,11 +1003,15 @@
dpr->dpr_refs++;
return (dpr->dpr_proc);
+#else
+return NULL;
+#endif
}
void
dt_proc_release(dtrace_hdl_t *dtp, struct ps_prochandle *P)
{
+#ifdef DOODAD
dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
dt_proc_hash_t *dph = dtp->dt_procs;
@@ -994,6 +1021,7 @@
if (--dpr->dpr_refs == 0 &&
(!dpr->dpr_cacheable || dph->dph_lrucnt > dph->dph_lrulim))
dt_proc_destroy(dtp, P);
+#endif
}
void
@@ -1057,6 +1085,7 @@
struct ps_prochandle *
dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
{
+#ifdef DOODAD
dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
struct ps_prochandle *P = dt_proc_create(dtp, file, argv);
@@ -1064,6 +1093,9 @@
idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
return (P);
+#else
+return NULL;
+#endif
}
struct ps_prochandle *
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_proc.h#2 (text) ====
@@ -30,7 +30,9 @@
#pragma ident "@(#)dt_proc.h 1.7 06/02/08 SMI"
+#if defined(sun)
#include <libproc.h>
+#endif
#include <dtrace.h>
#include <pthread.h>
#include <dt_list.h>
@@ -45,7 +47,9 @@
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 */
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_subr.c#3 (text) ====
@@ -815,22 +815,34 @@
int
dt_rw_read_held(pthread_rwlock_t *lock)
{
+#if defined(sun)
extern int _rw_read_held(struct _rwlock *);
return (_rw_read_held((struct _rwlock *)lock));
+#else
+ return (pthread_rwlock_rdheld_np(lock));
+#endif
}
int
dt_rw_write_held(pthread_rwlock_t *lock)
{
+#if defined(sun)
extern int _rw_write_held(struct _rwlock *);
return (_rw_write_held((struct _rwlock *)lock));
+#else
+ return (pthread_rwlock_wrheld_np(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 (pthread_mutex_held_np(lock));
+#endif
}
static int
@@ -902,6 +914,7 @@
dtrace_uaddr2str(dtrace_hdl_t *dtp, pid_t pid,
uint64_t addr, char *str, int nbytes)
{
+#ifdef DOODAD
char name[PATH_MAX], objname[PATH_MAX], c[PATH_MAX * 2];
struct ps_prochandle *P = NULL;
GElf_Sym sym;
@@ -939,4 +952,7 @@
dt_proc_release(dtp, P);
return (dt_string2str(c, str, nbytes));
+#else
+return 0;
+#endif
}
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_work.c#3 (text) ====
@@ -32,9 +32,6 @@
#include <errno.h>
#include <assert.h>
#include <time.h>
-#if !defined(sun)
-#include <opensolaris/compat/sys/time.h>
-#endif
static const struct {
int dtslt_option;
More information about the p4-projects
mailing list