summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRoger A. Faulkner <Roger.Faulkner@Sun.COM>2010-01-11 17:42:13 -0800
committerRoger A. Faulkner <Roger.Faulkner@Sun.COM>2010-01-11 17:42:13 -0800
commit53f3aea0943e36e5fed2615ad5f9fd1f17de51d2 (patch)
tree388c0dbc3a451ff7ecf86b8263f9206f730c06e8 /usr/src
parent86a9c507121ec77a92601d8844a5ca82373cd4aa (diff)
downloadillumos-gate-53f3aea0943e36e5fed2615ad5f9fd1f17de51d2.tar.gz
6915578 MUTEX_HELD() and RW_LOCK_HELD() macros should be available to Posix threads
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/interfaces.c13
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd_subr.c28
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd_subr.h19
-rw-r--r--usr/src/cmd/svc/configd/configd.h17
-rw-r--r--usr/src/cmd/svc/startd/contract.c14
-rw-r--r--usr/src/cmd/svc/startd/graph.c77
-rw-r--r--usr/src/cmd/svc/startd/method.c4
-rw-r--r--usr/src/cmd/svc/startd/restarter.c37
-rw-r--r--usr/src/cmd/svc/startd/startd.h14
-rw-r--r--usr/src/head/synch.h19
-rw-r--r--usr/src/lib/fm/libfmd_msg/common/fmd_msg.c8
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_module.c10
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_subr.c26
-rw-r--r--usr/src/lib/fm/topo/libtopo/common/topo_subr.h6
-rw-r--r--usr/src/lib/libdtrace/common/dt_impl.h12
-rw-r--r--usr/src/lib/libdtrace/common/dt_pid.c4
-rw-r--r--usr/src/lib/libdtrace/common/dt_proc.c18
-rw-r--r--usr/src/lib/libdtrace/common/dt_subr.c27
-rw-r--r--usr/src/lib/libscf/common/lowlevel.c10
-rw-r--r--usr/src/lib/libumem/common/stub_stand.c6
20 files changed, 139 insertions, 230 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/interfaces.c b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/interfaces.c
index dcb239d746..8d7030faae 100644
--- a/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/interfaces.c
+++ b/usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/interfaces.c
@@ -18,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -169,7 +170,7 @@ refresh_pktlist(dsvc_clnt_t *pcd, PKT_LIST *plp)
PKT_LIST *wplp, *tplp, *retplp = NULL;
IF *ifp = pcd->ifp;
- assert(_mutex_held(&pcd->pkt_mtx));
+ assert(MUTEX_HELD(&pcd->pkt_mtx));
wplp = pcd->pkthead;
while (wplp != NULL) {
@@ -452,7 +453,7 @@ zap_ifp(IF **ifp_prevpp, IF *ifp)
{
IF *tifp;
- assert(_mutex_held(&if_head_mtx));
+ assert(MUTEX_HELD(&if_head_mtx));
if (*ifp_prevpp == ifp) {
if_head = ifp->next;
@@ -1104,7 +1105,7 @@ open_interfaces(void)
void
detach_plp(dsvc_clnt_t *pcd, PKT_LIST *plp)
{
- assert(_mutex_held(&pcd->pkt_mtx));
+ assert(MUTEX_HELD(&pcd->pkt_mtx));
if (plp->prev == NULL) {
pcd->pkthead = plp->next;
@@ -1160,7 +1161,7 @@ close_interface(IF *ifp)
assert(ifp != NULL);
- assert(_mutex_held(&if_head_mtx));
+ assert(MUTEX_HELD(&if_head_mtx));
(void) mutex_lock(&ifp->ifp_mtx);
ifp->thr_exit = 1;
@@ -1429,7 +1430,7 @@ free_pktlist(dsvc_clnt_t *pcd)
PKT_LIST *plp, *plp_next;
IF *ifp = pcd->ifp;
- assert(_mutex_held(&pcd->pcd_mtx));
+ assert(MUTEX_HELD(&pcd->pcd_mtx));
plp = pcd->pkthead;
while (plp != NULL) {
diff --git a/usr/src/cmd/fm/fmd/common/fmd_subr.c b/usr/src/cmd/fm/fmd/common/fmd_subr.c
index 46878ba0f4..cdc52bf9ec 100644
--- a/usr/src/cmd/fm/fmd/common/fmd_subr.c
+++ b/usr/src/cmd/fm/fmd/common/fmd_subr.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2007 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 <atomic.h>
#include <alloca.h>
#include <syslog.h>
@@ -47,30 +45,6 @@
#include <fmd.h>
-struct _rwlock;
-struct _lwp_mutex;
-
-int
-fmd_rw_read_held(pthread_rwlock_t *lock)
-{
- extern int _rw_read_held(struct _rwlock *);
- return (_rw_read_held((struct _rwlock *)lock));
-}
-
-int
-fmd_rw_write_held(pthread_rwlock_t *lock)
-{
- extern int _rw_write_held(struct _rwlock *);
- return (_rw_write_held((struct _rwlock *)lock));
-}
-
-int
-fmd_mutex_held(pthread_mutex_t *lock)
-{
- extern int _mutex_held(struct _lwp_mutex *);
- return (_mutex_held((struct _lwp_mutex *)lock));
-}
-
int
fmd_assert(const char *expr, const char *file, int line)
{
diff --git a/usr/src/cmd/fm/fmd/common/fmd_subr.h b/usr/src/cmd/fm/fmd/common/fmd_subr.h
index b213bcdd45..97662e0752 100644
--- a/usr/src/cmd/fm/fmd/common/fmd_subr.h
+++ b/usr/src/cmd/fm/fmd/common/fmd_subr.h
@@ -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.
@@ -21,31 +20,21 @@
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FMD_SUBR_H
#define _FMD_SUBR_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <pthread.h>
+#include <synch.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
-extern int fmd_rw_read_held(pthread_rwlock_t *);
-extern int fmd_rw_write_held(pthread_rwlock_t *);
-extern int fmd_mutex_held(pthread_mutex_t *);
-
-#define RW_READ_HELD(x) fmd_rw_read_held(x)
-#define RW_WRITE_HELD(x) fmd_rw_write_held(x)
-#define RW_LOCK_HELD(x) (RW_READ_HELD(x) || RW_WRITE_HELD(x))
-#define MUTEX_HELD(x) fmd_mutex_held(x)
-
#ifdef DEBUG
extern int fmd_assert(const char *, const char *, int);
#define ASSERT(x) ((void)((x) || fmd_assert(#x, __FILE__, __LINE__)))
diff --git a/usr/src/cmd/svc/configd/configd.h b/usr/src/cmd/svc/configd/configd.h
index cf06193b48..ff2b450619 100644
--- a/usr/src/cmd/svc/configd/configd.h
+++ b/usr/src/cmd/svc/configd/configd.h
@@ -18,19 +18,19 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CONFIGD_H
#define _CONFIGD_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <bsm/adt.h>
#include <door.h>
#include <pthread.h>
+#include <synch.h>
#include <string.h>
#include <sys/types.h>
@@ -72,11 +72,14 @@ extern "C" {
#define offsetofend(t, f) (offsetof(t, f) + sizeof (((t *)0)->f))
/*
- * We want MUTEX_HELD, but we also want pthreads. So we're stuck with this.
+ * We want MUTEX_HELD, but we also want pthreads. So we're stuck with this
+ * for the native build, at least until the build machines can catch up
+ * with the latest version of MUTEX_HELD() in <synch.h>.
*/
-struct _lwp_mutex_t;
-extern int _mutex_held(struct _lwp_mutex_t *);
-#define MUTEX_HELD(m) _mutex_held((struct _lwp_mutex_t *)(m))
+#if defined(NATIVE_BUILD)
+#undef MUTEX_HELD
+#define MUTEX_HELD(m) _mutex_held((mutex_t *)(m))
+#endif
/*
* Maximum levels of composition.
diff --git a/usr/src/cmd/svc/startd/contract.c b/usr/src/cmd/svc/startd/contract.c
index d9eca7631a..9d2d8aa504 100644
--- a/usr/src/cmd/svc/startd/contract.c
+++ b/usr/src/cmd/svc/startd/contract.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 2004 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"
-
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif /* _FILE_OFFSET_BITS */
@@ -270,7 +268,7 @@ contract_hold_bucket(ctid_t ctid)
static void
contract_release_bucket(contract_bucket_t *bp)
{
- assert(PTHREAD_MUTEX_HELD(&bp->cb_lock));
+ assert(MUTEX_HELD(&bp->cb_lock));
MUTEX_UNLOCK(&bp->cb_lock);
}
@@ -279,7 +277,7 @@ contract_lookup(contract_bucket_t *bp, ctid_t ctid)
{
contract_entry_t *ce;
- assert(PTHREAD_MUTEX_HELD(&bp->cb_lock));
+ assert(MUTEX_HELD(&bp->cb_lock));
if (bp->cb_list == NULL)
return (NULL);
diff --git a/usr/src/cmd/svc/startd/graph.c b/usr/src/cmd/svc/startd/graph.c
index 27a48a5352..38cd0a30c2 100644
--- a/usr/src/cmd/svc/startd/graph.c
+++ b/usr/src/cmd/svc/startd/graph.c
@@ -18,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -297,7 +298,7 @@ vertex_get_by_name(const char *name)
{
int id;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
id = dict_lookup_byname(name);
if (id == -1)
@@ -309,7 +310,7 @@ vertex_get_by_name(const char *name)
static graph_vertex_t *
vertex_get_by_id(int id)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (id == -1)
return (NULL);
@@ -329,7 +330,7 @@ graph_add_vertex(const char *name)
void *p;
uu_list_index_t idx;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
id = dict_insert(name);
@@ -359,7 +360,7 @@ graph_add_vertex(const char *name)
static void
graph_remove_vertex(graph_vertex_t *v)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(uu_list_numnodes(v->gv_dependencies) == 0);
assert(uu_list_numnodes(v->gv_dependents) == 0);
@@ -379,7 +380,7 @@ graph_add_edge(graph_vertex_t *fv, graph_vertex_t *tv)
graph_edge_t *e, *re;
int r;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
e = startd_alloc(sizeof (graph_edge_t));
re = startd_alloc(sizeof (graph_edge_t));
@@ -432,7 +433,7 @@ remove_inst_vertex(graph_vertex_t *v)
graph_vertex_t *sv;
int i;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(uu_list_numnodes(v->gv_dependents) == 1);
assert(uu_list_numnodes(v->gv_dependencies) == 0);
assert(v->gv_refs == 0);
@@ -476,7 +477,7 @@ graph_walk_dependencies(graph_vertex_t *v, void (*func)(graph_vertex_t *,
{
graph_edge_t *e;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
for (e = uu_list_first(v->gv_dependencies);
e != NULL;
@@ -678,7 +679,7 @@ path_to_str(int *path, char **cpp, size_t *sz)
size_t allocd, new_allocd;
char *new, *name;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(path[0] != -1);
allocd = 1;
@@ -725,7 +726,7 @@ path_to_str(int *path, char **cpp, size_t *sz)
static void
graph_clogin_start(graph_vertex_t *v)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (sulogin_running)
console_login_ready = B_TRUE;
@@ -859,7 +860,7 @@ vertex_send_event(graph_vertex_t *v, restarter_event_type_t e)
static void
graph_unset_restarter(graph_vertex_t *v)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_flags & GV_CONFIGURED);
vertex_send_event(v, RESTARTER_EVENT_TYPE_REMOVE_INSTANCE);
@@ -882,7 +883,7 @@ graph_unset_restarter(graph_vertex_t *v)
static int
free_if_unrefed(graph_vertex_t *v)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (v->gv_refs > 0)
return (VERTEX_INUSE);
@@ -909,7 +910,7 @@ delete_depgroup(graph_vertex_t *v)
graph_edge_t *e;
graph_vertex_t *dv;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_type == GVT_GROUP);
assert(uu_list_numnodes(v->gv_dependents) == 0);
@@ -990,7 +991,7 @@ delete_instance_dependencies(graph_vertex_t *v, boolean_t delete_restarter_dep)
void *ptrs[2];
int r;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_type == GVT_INST);
ptrs[0] = v;
@@ -1018,7 +1019,7 @@ graph_insert_vertex_unconfigured(const char *fmri, gv_type_t type,
int r;
int i;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
switch (type) {
case GVT_SVC:
@@ -1113,7 +1114,7 @@ graph_insert_dependency(graph_vertex_t *fv, graph_vertex_t *tv, int **pathp)
{
hrtime_t now;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
/* cycle detection */
now = gethrtime();
@@ -1860,7 +1861,7 @@ graph_enable_by_vertex(graph_vertex_t *vertex, int enable, int admin)
graph_vertex_t *v;
int r;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert((vertex->gv_flags & GV_CONFIGURED));
vertex->gv_flags = (vertex->gv_flags & ~GV_ENABLED) |
@@ -1992,7 +1993,7 @@ graph_change_restarter(graph_vertex_t *v, const char *fmri_arg, scf_handle_t *h,
int err;
int id;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (fmri_arg[0] != '\0') {
err = fmri_canonify(fmri_arg, &restarter_fmri, B_TRUE);
@@ -2271,7 +2272,7 @@ process_dependency_fmri(const char *fmri, struct depfmri_info *info)
scf_instance_t *inst;
boolean_t rebound;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
/* Get or create vertex for FMRI */
depgroup_v = info->v;
@@ -2469,7 +2470,7 @@ process_dependency_pg(scf_propertygroup_t *pg, struct deppg_info *info)
scf_error_t scferr;
ssize_t len;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
h = scf_pg_handle(pg);
@@ -2623,7 +2624,7 @@ set_dependencies(graph_vertex_t *v, scf_instance_t *inst, int **pathp)
int err;
uint_t old_configured;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
/*
* Mark the vertex as configured during dependency insertion to avoid
@@ -2668,7 +2669,7 @@ handle_cycle(const char *fmri, int *path)
const char *cp;
size_t sz;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
path_to_str(path, (char **)&cp, &sz);
@@ -2686,7 +2687,7 @@ handle_cycle(const char *fmri, int *path)
static void
vertex_ref(graph_vertex_t *v)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
v->gv_refs++;
}
@@ -2701,7 +2702,7 @@ vertex_ref(graph_vertex_t *v)
static int
vertex_unref(graph_vertex_t *v)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_refs > 0);
v->gv_refs--;
@@ -2948,7 +2949,7 @@ refresh_vertex(graph_vertex_t *v, scf_instance_t *inst)
graph_edge_t *e;
graph_vertex_t *vv;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_type == GVT_INST);
log_framework(LOG_DEBUG, "Graph engine: Refreshing %s.\n", v->gv_name);
@@ -3081,7 +3082,7 @@ configure_vertex(graph_vertex_t *v, scf_instance_t *inst)
restarter_fmri[0] = '\0';
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_type == GVT_INST);
assert((v->gv_flags & GV_CONFIGURED) == 0);
@@ -3645,7 +3646,7 @@ can_come_up(void)
{
int i;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
/*
* If we are booting to single user (boot -s),
@@ -3752,7 +3753,7 @@ run_sulogin(const char *msg)
{
graph_vertex_t *v;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (sulogin_running)
return (EALREADY);
@@ -4036,7 +4037,7 @@ dgraph_add_instance(const char *inst_fmri, scf_instance_t *inst,
if (lock_graph) {
MUTEX_LOCK(&dgraph_lock);
} else {
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
}
v = vertex_get_by_name(inst_fmri);
@@ -4229,7 +4230,7 @@ dgraph_refresh_instance(graph_vertex_t *v, scf_instance_t *inst)
int r;
int enabled;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
assert(v->gv_type == GVT_INST);
/* Only refresh services with valid general/enabled properties. */
@@ -4282,7 +4283,7 @@ insubtree_dependents_down(graph_vertex_t *v)
graph_vertex_t *vv;
graph_edge_t *e;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
for (e = uu_list_first(v->gv_dependents); e != NULL;
e = uu_list_next(v->gv_dependents, e)) {
@@ -4320,7 +4321,7 @@ is_nonsubgraph_leaf(graph_vertex_t *v)
graph_vertex_t *vv;
graph_edge_t *e;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
for (e = uu_list_first(v->gv_dependents);
e != NULL;
@@ -4453,7 +4454,7 @@ disable_service_temporarily(graph_vertex_t *v, scf_handle_t *h)
void
offline_subtree_leaves(graph_vertex_t *v, void *arg)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
/* If v isn't an instance, recurse on its dependencies. */
if (v->gv_type != GVT_INST) {
@@ -4499,7 +4500,7 @@ graph_offline_subtree_leaves(graph_vertex_t *v, void *h)
static void
disable_nonsubgraph_leaves(graph_vertex_t *v, void *arg)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
/*
* We must skip exclusion dependencies because they are allowed to
@@ -4694,7 +4695,7 @@ void
graph_transition_sulogin(restarter_instance_state_t state,
restarter_instance_state_t old_state)
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (state != old_state && st->st_load_complete &&
!go_single_user_mode && !go_to_level1 &&
@@ -4837,7 +4838,7 @@ dgraph_remove_instance(const char *fmri, scf_handle_t *h)
static char
target_milestone_as_runlevel()
{
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (milestone == NULL)
return ('3');
@@ -4880,7 +4881,7 @@ signal_init(char rl)
pid_t init_pid;
int i;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
if (zone_getattr(getzoneid(), ZONE_ATTR_INITPID, &init_pid,
sizeof (init_pid)) != sizeof (init_pid)) {
@@ -4931,7 +4932,7 @@ graph_runlevel_changed(char rl, int online)
{
char trl;
- assert(PTHREAD_MUTEX_HELD(&dgraph_lock));
+ assert(MUTEX_HELD(&dgraph_lock));
trl = target_milestone_as_runlevel();
diff --git a/usr/src/cmd/svc/startd/method.c b/usr/src/cmd/svc/startd/method.c
index 77f52f77c7..0febc9d009 100644
--- a/usr/src/cmd/svc/startd/method.c
+++ b/usr/src/cmd/svc/startd/method.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -617,7 +617,7 @@ method_run(restarter_inst_t **instp, int type, int *exit_code)
int id = inst->ri_id;
int forkerr;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
assert(instance_in_transition(inst));
if (inst->ri_mi_deleted)
diff --git a/usr/src/cmd/svc/startd/restarter.c b/usr/src/cmd/svc/startd/restarter.c
index ea828797fc..b8654776c5 100644
--- a/usr/src/cmd/svc/startd/restarter.c
+++ b/usr/src/cmd/svc/startd/restarter.c
@@ -18,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -672,7 +673,7 @@ restarter_delete_inst(restarter_inst_t *ri)
void *cookie = NULL;
restarter_instance_qentry_t *e;
- assert(PTHREAD_MUTEX_HELD(&ri->ri_lock));
+ assert(MUTEX_HELD(&ri->ri_lock));
/*
* Must drop the instance lock so we can pick up the instance_list
@@ -735,7 +736,7 @@ restarter_delete_inst(restarter_inst_t *ri)
int
instance_is_wait_style(restarter_inst_t *inst)
{
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
return ((inst->ri_flags & RINST_STYLE_MASK) == RINST_WAIT);
}
@@ -747,7 +748,7 @@ instance_is_wait_style(restarter_inst_t *inst)
int
instance_is_transient_style(restarter_inst_t *inst)
{
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
return ((inst->ri_flags & RINST_STYLE_MASK) == RINST_TRANSIENT);
}
@@ -758,7 +759,7 @@ instance_is_transient_style(restarter_inst_t *inst)
int
instance_in_transition(restarter_inst_t *inst)
{
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
if (inst->ri_i.i_next_state == RESTARTER_STATE_NONE)
return (0);
return (1);
@@ -772,7 +773,7 @@ instance_started(restarter_inst_t *inst)
{
int ret;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
if (inst->ri_i.i_state == RESTARTER_STATE_ONLINE ||
inst->ri_i.i_state == RESTARTER_STATE_DEGRADED)
@@ -800,7 +801,7 @@ restarter_instance_update_states(scf_handle_t *h, restarter_inst_t *ri,
int prev_state_online;
int state_online;
- assert(PTHREAD_MUTEX_HELD(&ri->ri_lock));
+ assert(MUTEX_HELD(&ri->ri_lock));
prev_state_online = instance_started(ri);
@@ -988,7 +989,7 @@ stop_instance(scf_handle_t *local_handle, restarter_inst_t *inst,
int err;
restarter_error_t re;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
assert(inst->ri_method_thread == 0);
switch (cause) {
@@ -1165,7 +1166,7 @@ unmaintain_instance(scf_handle_t *h, restarter_inst_t *rip,
uint_t tries = 0, msecs = ALLOC_DELAY;
const char *cp;
- assert(PTHREAD_MUTEX_HELD(&rip->ri_lock));
+ assert(MUTEX_HELD(&rip->ri_lock));
if (rip->ri_i.i_state != RESTARTER_STATE_MAINT) {
log_error(LOG_DEBUG, "Restarter: "
@@ -1286,7 +1287,7 @@ enable_inst(scf_handle_t *h, restarter_inst_t *inst, restarter_event_type_t e)
restarter_instance_state_t state;
int r;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
assert(e == RESTARTER_EVENT_TYPE_ADMIN_DISABLE ||
e == RESTARTER_EVENT_TYPE_DISABLE ||
e == RESTARTER_EVENT_TYPE_ENABLE);
@@ -1377,7 +1378,7 @@ start_instance(scf_handle_t *local_handle, restarter_inst_t *inst)
{
fork_info_t *info;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
assert(instance_in_transition(inst) == 0);
assert(inst->ri_method_thread == 0);
@@ -1437,7 +1438,7 @@ maintain_instance(scf_handle_t *h, restarter_inst_t *rip, int immediate,
fork_info_t *info;
scf_instance_t *scf_inst = NULL;
- assert(PTHREAD_MUTEX_HELD(&rip->ri_lock));
+ assert(MUTEX_HELD(&rip->ri_lock));
assert(aux != NULL);
assert(rip->ri_method_thread == 0);
@@ -1515,7 +1516,7 @@ refresh_instance(scf_handle_t *h, restarter_inst_t *rip)
fork_info_t *info;
int r;
- assert(PTHREAD_MUTEX_HELD(&rip->ri_lock));
+ assert(MUTEX_HELD(&rip->ri_lock));
log_instance(rip, B_TRUE, "Rereading configuration.");
log_framework(LOG_DEBUG, "%s: rereading configuration.\n",
@@ -1780,8 +1781,8 @@ restarter_queue_event(restarter_inst_t *ri, restarter_protocol_event_t *e)
restarter_instance_qentry_t *qe;
int r;
- assert(PTHREAD_MUTEX_HELD(&ri->ri_queue_lock));
- assert(!PTHREAD_MUTEX_HELD(&ri->ri_lock));
+ assert(MUTEX_HELD(&ri->ri_queue_lock));
+ assert(!MUTEX_HELD(&ri->ri_lock));
qe = startd_zalloc(sizeof (restarter_instance_qentry_t));
qe->riq_type = e->rpe_type;
@@ -1949,7 +1950,7 @@ contract_action(scf_handle_t *h, restarter_inst_t *inst, ctid_t id,
{
const char *fmri = inst->ri_i.i_fmri;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
/*
* If startd has stopped this contract, there is no need to
@@ -2251,7 +2252,7 @@ timeout_insert(restarter_inst_t *inst, ctid_t cid, uint64_t timeout_sec)
timeout_entry_t *entry;
uu_list_index_t idx;
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
now = gethrtime();
@@ -2294,7 +2295,7 @@ timeout_insert(restarter_inst_t *inst, ctid_t cid, uint64_t timeout_sec)
void
timeout_remove(restarter_inst_t *inst, ctid_t cid)
{
- assert(PTHREAD_MUTEX_HELD(&inst->ri_lock));
+ assert(MUTEX_HELD(&inst->ri_lock));
if (inst->ri_timeout == NULL)
return;
diff --git a/usr/src/cmd/svc/startd/startd.h b/usr/src/cmd/svc/startd/startd.h
index 64ca044c2d..09591e8822 100644
--- a/usr/src/cmd/svc/startd/startd.h
+++ b/usr/src/cmd/svc/startd/startd.h
@@ -18,15 +18,15 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _STARTD_H
#define _STARTD_H
-
#include <sys/time.h>
#include <librestart.h>
#include <librestart_priv.h>
@@ -34,6 +34,7 @@
#include <libsysevent.h>
#include <libuutil.h>
#include <pthread.h>
+#include <synch.h>
#include <stdio.h>
#include <syslog.h>
#include <umem.h>
@@ -43,9 +44,14 @@ extern "C" {
#endif
/*
- * We want MUTEX_HELD, but we also want pthreads. So we're stuck with this.
+ * We want MUTEX_HELD, but we also want pthreads. So we're stuck with this
+ * for the native build, at least until the build machines can catch up
+ * with the latest version of MUTEX_HELD() in <synch.h>.
*/
-#define PTHREAD_MUTEX_HELD(m) _mutex_held((struct _lwp_mutex *)(m))
+#if defined(NATIVE_BUILD)
+#undef MUTEX_HELD
+#define MUTEX_HELD(m) _mutex_held((mutex_t *)(m))
+#endif
#ifndef NDEBUG
diff --git a/usr/src/head/synch.h b/usr/src/head/synch.h
index eab9de86a5..bf73cb33cf 100644
--- a/usr/src/head/synch.h
+++ b/usr/src/head/synch.h
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYNCH_H
#define _SYNCH_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* synch.h:
* definitions needed to use the thread synchronization interface
@@ -243,10 +241,17 @@ int sema_trywait();
#ifdef __STDC__
-int _sema_held(sema_t *);
-int _rw_read_held(rwlock_t *);
-int _rw_write_held(rwlock_t *);
-int _mutex_held(mutex_t *);
+/*
+ * The *_held() functions apply equally well to Solaris threads
+ * and to Posix threads synchronization objects, but the formal
+ * type declarations are different, so we just declare the argument
+ * to each *_held() function to be a void *, expecting that they will
+ * be called with the proper type of argument in each case.
+ */
+int _sema_held(void *); /* sema_t or sem_t */
+int _rw_read_held(void *); /* rwlock_t or pthread_rwlock_t */
+int _rw_write_held(void *); /* rwlock_t or pthread_rwlock_t */
+int _mutex_held(void *); /* mutex_t or pthread_mutex_t */
#else /* __STDC__ */
diff --git a/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c b/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c
index b41f3f1742..5a1097b944 100644
--- a/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c
+++ b/usr/src/lib/fm/libfmd_msg/common/fmd_msg.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -100,6 +100,7 @@
#include <alloca.h>
#include <assert.h>
#include <pthread.h>
+#include <synch.h>
#include <strings.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -242,14 +243,11 @@ static int fmd_msg_nv_parse_nvpair(fmd_msg_buf_t *, nvpair_t *, char *);
static int fmd_msg_nv_parse_nvname(fmd_msg_buf_t *, nvlist_t *, char *);
static int fmd_msg_nv_parse_nvlist(fmd_msg_buf_t *, nvlist_t *, char *);
-struct _rwlock;
-
/*ARGSUSED*/
static int
fmd_msg_lock_held(fmd_msg_hdl_t *h)
{
- extern int _rw_write_held(struct _rwlock *);
- return (_rw_write_held((struct _rwlock *)&fmd_msg_rwlock));
+ return (RW_WRITE_HELD(&fmd_msg_rwlock));
}
void
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_module.c b/usr/src/lib/fm/topo/libtopo/common/topo_module.c
index 6a84a19f96..78a83ab412 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_module.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_module.c
@@ -18,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2007 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 <signal.h>
#include <dirent.h>
#include <limits.h>
@@ -32,6 +31,7 @@
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
+#include <synch.h>
#include <errno.h>
#include <strings.h>
#include <assert.h>
@@ -185,7 +185,7 @@ topo_mod_destroy(topo_mod_t *mod)
return;
assert(mod->tm_refs == 0);
- assert(!topo_mutex_held(&mod->tm_lock));
+ assert(!MUTEX_HELD(&mod->tm_lock));
if (mod->tm_name != NULL)
topo_hdl_strfree(thp, mod->tm_name);
@@ -339,7 +339,7 @@ topo_modhash_unload(topo_mod_t *mod)
topo_hdl_t *thp = mod->tm_hdl;
topo_modhash_t *mhp;
- assert(topo_mutex_held(&mod->tm_lock));
+ assert(MUTEX_HELD(&mod->tm_lock));
assert(mod->tm_busy == 0);
mhp = thp->th_modhash;
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_subr.c b/usr/src/lib/fm/topo/libtopo/common/topo_subr.c
index 59ba4e6dcb..28831ae0fa 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_subr.c
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_subr.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -34,30 +34,6 @@
#include <topo_error.h>
#include <topo_subr.h>
-struct _rwlock;
-struct _lwp_mutex;
-
-int
-topo_rw_read_held(pthread_rwlock_t *lock)
-{
- extern int _rw_read_held(struct _rwlock *);
- return (_rw_read_held((struct _rwlock *)lock));
-}
-
-int
-topo_rw_write_held(pthread_rwlock_t *lock)
-{
- extern int _rw_write_held(struct _rwlock *);
- return (_rw_write_held((struct _rwlock *)lock));
-}
-
-int
-topo_mutex_held(pthread_mutex_t *lock)
-{
- extern int _mutex_held(struct _lwp_mutex *);
- return (_mutex_held((struct _lwp_mutex *)lock));
-}
-
void
topo_hdl_lock(topo_hdl_t *thp)
{
diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_subr.h b/usr/src/lib/fm/topo/libtopo/common/topo_subr.h
index 2908cdc0a0..6cc4674bb6 100644
--- a/usr/src/lib/fm/topo/libtopo/common/topo_subr.h
+++ b/usr/src/lib/fm/topo/libtopo/common/topo_subr.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -115,10 +115,6 @@ extern topo_name_trans_t topo_sensor_states_generic_acpi_pwr_table[];
extern topo_name_trans_t topo_sensor_states_generic_failure_table[];
extern topo_name_trans_t topo_sensor_states_generic_ok_table[];
-extern int topo_rw_read_held(pthread_rwlock_t *);
-extern int topo_rw_write_held(pthread_rwlock_t *);
-extern int topo_mutex_held(pthread_mutex_t *);
-
extern void topo_hdl_lock(topo_hdl_t *);
extern void topo_hdl_unlock(topo_hdl_t *);
diff --git a/usr/src/lib/libdtrace/common/dt_impl.h b/usr/src/lib/libdtrace/common/dt_impl.h
index adf0f74094..1937ce0647 100644
--- a/usr/src/lib/libdtrace/common/dt_impl.h
+++ b/usr/src/lib/libdtrace/common/dt_impl.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -33,6 +33,7 @@
#include <libctf.h>
#include <dtrace.h>
#include <gelf.h>
+#include <synch.h>
#ifdef __cplusplus
extern "C" {
@@ -567,17 +568,8 @@ extern int dt_buffered_flush(dtrace_hdl_t *, dtrace_probedata_t *,
extern void dt_buffered_disable(dtrace_hdl_t *);
extern void dt_buffered_destroy(dtrace_hdl_t *);
-extern int dt_rw_read_held(pthread_rwlock_t *);
-extern int dt_rw_write_held(pthread_rwlock_t *);
-extern int dt_mutex_held(pthread_mutex_t *);
-
extern uint64_t dt_stddev(uint64_t *, uint64_t);
-#define DT_RW_READ_HELD(x) dt_rw_read_held(x)
-#define DT_RW_WRITE_HELD(x) dt_rw_write_held(x)
-#define DT_RW_LOCK_HELD(x) (DT_RW_READ_HELD(x) || DT_RW_WRITE_HELD(x))
-#define DT_MUTEX_HELD(x) dt_mutex_held(x)
-
extern int dt_options_load(dtrace_hdl_t *);
extern void dt_dprintf(const char *, ...);
diff --git a/usr/src/lib/libdtrace/common/dt_pid.c b/usr/src/lib/libdtrace/common/dt_pid.c
index 091772405f..241805154a 100644
--- a/usr/src/lib/libdtrace/common/dt_pid.c
+++ b/usr/src/lib/libdtrace/common/dt_pid.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -576,7 +576,7 @@ dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
struct ps_prochandle *P = dpr->dpr_proc;
int ret = 0;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
(void) Pupdate_maps(P);
if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) {
diff --git a/usr/src/lib/libdtrace/common/dt_proc.c b/usr/src/lib/libdtrace/common/dt_proc.c
index 5615c11c68..001534163b 100644
--- a/usr/src/lib/libdtrace/common/dt_proc.c
+++ b/usr/src/lib/libdtrace/common/dt_proc.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -97,7 +97,7 @@ dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data)
struct ps_prochandle *P = dpr->dpr_proc;
dt_bkpt_t *dbp;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
if ((dbp = dt_zalloc(dpr->dpr_hdl, sizeof (dt_bkpt_t))) != NULL) {
dbp->dbp_func = func;
@@ -119,7 +119,7 @@ dt_proc_bpdestroy(dt_proc_t *dpr, int delbkpts)
int state = Pstate(dpr->dpr_proc);
dt_bkpt_t *dbp, *nbp;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps); dbp != NULL; dbp = nbp) {
if (delbkpts && dbp->dbp_active &&
@@ -139,7 +139,7 @@ dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
const lwpstatus_t *psp = &Pstatus(dpr->dpr_proc)->pr_lwp;
dt_bkpt_t *dbp;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
@@ -165,7 +165,7 @@ dt_proc_bpenable(dt_proc_t *dpr)
{
dt_bkpt_t *dbp;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
@@ -182,7 +182,7 @@ dt_proc_bpdisable(dt_proc_t *dpr)
{
dt_bkpt_t *dbp;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
for (dbp = dt_list_next(&dpr->dpr_bps);
dbp != NULL; dbp = dt_list_next(dbp)) {
@@ -230,7 +230,7 @@ dt_proc_notify(dtrace_hdl_t *dtp, dt_proc_hash_t *dph, dt_proc_t *dpr,
static void
dt_proc_stop(dt_proc_t *dpr, uint8_t why)
{
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
assert(why != DT_PROC_STOP_IDLE);
if (dpr->dpr_stop & why) {
@@ -331,7 +331,7 @@ dt_proc_attach(dt_proc_t *dpr, int exec)
rd_err_e err;
GElf_Sym sym;
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
if (exec) {
if (psp->pr_lwp.pr_errno != 0)
@@ -397,7 +397,7 @@ dt_proc_waitrun(dt_proc_t *dpr)
const long wstop = PCWSTOP;
int pfd = Pctlfd(P);
- assert(DT_MUTEX_HELD(&dpr->dpr_lock));
+ assert(MUTEX_HELD(&dpr->dpr_lock));
assert(psp->pr_flags & PR_STOPPED);
assert(Pstate(P) == PS_STOP);
diff --git a/usr/src/lib/libdtrace/common/dt_subr.c b/usr/src/lib/libdtrace/common/dt_subr.c
index a08e48c7c3..97221c84d6 100644
--- a/usr/src/lib/libdtrace/common/dt_subr.c
+++ b/usr/src/lib/libdtrace/common/dt_subr.c
@@ -18,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -802,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)
{
diff --git a/usr/src/lib/libscf/common/lowlevel.c b/usr/src/lib/libscf/common/lowlevel.c
index 1300a6be73..92028e610b 100644
--- a/usr/src/lib/libscf/common/lowlevel.c
+++ b/usr/src/lib/libscf/common/lowlevel.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -43,6 +43,7 @@
#include <libuutil.h>
#include <poll.h>
#include <pthread.h>
+#include <synch.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -93,13 +94,6 @@ static char index32[128] = {
#define DECODE32_GS (8) /* scf_decode32 group size */
-/*
- * We want MUTEX_HELD, but we also want pthreads.
- */
-struct _lwp_mutex;
-extern int _mutex_held(struct _lwp_mutex *);
-#define MUTEX_HELD(m) _mutex_held((struct _lwp_mutex *)(m))
-
#ifdef lint
#define assert_nolint(x) (void)0
#else
diff --git a/usr/src/lib/libumem/common/stub_stand.c b/usr/src/lib/libumem/common/stub_stand.c
index 025001ff73..54635558c3 100644
--- a/usr/src/lib/libumem/common/stub_stand.c
+++ b/usr/src/lib/libumem/common/stub_stand.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2008 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"
-
/*
* Stubs for the standalone to reduce the dependence on external libraries
*/
@@ -96,7 +94,7 @@ mutex_destroy(mutex_t *mp)
/*ARGSUSED*/
int
-_mutex_held(mutex_t *mp)
+_mutex_held(void *mp)
{
return (1);
}