summaryrefslogtreecommitdiffstats
path: root/lib/libdtrace/common/dt_subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libdtrace/common/dt_subr.c')
-rw-r--r--lib/libdtrace/common/dt_subr.c50
1 files changed, 13 insertions, 37 deletions
diff --git a/lib/libdtrace/common/dt_subr.c b/lib/libdtrace/common/dt_subr.c
index b2163e6..97221c84 100644
--- a/lib/libdtrace/common/dt_subr.c
+++ b/lib/libdtrace/common/dt_subr.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/sysmacros.h>
#include <strings.h>
@@ -57,8 +55,8 @@ int
dtrace_xstr2desc(dtrace_hdl_t *dtp, dtrace_probespec_t spec,
const char *s, int argc, char *const argv[], dtrace_probedesc_t *pdp)
{
- size_t off, len, vlen;
- const char *p, *q, *v;
+ size_t off, len, vlen, wlen;
+ const char *p, *q, *v, *w;
char buf[32]; /* for id_t as %d (see below) */
@@ -74,6 +72,8 @@ dtrace_xstr2desc(dtrace_hdl_t *dtp, dtrace_probespec_t spec,
q = p + 1;
vlen = 0;
+ w = NULL;
+ wlen = 0;
if ((v = strchr(q, '$')) != NULL && v < q + len) {
/*
@@ -98,14 +98,14 @@ dtrace_xstr2desc(dtrace_hdl_t *dtp, dtrace_probespec_t spec,
}
if (isdigit(v[1])) {
- char *end;
long i;
errno = 0;
- i = strtol(v + 1, &end, 10);
+ i = strtol(v + 1, (char **)&w, 10);
+
+ wlen = vlen - (w - v);
- if (i < 0 || i >= argc ||
- errno != 0 || end != v + vlen)
+ if (i < 0 || i >= argc || errno != 0)
return (dt_set_errno(dtp, EDT_BADSPCV));
v = argv[i];
@@ -141,7 +141,7 @@ dtrace_xstr2desc(dtrace_hdl_t *dtp, dtrace_probespec_t spec,
off = dtrace_probespecs[spec--].dtps_offset;
bcopy(q, (char *)pdp + off, len);
bcopy(v, (char *)pdp + off + len, vlen);
-
+ bcopy(w, (char *)pdp + off + len + vlen, wlen);
} while (--p >= s);
pdp->dtpd_id = DTRACE_IDNONE;
@@ -803,30 +803,6 @@ dt_popcb(const ulong_t *bp, ulong_t n)
return (popc + dt_popc(bp[maxw] & ((1UL << maxb) - 1)));
}
-struct _rwlock;
-struct _lwp_mutex;
-
-int
-dt_rw_read_held(pthread_rwlock_t *lock)
-{
- extern int _rw_read_held(struct _rwlock *);
- return (_rw_read_held((struct _rwlock *)lock));
-}
-
-int
-dt_rw_write_held(pthread_rwlock_t *lock)
-{
- extern int _rw_write_held(struct _rwlock *);
- return (_rw_write_held((struct _rwlock *)lock));
-}
-
-int
-dt_mutex_held(pthread_mutex_t *lock)
-{
- extern int _mutex_held(struct _lwp_mutex *);
- return (_mutex_held((struct _lwp_mutex *)lock));
-}
-
static int
dt_string2str(char *s, char *str, int nbytes)
{
OpenPOWER on IntegriCloud